Re: error.c triggers -Wformat-extra-args

2014-06-26 Thread Paul Eggert

Daniel E. Macks wrote:

   if (file_name != NULL)
 fprintf (stderr, "%s:%d: ", file_name, line_number)
   else
 fprintf (stderr, " ");


Isn't that bigger and slower than the code it would replace?



Define DEBUG by default in mktime.c

2014-06-26 Thread Siddhesh Poyarekar
Hi,

The DEBUG macro in mktime.c is not defined, but the checks on that
macro are as if it is.  Instead of commenting out the definition of
DEBUG, define it to 0 by default and adjust the comment to reflect
that debugging needs the macro to be set to 1.

Siddhesh

* lib/mktime.c: Define DEBUG to 0.

diff --git a/lib/mktime.c b/lib/mktime.c
index f10e530..077f9c4 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -17,9 +17,9 @@
License along with the GNU C Library; if not, see
.  */
 
-/* Define this to have a standalone program to test this implementation of
+/* Define this to 1 to have a standalone program to test this implementation of
mktime.  */
-/* #define DEBUG 1 */
+#define DEBUG 0
 
 #ifndef _LIBC
 # include 


pgpHXdB2M3h5T.pgp
Description: PGP signature


Re: Define DEBUG by default in mktime.c

2014-06-26 Thread Eric Blake
On 06/26/2014 12:02 PM, Siddhesh Poyarekar wrote:
> Hi,
> 
> The DEBUG macro in mktime.c is not defined, but the checks on that
> macro are as if it is.  Instead of commenting out the definition of
> DEBUG, define it to 0 by default and adjust the comment to reflect
> that debugging needs the macro to be set to 1.
> 
> Siddhesh
> 
>   * lib/mktime.c: Define DEBUG to 0.
> 
> diff --git a/lib/mktime.c b/lib/mktime.c
> index f10e530..077f9c4 100644
> --- a/lib/mktime.c
> +++ b/lib/mktime.c
> @@ -17,9 +17,9 @@
> License along with the GNU C Library; if not, see
> .  */
>  
> -/* Define this to have a standalone program to test this implementation of
> +/* Define this to 1 to have a standalone program to test this implementation 
> of
> mktime.  */
> -/* #define DEBUG 1 */
> +#define DEBUG 0

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.

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature