GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ginclude

ginclude: Avoid Redefining __STDC_VERSION_LIMITS_H__

The compiler now avoids redefining the `__STDC_VERSION_LIMITS_H__` macro, preventing warnings when including system headers.

The compiler now avoids redefining the __STDC_VERSION_LIMITS_H__ macro in glimits.h if it is already defined by the system’s limits.h header. This prevents warnings (specifically, -Wsystem-headers) when compiling code that includes limits.h, especially with newer glibc versions. This improves user experience by reducing spurious warnings during compilation.

In Details

The glimits.h header in GCC was defining __STDC_VERSION_LIMITS_H__ unconditionally, leading to redefinition warnings when the system's limits.h (e.g., from glibc-2.43) already defined it. The fix now uses an ifndef guard to avoid the redefinition.

For Context

When compiling C code, the compiler includes various header files that define standard constants and functions. This commit addresses an issue where the compiler was redefining a macro already defined by a system header file, leading to unnecessary warnings during compilation. The fix ensures that the macro is only defined if it hasn't been defined already.

Filed Under: gincludemacrowarningheaders