https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97998

            Bug ID: 97998
           Summary: GCC should not complain about double definitions of
                    macros whose names begin with __STDC_
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zackw at panix dot com
  Target Milestone: ---

Normally, GCC does not warn about a second definition of a preprocessor macro
with the exact same expansion:

    #define some_ordinary_macro 1
    #define some_ordinary_macro 1   /* no diagnostic */

However, GCC 9 and 10 *do* complain about this kind of redefinition if the name
of the macro begins with __STDC_:

    #define __STDC_anything 1
    #define __STDC_anything 1     /* warning: "__STDC_anything" redefined */

In particular, it will complain about double definitions of the various
__STDC_WANT_*__ macros.  The upcoming autoconf 2.70 will start defining many of
those macros when the script uses AC_USE_SYSTEM_EXTENSIONS, and this broke code
in APR's configure script that included the internal 'confdefs.h' (which
accumulates the various #defines that will be emitted into config.h) a second
time (autoconf test programs always include confdefs.h before doing anything
else)

I think GCC should treat __STDC_ macros the same as ordinary macros - no
warning for a second definition with the same expansion.  N.B. clang already
behaves this way.

(If the second definition has a *different* expansion, GCC complains regardless
of the macro's name, and that behavior should not be changed.)

Reply via email to