bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Define DEBUG by default in mktime.c


From: Siddhesh Poyarekar
Subject: Re: Define DEBUG by default in mktime.c
Date: Fri, 27 Jun 2014 14:20:58 +0530
User-agent: Mutt/1.5.22.1-rc1 (2013-10-16)

On Thu, Jun 26, 2014 at 01:21:46PM -0600, Eric Blake wrote:
> NACK.  This doesn't work well with the rest of the file, which only does:
> 
> #if DEBUG
> ...
> #endif
> 
> which is well-defined by C99 even when DEBUG is undefined.  If your
> compiler is warning, it is because you turned on too many warnings
> compared to what gnulib is willing to support.
> 
> The other usage in the file is:
> 
> /*
> Local Variables:
> compile-command: "gcc -DDEBUG -I. -Wall -W -O2 -g mktime.c -o mktime"
> End:
> */
> 
> which is a handy way in emacs to automatically compile the test program;
> but if you hard-code a #define without first checking #ifdef to see
> whether a define was inherited via the -DDEBUG listed in that command
> line, then you've broken this setup.
> 
> I see no reason to change anything here.

Would this be better then?  The reason I'm looking to get this changed
is that glibc is being built with -Wundef and we're looking to
eventually change that to -Werror=undef so that we can catch typo
errors more reliably.

Thanks,
Siddhesh

        * lib/mktime.c: Use #ifdef instead of #if to test DEBUG.

diff --git a/lib/mktime.c b/lib/mktime.c
index f10e530..f01c665 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -38,7 +38,7 @@
 
 #include <string.h>            /* For the real memcpy prototype.  */
 
-#if DEBUG
+#ifdef DEBUG
 # include <stdio.h>
 # include <stdlib.h>
 /* Make it work even if the system's libc has its own mktime routine.  */
@@ -600,7 +600,7 @@ libc_hidden_def (mktime)
 libc_hidden_weak (timelocal)
 #endif
 
-#if DEBUG
+#ifdef DEBUG
 
 static int
 not_equal_tm (const struct tm *a, const struct tm *b)

Attachment: pgpUBU0lRXlZ0.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]