Sync up mktime.c after fixing Wundef warning for DEBUG

Message ID 20140627184536.GJ4477@spoyarek.pnq.redhat.com
State Committed
Headers

Commit Message

Siddhesh Poyarekar June 27, 2014, 6:45 p.m. UTC
  Hi,

This is what went into gnulib to fix the Wundef warning for DEBUG in
mktime.  The idea of defining it to 0 was not acceptable because it
breaks being able to build through emacs.  In the end a compromise was
struck which fixed the warning and also ensured that DEBUG is set and
not just defined.

Siddhesh

2014-06-27  Paul Eggert  <eggert@cs.ucla.edu>

	mktime: merge #if/#ifdef usage from glibc
	* lib/mktime.c: Use "#if defined DEBUG && DEBUG", not "#if DEBUG",
	as that works with both Glibc's and Gnulib's style.
	See thread starting at Siddhesh Poyarekar's bug report at:
	http://lists.gnu.org/archive/html/bug-gnulib/2014-06/msg00102.html


commit e2646b0c6b5acda25e9ffeb4c12a5513a1e3b5ac
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Fri Jun 27 11:35:44 2014 -0700

    mktime: merge #if/#ifdef usage from glibc
    
    * lib/mktime.c: Use "#if defined DEBUG && DEBUG", not "#if DEBUG",
    as that works with both Glibc's and Gnulib's style.
    See thread starting at Siddhesh Poyarekar's bug report at:
    http://lists.gnu.org/archive/html/bug-gnulib/2014-06/msg00102.html
  

Comments

Roland McGrath June 27, 2014, 7:56 p.m. UTC | #1
OK
  

Patch

diff --git a/lib/mktime.c b/lib/mktime.c
index f10e530..a52933e 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -38,7 +38,7 @@ 
 
 #include <string.h>		/* For the real memcpy prototype.  */
 
-#if DEBUG
+#if defined DEBUG && 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
+#if defined DEBUG && DEBUG
 
 static int
 not_equal_tm (const struct tm *a, const struct tm *b)