Hi Eric, > Right now, './gnulib-tool --with-tests --test xstrtol' issues this warning > when > run on cygwin 1.5.24: > > gcc -DHAVE_CONFIG_H -I. -I../../gltests -I. -I../../gltests -I.. > -I../../gltests/.. -I../gllib -I../../gltests/../gllib -g -O2 -MT > test-wchar.o -MD -MP -MF .deps/test-wchar.Tpo -c -o test-wchar.o > ../../gltests/test-wchar.c > In file included from ../../gltests/test-wchar.c:20: > ./config.h:155:1: warning: "__STDC_LIMIT_MACROS_TRIGGER" redefined > In file included from ./config.h:4, > from ../../gltests/test-wchar.c:20: > ./../config.h:147:1: warning: this is the location of the previous definition
Interesting: The warning goes away when the macro is renamed so that it does not start with "__". The appended patch fixes it. > And while both files contain similar #defines (for example, both > did #define HAVE_DECL_IMAXABS 1), it is only the dual listing of > __STDC_LIMIT_MACROS_TRIGGER that caused gcc 3.4.4 to warn, even though both > definitions were to the same value. Indeed, gcc seems to treat __ prefixed macros differently than those in the user's namespace. > Something weird is going on; gnulib-tool created the testdir in such a manner > that both build/config.h and build/gltests/config.h, with the latter > #including > the former. ... > Is there any reason why gnulib-tool uses AH_TOP([#include "../config.h"]) for > gltests/configure.ac? There are comments about this in gnulib-tool. > Could this be reworked to have the tests dir share the > same config.h as the rest of the project, rather than having two files with > duplicate definitions? This would not be good. It would have the consequence that "gnulib-tool --create-testdir $modules" could fail to build on some platform although "gnulib-tool --create-testdir --with-tests $modules" would build fine on the same platform. (This could happen if the module description of a module lacks a dependency, and its tests bring in the needed dependency.) This would mean that testing with --with-tests could overlook some failures - which is against the primary goal of --with-tests. Bruno 2007-08-07 Bruno Haible <[EMAIL PROTECTED]> * m4/inttypes.m4 (gl_INTTYPES_H): Use GL_TRIGGER_STDC_LIMIT_MACROS instead of __STDC_LIMIT_MACROS_TRIGGER. This avoids a redefinition warning from gcc. Reported by Eric Blake. --- m4/inttypes.m4 2 Jul 2007 23:28:02 -0000 1.20 +++ m4/inttypes.m4 7 Aug 2007 22:22:00 -0000 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 10 +# inttypes.m4 serial 11 dnl Copyright (C) 2006-2007 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -150,12 +150,12 @@ dnl Also be careful to define __STDC_LIMIT_MACROS only when gnulib's dnl <inttypes.h> is going to be created, and to avoid redefinition warnings dnl if the __STDC_LIMIT_MACROS is already defined through the CPPFLAGS. - AC_DEFINE([__STDC_LIMIT_MACROS_TRIGGER], 1, + AC_DEFINE([GL_TRIGGER_STDC_LIMIT_MACROS], 1, [Define to make the limit macros in <stdint.h> visible.]) AH_VERBATIM([__STDC_LIMIT_MACROS_ZZZ], [/* Ensure that <stdint.h> defines the limit macros, since gnulib's <inttypes.h> relies on them. */ -#if defined __cplusplus && !defined __STDC_LIMIT_MACROS && __STDC_LIMIT_MACROS_TRIGGER +#if defined __cplusplus && !defined __STDC_LIMIT_MACROS && GL_TRIGGER_STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS 1 #endif ])