diff mbox series

[RFA] libstdc++: fix C header include guards

Message ID 20240910040841.3680172-1-jason@redhat.com
State New
Headers show
Series [RFA] libstdc++: fix C header include guards | expand

Commit Message

Jason Merrill Sept. 10, 2024, 4:07 a.m. UTC
Tested x86_64-pc-linux-gnu, OK for trunk?

-- 8< --

Ever since the c_global and c_compatibility directories were added in
r122533, the include guards have been oddly late in the files, with no
comment about why that might be either in the commit message or the files
themselves.  I don't see any justification for this; it seems like a
scripting error in creating these files based on the ones in include/c.

libstdc++-v3/ChangeLog:

	* include/c_compatibility/ctype.h
	* include/c_compatibility/errno.h
	* include/c_compatibility/float.h
	* include/c_compatibility/iso646.h
	* include/c_compatibility/limits.h
	* include/c_compatibility/locale.h
	* include/c_compatibility/setjmp.h
	* include/c_compatibility/signal.h
	* include/c_compatibility/stdarg.h
	* include/c_compatibility/stdbool.h
	* include/c_compatibility/stddef.h
	* include/c_compatibility/stdio.h
	* include/c_compatibility/string.h
	* include/c_compatibility/tgmath.h
	* include/c_compatibility/time.h
	* include/c_compatibility/uchar.h
	* include/c_compatibility/wchar.h
	* include/c_compatibility/wctype.h
	* include/c_global/cctype
	* include/c_global/cerrno
	* include/c_global/cfloat
	* include/c_global/climits
	* include/c_global/clocale
	* include/c_global/cmath
	* include/c_global/csetjmp
	* include/c_global/csignal
	* include/c_global/cstdarg
	* include/c_global/cstdio
	* include/c_global/cstdlib
	* include/c_global/cstring
	* include/c_global/ctime
	* include/c_global/cwchar
	* include/c_global/cwctype: Move header guard before #includes.
---
 libstdc++-v3/include/c_compatibility/ctype.h   | 4 ++--
 libstdc++-v3/include/c_compatibility/errno.h   | 4 ++--
 libstdc++-v3/include/c_compatibility/float.h   | 4 ++--
 libstdc++-v3/include/c_compatibility/iso646.h  | 4 ++--
 libstdc++-v3/include/c_compatibility/limits.h  | 4 ++--
 libstdc++-v3/include/c_compatibility/locale.h  | 4 ++--
 libstdc++-v3/include/c_compatibility/setjmp.h  | 4 ++--
 libstdc++-v3/include/c_compatibility/signal.h  | 4 ++--
 libstdc++-v3/include/c_compatibility/stdarg.h  | 4 ++--
 libstdc++-v3/include/c_compatibility/stdbool.h | 6 +++---
 libstdc++-v3/include/c_compatibility/stddef.h  | 4 ++--
 libstdc++-v3/include/c_compatibility/stdio.h   | 4 ++--
 libstdc++-v3/include/c_compatibility/string.h  | 4 ++--
 libstdc++-v3/include/c_compatibility/tgmath.h  | 6 +++---
 libstdc++-v3/include/c_compatibility/time.h    | 4 ++--
 libstdc++-v3/include/c_compatibility/uchar.h   | 4 ++--
 libstdc++-v3/include/c_compatibility/wchar.h   | 4 ++--
 libstdc++-v3/include/c_compatibility/wctype.h  | 4 ++--
 libstdc++-v3/include/c_global/cctype           | 6 +++---
 libstdc++-v3/include/c_global/cerrno           | 6 +++---
 libstdc++-v3/include/c_global/cfloat           | 6 +++---
 libstdc++-v3/include/c_global/climits          | 6 +++---
 libstdc++-v3/include/c_global/clocale          | 6 +++---
 libstdc++-v3/include/c_global/cmath            | 6 +++---
 libstdc++-v3/include/c_global/csetjmp          | 6 +++---
 libstdc++-v3/include/c_global/csignal          | 6 +++---
 libstdc++-v3/include/c_global/cstdarg          | 6 +++---
 libstdc++-v3/include/c_global/cstdio           | 6 +++---
 libstdc++-v3/include/c_global/cstdlib          | 6 +++---
 libstdc++-v3/include/c_global/cstring          | 6 +++---
 libstdc++-v3/include/c_global/ctime            | 6 +++---
 libstdc++-v3/include/c_global/cwchar           | 6 +++---
 libstdc++-v3/include/c_global/cwctype          | 6 +++---
 33 files changed, 83 insertions(+), 83 deletions(-)


base-commit: 898e3e95a6acf542baf03be95ce5bf7b3ad04276
prerequisite-patch-id: b879726293513fcbc4b7df92bcc976404416b695

Comments

Jonathan Wakely Sept. 10, 2024, 10:12 a.m. UTC | #1
On Tue, 10 Sept 2024 at 05:10, Jason Merrill wrote:
>
> Tested x86_64-pc-linux-gnu, OK for trunk?

I'm going to have to do some digging ... I _think_ there's some
obscure reason for this. Maybe a weird bootstrap situation. Or maybe I
made that up as rationale for a scripting error.


>
> -- 8< --
>
> Ever since the c_global and c_compatibility directories were added in
> r122533, the include guards have been oddly late in the files, with no
> comment about why that might be either in the commit message or the files
> themselves.  I don't see any justification for this; it seems like a
> scripting error in creating these files based on the ones in include/c.
>
> libstdc++-v3/ChangeLog:
>
>         * include/c_compatibility/ctype.h
>         * include/c_compatibility/errno.h
>         * include/c_compatibility/float.h
>         * include/c_compatibility/iso646.h
>         * include/c_compatibility/limits.h
>         * include/c_compatibility/locale.h
>         * include/c_compatibility/setjmp.h
>         * include/c_compatibility/signal.h
>         * include/c_compatibility/stdarg.h
>         * include/c_compatibility/stdbool.h
>         * include/c_compatibility/stddef.h
>         * include/c_compatibility/stdio.h
>         * include/c_compatibility/string.h
>         * include/c_compatibility/tgmath.h
>         * include/c_compatibility/time.h
>         * include/c_compatibility/uchar.h
>         * include/c_compatibility/wchar.h
>         * include/c_compatibility/wctype.h
>         * include/c_global/cctype
>         * include/c_global/cerrno
>         * include/c_global/cfloat
>         * include/c_global/climits
>         * include/c_global/clocale
>         * include/c_global/cmath
>         * include/c_global/csetjmp
>         * include/c_global/csignal
>         * include/c_global/cstdarg
>         * include/c_global/cstdio
>         * include/c_global/cstdlib
>         * include/c_global/cstring
>         * include/c_global/ctime
>         * include/c_global/cwchar
>         * include/c_global/cwctype: Move header guard before #includes.
> ---
>  libstdc++-v3/include/c_compatibility/ctype.h   | 4 ++--
>  libstdc++-v3/include/c_compatibility/errno.h   | 4 ++--
>  libstdc++-v3/include/c_compatibility/float.h   | 4 ++--
>  libstdc++-v3/include/c_compatibility/iso646.h  | 4 ++--
>  libstdc++-v3/include/c_compatibility/limits.h  | 4 ++--
>  libstdc++-v3/include/c_compatibility/locale.h  | 4 ++--
>  libstdc++-v3/include/c_compatibility/setjmp.h  | 4 ++--
>  libstdc++-v3/include/c_compatibility/signal.h  | 4 ++--
>  libstdc++-v3/include/c_compatibility/stdarg.h  | 4 ++--
>  libstdc++-v3/include/c_compatibility/stdbool.h | 6 +++---
>  libstdc++-v3/include/c_compatibility/stddef.h  | 4 ++--
>  libstdc++-v3/include/c_compatibility/stdio.h   | 4 ++--
>  libstdc++-v3/include/c_compatibility/string.h  | 4 ++--
>  libstdc++-v3/include/c_compatibility/tgmath.h  | 6 +++---
>  libstdc++-v3/include/c_compatibility/time.h    | 4 ++--
>  libstdc++-v3/include/c_compatibility/uchar.h   | 4 ++--
>  libstdc++-v3/include/c_compatibility/wchar.h   | 4 ++--
>  libstdc++-v3/include/c_compatibility/wctype.h  | 4 ++--
>  libstdc++-v3/include/c_global/cctype           | 6 +++---
>  libstdc++-v3/include/c_global/cerrno           | 6 +++---
>  libstdc++-v3/include/c_global/cfloat           | 6 +++---
>  libstdc++-v3/include/c_global/climits          | 6 +++---
>  libstdc++-v3/include/c_global/clocale          | 6 +++---
>  libstdc++-v3/include/c_global/cmath            | 6 +++---
>  libstdc++-v3/include/c_global/csetjmp          | 6 +++---
>  libstdc++-v3/include/c_global/csignal          | 6 +++---
>  libstdc++-v3/include/c_global/cstdarg          | 6 +++---
>  libstdc++-v3/include/c_global/cstdio           | 6 +++---
>  libstdc++-v3/include/c_global/cstdlib          | 6 +++---
>  libstdc++-v3/include/c_global/cstring          | 6 +++---
>  libstdc++-v3/include/c_global/ctime            | 6 +++---
>  libstdc++-v3/include/c_global/cwchar           | 6 +++---
>  libstdc++-v3/include/c_global/cwctype          | 6 +++---
>  33 files changed, 83 insertions(+), 83 deletions(-)
>
> diff --git a/libstdc++-v3/include/c_compatibility/ctype.h b/libstdc++-v3/include/c_compatibility/ctype.h
> index 7b57a4d118a..d975dff1529 100644
> --- a/libstdc++-v3/include/c_compatibility/ctype.h
> +++ b/libstdc++-v3/include/c_compatibility/ctype.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <cctype>
> -
>  #ifndef _GLIBCXX_CTYPE_H
>  #define _GLIBCXX_CTYPE_H 1
>
> +#include <cctype>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>  using std::isalnum;
>  using std::isalpha;
> diff --git a/libstdc++-v3/include/c_compatibility/errno.h b/libstdc++-v3/include/c_compatibility/errno.h
> index 06a7e5e1ee4..402810456a5 100644
> --- a/libstdc++-v3/include/c_compatibility/errno.h
> +++ b/libstdc++-v3/include/c_compatibility/errno.h
> @@ -26,9 +26,9 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <cerrno>
> -
>  #ifndef _GLIBCXX_ERRNO_H
>  #define _GLIBCXX_ERRNO_H 1
>
> +#include <cerrno>
> +
>  #endif
> diff --git a/libstdc++-v3/include/c_compatibility/float.h b/libstdc++-v3/include/c_compatibility/float.h
> index 9d8f4b62276..3d3c994db51 100644
> --- a/libstdc++-v3/include/c_compatibility/float.h
> +++ b/libstdc++-v3/include/c_compatibility/float.h
> @@ -26,9 +26,9 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <cfloat>
> -
>  #ifndef _GLIBCXX_FLOAT_H
>  #define _GLIBCXX_FLOAT_H 1
>
> +#include <cfloat>
> +
>  #endif
> diff --git a/libstdc++-v3/include/c_compatibility/iso646.h b/libstdc++-v3/include/c_compatibility/iso646.h
> index cf95847a857..665166c7f03 100644
> --- a/libstdc++-v3/include/c_compatibility/iso646.h
> +++ b/libstdc++-v3/include/c_compatibility/iso646.h
> @@ -26,9 +26,9 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <ciso646>
> -
>  #ifndef _GLIBCXX_ISO646_H
>  #define _GLIBCXX_ISO646_H 1
>
> +#include <ciso646>
> +
>  #endif
> diff --git a/libstdc++-v3/include/c_compatibility/limits.h b/libstdc++-v3/include/c_compatibility/limits.h
> index 3c3cbd58eb1..465ad4f7d52 100644
> --- a/libstdc++-v3/include/c_compatibility/limits.h
> +++ b/libstdc++-v3/include/c_compatibility/limits.h
> @@ -26,9 +26,9 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <climits>
> -
>  #ifndef _GLIBCXX_LIMITS_H
>  #define _GLIBCXX_LIMITS_H 1
>
> +#include <climits>
> +
>  #endif
> diff --git a/libstdc++-v3/include/c_compatibility/locale.h b/libstdc++-v3/include/c_compatibility/locale.h
> index 91cf5e351aa..c7407ab5444 100644
> --- a/libstdc++-v3/include/c_compatibility/locale.h
> +++ b/libstdc++-v3/include/c_compatibility/locale.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <clocale>
> -
>  #ifndef _GLIBCXX_LOCALE_H
>  #define _GLIBCXX_LOCALE_H 1
>
> +#include <clocale>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>  using std::lconv;
>  using std::setlocale;
> diff --git a/libstdc++-v3/include/c_compatibility/setjmp.h b/libstdc++-v3/include/c_compatibility/setjmp.h
> index 4ffc9e60b90..7cf1e59bb8b 100644
> --- a/libstdc++-v3/include/c_compatibility/setjmp.h
> +++ b/libstdc++-v3/include/c_compatibility/setjmp.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <csetjmp>
> -
>  #ifndef _GLIBCXX_SETJMP_H
>  #define _GLIBCXX_SETJMP_H 1
>
> +#include <csetjmp>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>  using std::jmp_buf;
>  using std::longjmp;
> diff --git a/libstdc++-v3/include/c_compatibility/signal.h b/libstdc++-v3/include/c_compatibility/signal.h
> index e4d4fb2906b..9497985edb3 100644
> --- a/libstdc++-v3/include/c_compatibility/signal.h
> +++ b/libstdc++-v3/include/c_compatibility/signal.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <csignal>
> -
>  #ifndef _GLIBCXX_SIGNAL_H
>  #define _GLIBCXX_SIGNAL_H 1
>
> +#include <csignal>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>  using std::sig_atomic_t;
>  using std::raise;
> diff --git a/libstdc++-v3/include/c_compatibility/stdarg.h b/libstdc++-v3/include/c_compatibility/stdarg.h
> index 39033559cdb..b93037ef155 100644
> --- a/libstdc++-v3/include/c_compatibility/stdarg.h
> +++ b/libstdc++-v3/include/c_compatibility/stdarg.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <cstdarg>
> -
>  #ifndef _GLIBCXX_STDARG_H
>  #define _GLIBCXX_STDARG_H 1
>
> +#include <cstdarg>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>  using std::va_list;
>  #endif
> diff --git a/libstdc++-v3/include/c_compatibility/stdbool.h b/libstdc++-v3/include/c_compatibility/stdbool.h
> index 0ddf19a4884..1c7e70bad9a 100644
> --- a/libstdc++-v3/include/c_compatibility/stdbool.h
> +++ b/libstdc++-v3/include/c_compatibility/stdbool.h
> @@ -26,6 +26,9 @@
>   *  This is a Standard C++ Library header.
>   */
>
> +#ifndef _GLIBCXX_STDBOOL_H
> +#define _GLIBCXX_STDBOOL_H 1
> +
>  #include <bits/c++config.h>
>
>  #if __cplusplus >= 201103L
> @@ -36,7 +39,4 @@
>  # endif
>  #endif
>
> -#ifndef _GLIBCXX_STDBOOL_H
> -#define _GLIBCXX_STDBOOL_H 1
> -
>  #endif
> diff --git a/libstdc++-v3/include/c_compatibility/stddef.h b/libstdc++-v3/include/c_compatibility/stddef.h
> index e7478d2a919..ba4aaaea96e 100644
> --- a/libstdc++-v3/include/c_compatibility/stddef.h
> +++ b/libstdc++-v3/include/c_compatibility/stddef.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <cstddef>
> -
>  #ifndef _GLIBCXX_STDDEF_H
>  #define _GLIBCXX_STDDEF_H 1
>
> +#include <cstddef>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>  using std::size_t;
>  using std::ptrdiff_t;
> diff --git a/libstdc++-v3/include/c_compatibility/stdio.h b/libstdc++-v3/include/c_compatibility/stdio.h
> index 2980b143a8e..573ada2f148 100644
> --- a/libstdc++-v3/include/c_compatibility/stdio.h
> +++ b/libstdc++-v3/include/c_compatibility/stdio.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <cstdio>
> -
>  #ifndef _GLIBCXX_STDIO_H
>  #define _GLIBCXX_STDIO_H 1
>
> +#include <cstdio>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>  using std::FILE;
>  using std::fpos_t;
> diff --git a/libstdc++-v3/include/c_compatibility/string.h b/libstdc++-v3/include/c_compatibility/string.h
> index 0939f092424..5cb354b09f9 100644
> --- a/libstdc++-v3/include/c_compatibility/string.h
> +++ b/libstdc++-v3/include/c_compatibility/string.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <cstring>
> -
>  #ifndef _GLIBCXX_STRING_H
>  #define _GLIBCXX_STRING_H 1
>
> +#include <cstring>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>  using std::memcpy;
>  using std::memmove;
> diff --git a/libstdc++-v3/include/c_compatibility/tgmath.h b/libstdc++-v3/include/c_compatibility/tgmath.h
> index e3c264843e3..aadddd91b60 100644
> --- a/libstdc++-v3/include/c_compatibility/tgmath.h
> +++ b/libstdc++-v3/include/c_compatibility/tgmath.h
> @@ -26,6 +26,9 @@
>   *  This is a Standard C++ Library header.
>   */
>
> +#ifndef _GLIBCXX_TGMATH_H
> +#define _GLIBCXX_TGMATH_H 1
> +
>  #include <bits/c++config.h>
>
>  #if __cplusplus >= 201103L
> @@ -36,7 +39,4 @@
>  # endif
>  #endif
>
> -#ifndef _GLIBCXX_TGMATH_H
> -#define _GLIBCXX_TGMATH_H 1
> -
>  #endif
> diff --git a/libstdc++-v3/include/c_compatibility/time.h b/libstdc++-v3/include/c_compatibility/time.h
> index 4b2efab6ec7..a7afa626293 100644
> --- a/libstdc++-v3/include/c_compatibility/time.h
> +++ b/libstdc++-v3/include/c_compatibility/time.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <ctime>
> -
>  #ifndef _GLIBCXX_TIME_H
>  #define _GLIBCXX_TIME_H 1
>
> +#include <ctime>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>  // Get rid of those macros defined in <time.h> in lieu of real functions.
>  #undef clock
> diff --git a/libstdc++-v3/include/c_compatibility/uchar.h b/libstdc++-v3/include/c_compatibility/uchar.h
> index b3bbc901473..776380d3a5e 100644
> --- a/libstdc++-v3/include/c_compatibility/uchar.h
> +++ b/libstdc++-v3/include/c_compatibility/uchar.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <cuchar>
> -
>  #ifndef _GLIBCXX_UCHAR_H
>  #define _GLIBCXX_UCHAR_H 1
>
> +#include <cuchar>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>
>  #if (_GLIBCXX_USE_CHAR8_T \
> diff --git a/libstdc++-v3/include/c_compatibility/wchar.h b/libstdc++-v3/include/c_compatibility/wchar.h
> index 8dab7cb80a7..c618b1779c6 100644
> --- a/libstdc++-v3/include/c_compatibility/wchar.h
> +++ b/libstdc++-v3/include/c_compatibility/wchar.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <cwchar>
> -
>  #ifndef _GLIBCXX_WCHAR_H
>  #define _GLIBCXX_WCHAR_H 1
>
> +#include <cwchar>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>  using std::mbstate_t;
>
> diff --git a/libstdc++-v3/include/c_compatibility/wctype.h b/libstdc++-v3/include/c_compatibility/wctype.h
> index d0b24880c7f..834639d763b 100644
> --- a/libstdc++-v3/include/c_compatibility/wctype.h
> +++ b/libstdc++-v3/include/c_compatibility/wctype.h
> @@ -26,11 +26,11 @@
>   *  This is a Standard C++ Library header.
>   */
>
> -#include <cwctype>
> -
>  #ifndef _GLIBCXX_CWCTYPE_H
>  #define _GLIBCXX_CWCTYPE_H 1
>
> +#include <cwctype>
> +
>  #ifdef _GLIBCXX_NAMESPACE_C
>  using std::wctype_t;
>  using std::wctrans_t;
> diff --git a/libstdc++-v3/include/c_global/cctype b/libstdc++-v3/include/c_global/cctype
> index 925433a7d80..0c6d027ed24 100644
> --- a/libstdc++-v3/include/c_global/cctype
> +++ b/libstdc++-v3/include/c_global/cctype
> @@ -36,14 +36,14 @@
>  // ISO C++ 14882: <ccytpe>
>  //
>
> +#ifndef _GLIBCXX_CCTYPE
> +#define _GLIBCXX_CCTYPE 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
>  #include <ctype.h>
>
> -#ifndef _GLIBCXX_CCTYPE
> -#define _GLIBCXX_CCTYPE 1
> -
>  // Get rid of those macros defined in <ctype.h> in lieu of real functions.
>  #undef isalnum
>  #undef isalpha
> diff --git a/libstdc++-v3/include/c_global/cerrno b/libstdc++-v3/include/c_global/cerrno
> index 772d4bed8aa..5cad0795b27 100644
> --- a/libstdc++-v3/include/c_global/cerrno
> +++ b/libstdc++-v3/include/c_global/cerrno
> @@ -36,14 +36,14 @@
>  // ISO C++ 14882: 19.3  Error numbers
>  //
>
> +#ifndef _GLIBCXX_CERRNO
> +#define _GLIBCXX_CERRNO 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
>  #include <errno.h>
>
> -#ifndef _GLIBCXX_CERRNO
> -#define _GLIBCXX_CERRNO 1
> -
>  // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
>  #ifndef errno
>  #define errno errno
> diff --git a/libstdc++-v3/include/c_global/cfloat b/libstdc++-v3/include/c_global/cfloat
> index 38ff8309f19..bc90e75ba57 100644
> --- a/libstdc++-v3/include/c_global/cfloat
> +++ b/libstdc++-v3/include/c_global/cfloat
> @@ -36,14 +36,14 @@
>  // ISO C++ 14882: 18.2.2  Implementation properties: C library
>  //
>
> +#ifndef _GLIBCXX_CFLOAT
> +#define _GLIBCXX_CFLOAT 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
>  #include <float.h>
>
> -#ifndef _GLIBCXX_CFLOAT
> -#define _GLIBCXX_CFLOAT 1
> -
>  #if __cplusplus >= 201103L
>  #  ifndef DECIMAL_DIG
>  #    define DECIMAL_DIG __DECIMAL_DIG__
> diff --git a/libstdc++-v3/include/c_global/climits b/libstdc++-v3/include/c_global/climits
> index 7e374ef0c79..3fee65d36d2 100644
> --- a/libstdc++-v3/include/c_global/climits
> +++ b/libstdc++-v3/include/c_global/climits
> @@ -36,14 +36,14 @@
>  // ISO C++ 14882: 18.2.2  Implementation properties: C library
>  //
>
> +#ifndef _GLIBCXX_CLIMITS
> +#define _GLIBCXX_CLIMITS 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
>  #include <limits.h>
>
> -#ifndef _GLIBCXX_CLIMITS
> -#define _GLIBCXX_CLIMITS 1
> -
>  #ifndef LLONG_MIN
>  #define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
>  #endif
> diff --git a/libstdc++-v3/include/c_global/clocale b/libstdc++-v3/include/c_global/clocale
> index 74114455a66..b795f5759d1 100644
> --- a/libstdc++-v3/include/c_global/clocale
> +++ b/libstdc++-v3/include/c_global/clocale
> @@ -36,14 +36,14 @@
>  // ISO C++ 14882: 18.2.2  Implementation properties: C library
>  //
>
> +#ifndef _GLIBCXX_CLOCALE
> +#define _GLIBCXX_CLOCALE 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
>  #include <locale.h>
>
> -#ifndef _GLIBCXX_CLOCALE
> -#define _GLIBCXX_CLOCALE 1
> -
>  // Get rid of those macros defined in <locale.h> in lieu of real functions.
>  #undef setlocale
>  #undef localeconv
> diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
> index dd0174f1987..ea76f446652 100644
> --- a/libstdc++-v3/include/c_global/cmath
> +++ b/libstdc++-v3/include/c_global/cmath
> @@ -36,6 +36,9 @@
>  // ISO C++ 14882: 26.5  C library
>  //
>
> +#ifndef _GLIBCXX_CMATH
> +#define _GLIBCXX_CMATH 1
> +
>  #pragma GCC system_header
>
>  #include <bits/requires_hosted.h>
> @@ -48,9 +51,6 @@
>  #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
>  #include <bits/std_abs.h>
>
> -#ifndef _GLIBCXX_CMATH
> -#define _GLIBCXX_CMATH 1
> -
>  #define __glibcxx_want_hypot
>  #define __glibcxx_want_interpolate
>  #include <bits/version.h>
> diff --git a/libstdc++-v3/include/c_global/csetjmp b/libstdc++-v3/include/c_global/csetjmp
> index c378dfaa54c..6b1a484d539 100644
> --- a/libstdc++-v3/include/c_global/csetjmp
> +++ b/libstdc++-v3/include/c_global/csetjmp
> @@ -36,14 +36,14 @@
>  // ISO C++ 14882: 20.4.6  C library
>  //
>
> +#ifndef _GLIBCXX_CSETJMP
> +#define _GLIBCXX_CSETJMP 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
>  #include <setjmp.h>
>
> -#ifndef _GLIBCXX_CSETJMP
> -#define _GLIBCXX_CSETJMP 1
> -
>  // Get rid of those macros defined in <setjmp.h> in lieu of real functions.
>  #undef longjmp
>
> diff --git a/libstdc++-v3/include/c_global/csignal b/libstdc++-v3/include/c_global/csignal
> index 4a6f25e86ea..dc8a3e00b29 100644
> --- a/libstdc++-v3/include/c_global/csignal
> +++ b/libstdc++-v3/include/c_global/csignal
> @@ -36,14 +36,14 @@
>  // ISO C++ 14882: 20.4.6  C library
>  //
>
> +#ifndef _GLIBCXX_CSIGNAL
> +#define _GLIBCXX_CSIGNAL 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
>  #include <signal.h>
>
> -#ifndef _GLIBCXX_CSIGNAL
> -#define _GLIBCXX_CSIGNAL 1
> -
>  // Get rid of those macros defined in <signal.h> in lieu of real functions.
>  #undef raise
>
> diff --git a/libstdc++-v3/include/c_global/cstdarg b/libstdc++-v3/include/c_global/cstdarg
> index ed5e0509094..fd960c8ca4b 100644
> --- a/libstdc++-v3/include/c_global/cstdarg
> +++ b/libstdc++-v3/include/c_global/cstdarg
> @@ -36,15 +36,15 @@
>  // ISO C++ 14882: 20.4.6  C library
>  //
>
> +#ifndef _GLIBCXX_CSTDARG
> +#define _GLIBCXX_CSTDARG 1
> +
>  #pragma GCC system_header
>
>  #undef __need___va_list
>  #include <bits/c++config.h>
>  #include <stdarg.h>
>
> -#ifndef _GLIBCXX_CSTDARG
> -#define _GLIBCXX_CSTDARG 1
> -
>  // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
>  #ifndef va_end
>  #define va_end(ap) va_end (ap)
> diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio
> index 7674a4330c1..2b1f4fe78cd 100644
> --- a/libstdc++-v3/include/c_global/cstdio
> +++ b/libstdc++-v3/include/c_global/cstdio
> @@ -36,14 +36,14 @@
>  // ISO C++ 14882: 27.8.2  C Library files
>  //
>
> +#ifndef _GLIBCXX_CSTDIO
> +#define _GLIBCXX_CSTDIO 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
>  #include <stdio.h>
>
> -#ifndef _GLIBCXX_CSTDIO
> -#define _GLIBCXX_CSTDIO 1
> -
>  #if __cplusplus <= 201103L && !defined(_GLIBCXX_HAVE_GETS)
>  extern "C" char* gets (char* __s) __attribute__((__deprecated__));
>  #endif
> diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib
> index 69e7a39eb44..e210b23e588 100644
> --- a/libstdc++-v3/include/c_global/cstdlib
> +++ b/libstdc++-v3/include/c_global/cstdlib
> @@ -36,13 +36,13 @@
>  // ISO C++ 14882: 20.4.6  C library
>  //
>
> +#ifndef _GLIBCXX_CSTDLIB
> +#define _GLIBCXX_CSTDLIB 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
>
> -#ifndef _GLIBCXX_CSTDLIB
> -#define _GLIBCXX_CSTDLIB 1
> -
>  #if !_GLIBCXX_HOSTED
>  // The C standard does not require a freestanding implementation to
>  // provide <stdlib.h>.  However, the C++ standard does still require
> diff --git a/libstdc++-v3/include/c_global/cstring b/libstdc++-v3/include/c_global/cstring
> index 5ccc6cc686e..eba409fd613 100644
> --- a/libstdc++-v3/include/c_global/cstring
> +++ b/libstdc++-v3/include/c_global/cstring
> @@ -36,15 +36,15 @@
>  // ISO C++ 14882: 20.4.6  C library
>  //
>
> +#ifndef _GLIBCXX_CSTRING
> +#define _GLIBCXX_CSTRING 1
> +
>  #pragma GCC system_header
>
>  #define __glibcxx_want_freestanding_cstring
>  #include <bits/version.h>
>  #include <string.h>
>
> -#ifndef _GLIBCXX_CSTRING
> -#define _GLIBCXX_CSTRING 1
> -
>  // Get rid of those macros defined in <string.h> in lieu of real functions.
>  #undef memchr
>  #undef memcmp
> diff --git a/libstdc++-v3/include/c_global/ctime b/libstdc++-v3/include/c_global/ctime
> index cb6eb88959f..da16ba686db 100644
> --- a/libstdc++-v3/include/c_global/ctime
> +++ b/libstdc++-v3/include/c_global/ctime
> @@ -36,14 +36,14 @@
>  // ISO C++ 14882: 20.5  Date and time
>  //
>
> +#ifndef _GLIBCXX_CTIME
> +#define _GLIBCXX_CTIME 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
>  #include <time.h>
>
> -#ifndef _GLIBCXX_CTIME
> -#define _GLIBCXX_CTIME 1
> -
>  // Get rid of those macros defined in <time.h> in lieu of real functions.
>  #undef clock
>  #undef difftime
> diff --git a/libstdc++-v3/include/c_global/cwchar b/libstdc++-v3/include/c_global/cwchar
> index 325b3ac6bad..fabe178429f 100644
> --- a/libstdc++-v3/include/c_global/cwchar
> +++ b/libstdc++-v3/include/c_global/cwchar
> @@ -36,6 +36,9 @@
>  // ISO C++ 14882: 21.4
>  //
>
> +#ifndef _GLIBCXX_CWCHAR
> +#define _GLIBCXX_CWCHAR 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
> @@ -44,9 +47,6 @@
>  #include <wchar.h>
>  #endif
>
> -#ifndef _GLIBCXX_CWCHAR
> -#define _GLIBCXX_CWCHAR 1
> -
>  // Need to do a bit of trickery here with mbstate_t as char_traits
>  // assumes it is in wchar.h, regardless of wchar_t specializations.
>  #ifndef _GLIBCXX_HAVE_MBSTATE_T
> diff --git a/libstdc++-v3/include/c_global/cwctype b/libstdc++-v3/include/c_global/cwctype
> index 55c79d63cd2..54c8572426a 100644
> --- a/libstdc++-v3/include/c_global/cwctype
> +++ b/libstdc++-v3/include/c_global/cwctype
> @@ -36,6 +36,9 @@
>  // ISO C++ 14882: <cwctype>
>  //
>
> +#ifndef _GLIBCXX_CWCTYPE
> +#define _GLIBCXX_CWCTYPE 1
> +
>  #pragma GCC system_header
>
>  #include <bits/c++config.h>
> @@ -50,9 +53,6 @@
>  #include <wctype.h>
>  #endif // _GLIBCXX_HAVE_WCTYPE_H
>
> -#ifndef _GLIBCXX_CWCTYPE
> -#define _GLIBCXX_CWCTYPE 1
> -
>  // Get rid of those macros defined in <wctype.h> in lieu of real functions.
>  #undef iswalnum
>  #undef iswalpha
>
> base-commit: 898e3e95a6acf542baf03be95ce5bf7b3ad04276
> prerequisite-patch-id: b879726293513fcbc4b7df92bcc976404416b695
> --
> 2.46.0
>
Jonathan Wakely Sept. 11, 2024, 1:26 p.m. UTC | #2
On Tue, 10 Sept 2024 at 11:12, Jonathan Wakely wrote:
>
> On Tue, 10 Sept 2024 at 05:10, Jason Merrill wrote:
> >
> > Tested x86_64-pc-linux-gnu, OK for trunk?
>
> I'm going to have to do some digging ... I _think_ there's some
> obscure reason for this. Maybe a weird bootstrap situation. Or maybe I
> made that up as rationale for a scripting error.

I couldn't find (or remember) any reason for this, so please push and
hopefully if it breaks something we'll learn about it before GCC 15.1
diff mbox series

Patch

diff --git a/libstdc++-v3/include/c_compatibility/ctype.h b/libstdc++-v3/include/c_compatibility/ctype.h
index 7b57a4d118a..d975dff1529 100644
--- a/libstdc++-v3/include/c_compatibility/ctype.h
+++ b/libstdc++-v3/include/c_compatibility/ctype.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <cctype>
-
 #ifndef _GLIBCXX_CTYPE_H
 #define _GLIBCXX_CTYPE_H 1
 
+#include <cctype>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 using std::isalnum;
 using std::isalpha;
diff --git a/libstdc++-v3/include/c_compatibility/errno.h b/libstdc++-v3/include/c_compatibility/errno.h
index 06a7e5e1ee4..402810456a5 100644
--- a/libstdc++-v3/include/c_compatibility/errno.h
+++ b/libstdc++-v3/include/c_compatibility/errno.h
@@ -26,9 +26,9 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <cerrno>
-
 #ifndef _GLIBCXX_ERRNO_H
 #define _GLIBCXX_ERRNO_H 1
 
+#include <cerrno>
+
 #endif
diff --git a/libstdc++-v3/include/c_compatibility/float.h b/libstdc++-v3/include/c_compatibility/float.h
index 9d8f4b62276..3d3c994db51 100644
--- a/libstdc++-v3/include/c_compatibility/float.h
+++ b/libstdc++-v3/include/c_compatibility/float.h
@@ -26,9 +26,9 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <cfloat>
-
 #ifndef _GLIBCXX_FLOAT_H
 #define _GLIBCXX_FLOAT_H 1
 
+#include <cfloat>
+
 #endif
diff --git a/libstdc++-v3/include/c_compatibility/iso646.h b/libstdc++-v3/include/c_compatibility/iso646.h
index cf95847a857..665166c7f03 100644
--- a/libstdc++-v3/include/c_compatibility/iso646.h
+++ b/libstdc++-v3/include/c_compatibility/iso646.h
@@ -26,9 +26,9 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <ciso646>
-
 #ifndef _GLIBCXX_ISO646_H
 #define _GLIBCXX_ISO646_H 1
 
+#include <ciso646>
+
 #endif
diff --git a/libstdc++-v3/include/c_compatibility/limits.h b/libstdc++-v3/include/c_compatibility/limits.h
index 3c3cbd58eb1..465ad4f7d52 100644
--- a/libstdc++-v3/include/c_compatibility/limits.h
+++ b/libstdc++-v3/include/c_compatibility/limits.h
@@ -26,9 +26,9 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <climits>
-
 #ifndef _GLIBCXX_LIMITS_H
 #define _GLIBCXX_LIMITS_H 1
 
+#include <climits>
+
 #endif
diff --git a/libstdc++-v3/include/c_compatibility/locale.h b/libstdc++-v3/include/c_compatibility/locale.h
index 91cf5e351aa..c7407ab5444 100644
--- a/libstdc++-v3/include/c_compatibility/locale.h
+++ b/libstdc++-v3/include/c_compatibility/locale.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <clocale>
-
 #ifndef _GLIBCXX_LOCALE_H
 #define _GLIBCXX_LOCALE_H 1
 
+#include <clocale>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 using std::lconv;
 using std::setlocale;
diff --git a/libstdc++-v3/include/c_compatibility/setjmp.h b/libstdc++-v3/include/c_compatibility/setjmp.h
index 4ffc9e60b90..7cf1e59bb8b 100644
--- a/libstdc++-v3/include/c_compatibility/setjmp.h
+++ b/libstdc++-v3/include/c_compatibility/setjmp.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <csetjmp>
-
 #ifndef _GLIBCXX_SETJMP_H
 #define _GLIBCXX_SETJMP_H 1
 
+#include <csetjmp>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 using std::jmp_buf;
 using std::longjmp;
diff --git a/libstdc++-v3/include/c_compatibility/signal.h b/libstdc++-v3/include/c_compatibility/signal.h
index e4d4fb2906b..9497985edb3 100644
--- a/libstdc++-v3/include/c_compatibility/signal.h
+++ b/libstdc++-v3/include/c_compatibility/signal.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <csignal>
-
 #ifndef _GLIBCXX_SIGNAL_H
 #define _GLIBCXX_SIGNAL_H 1
 
+#include <csignal>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 using std::sig_atomic_t;
 using std::raise;
diff --git a/libstdc++-v3/include/c_compatibility/stdarg.h b/libstdc++-v3/include/c_compatibility/stdarg.h
index 39033559cdb..b93037ef155 100644
--- a/libstdc++-v3/include/c_compatibility/stdarg.h
+++ b/libstdc++-v3/include/c_compatibility/stdarg.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <cstdarg>
-
 #ifndef _GLIBCXX_STDARG_H
 #define _GLIBCXX_STDARG_H 1
 
+#include <cstdarg>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 using std::va_list;
 #endif
diff --git a/libstdc++-v3/include/c_compatibility/stdbool.h b/libstdc++-v3/include/c_compatibility/stdbool.h
index 0ddf19a4884..1c7e70bad9a 100644
--- a/libstdc++-v3/include/c_compatibility/stdbool.h
+++ b/libstdc++-v3/include/c_compatibility/stdbool.h
@@ -26,6 +26,9 @@ 
  *  This is a Standard C++ Library header.
  */
 
+#ifndef _GLIBCXX_STDBOOL_H
+#define _GLIBCXX_STDBOOL_H 1
+
 #include <bits/c++config.h>
 
 #if __cplusplus >= 201103L
@@ -36,7 +39,4 @@ 
 # endif
 #endif
 
-#ifndef _GLIBCXX_STDBOOL_H
-#define _GLIBCXX_STDBOOL_H 1
-
 #endif
diff --git a/libstdc++-v3/include/c_compatibility/stddef.h b/libstdc++-v3/include/c_compatibility/stddef.h
index e7478d2a919..ba4aaaea96e 100644
--- a/libstdc++-v3/include/c_compatibility/stddef.h
+++ b/libstdc++-v3/include/c_compatibility/stddef.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <cstddef>
-
 #ifndef _GLIBCXX_STDDEF_H
 #define _GLIBCXX_STDDEF_H 1
 
+#include <cstddef>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 using std::size_t;
 using std::ptrdiff_t;
diff --git a/libstdc++-v3/include/c_compatibility/stdio.h b/libstdc++-v3/include/c_compatibility/stdio.h
index 2980b143a8e..573ada2f148 100644
--- a/libstdc++-v3/include/c_compatibility/stdio.h
+++ b/libstdc++-v3/include/c_compatibility/stdio.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <cstdio>
-
 #ifndef _GLIBCXX_STDIO_H
 #define _GLIBCXX_STDIO_H 1
 
+#include <cstdio>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 using std::FILE;
 using std::fpos_t;
diff --git a/libstdc++-v3/include/c_compatibility/string.h b/libstdc++-v3/include/c_compatibility/string.h
index 0939f092424..5cb354b09f9 100644
--- a/libstdc++-v3/include/c_compatibility/string.h
+++ b/libstdc++-v3/include/c_compatibility/string.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <cstring>
-
 #ifndef _GLIBCXX_STRING_H
 #define _GLIBCXX_STRING_H 1
 
+#include <cstring>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 using std::memcpy;
 using std::memmove;
diff --git a/libstdc++-v3/include/c_compatibility/tgmath.h b/libstdc++-v3/include/c_compatibility/tgmath.h
index e3c264843e3..aadddd91b60 100644
--- a/libstdc++-v3/include/c_compatibility/tgmath.h
+++ b/libstdc++-v3/include/c_compatibility/tgmath.h
@@ -26,6 +26,9 @@ 
  *  This is a Standard C++ Library header.
  */
 
+#ifndef _GLIBCXX_TGMATH_H
+#define _GLIBCXX_TGMATH_H 1
+
 #include <bits/c++config.h>
 
 #if __cplusplus >= 201103L
@@ -36,7 +39,4 @@ 
 # endif
 #endif
 
-#ifndef _GLIBCXX_TGMATH_H
-#define _GLIBCXX_TGMATH_H 1
-
 #endif
diff --git a/libstdc++-v3/include/c_compatibility/time.h b/libstdc++-v3/include/c_compatibility/time.h
index 4b2efab6ec7..a7afa626293 100644
--- a/libstdc++-v3/include/c_compatibility/time.h
+++ b/libstdc++-v3/include/c_compatibility/time.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <ctime>
-
 #ifndef _GLIBCXX_TIME_H
 #define _GLIBCXX_TIME_H 1
 
+#include <ctime>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 // Get rid of those macros defined in <time.h> in lieu of real functions.
 #undef clock
diff --git a/libstdc++-v3/include/c_compatibility/uchar.h b/libstdc++-v3/include/c_compatibility/uchar.h
index b3bbc901473..776380d3a5e 100644
--- a/libstdc++-v3/include/c_compatibility/uchar.h
+++ b/libstdc++-v3/include/c_compatibility/uchar.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <cuchar>
-
 #ifndef _GLIBCXX_UCHAR_H
 #define _GLIBCXX_UCHAR_H 1
 
+#include <cuchar>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 
 #if (_GLIBCXX_USE_CHAR8_T \
diff --git a/libstdc++-v3/include/c_compatibility/wchar.h b/libstdc++-v3/include/c_compatibility/wchar.h
index 8dab7cb80a7..c618b1779c6 100644
--- a/libstdc++-v3/include/c_compatibility/wchar.h
+++ b/libstdc++-v3/include/c_compatibility/wchar.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <cwchar>
-
 #ifndef _GLIBCXX_WCHAR_H
 #define _GLIBCXX_WCHAR_H 1
 
+#include <cwchar>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 using std::mbstate_t;
 
diff --git a/libstdc++-v3/include/c_compatibility/wctype.h b/libstdc++-v3/include/c_compatibility/wctype.h
index d0b24880c7f..834639d763b 100644
--- a/libstdc++-v3/include/c_compatibility/wctype.h
+++ b/libstdc++-v3/include/c_compatibility/wctype.h
@@ -26,11 +26,11 @@ 
  *  This is a Standard C++ Library header.
  */
 
-#include <cwctype>
-
 #ifndef _GLIBCXX_CWCTYPE_H
 #define _GLIBCXX_CWCTYPE_H 1
 
+#include <cwctype>
+
 #ifdef _GLIBCXX_NAMESPACE_C
 using std::wctype_t;
 using std::wctrans_t;
diff --git a/libstdc++-v3/include/c_global/cctype b/libstdc++-v3/include/c_global/cctype
index 925433a7d80..0c6d027ed24 100644
--- a/libstdc++-v3/include/c_global/cctype
+++ b/libstdc++-v3/include/c_global/cctype
@@ -36,14 +36,14 @@ 
 // ISO C++ 14882: <ccytpe>
 //
 
+#ifndef _GLIBCXX_CCTYPE
+#define _GLIBCXX_CCTYPE 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
 #include <ctype.h>
 
-#ifndef _GLIBCXX_CCTYPE
-#define _GLIBCXX_CCTYPE 1
-
 // Get rid of those macros defined in <ctype.h> in lieu of real functions.
 #undef isalnum
 #undef isalpha
diff --git a/libstdc++-v3/include/c_global/cerrno b/libstdc++-v3/include/c_global/cerrno
index 772d4bed8aa..5cad0795b27 100644
--- a/libstdc++-v3/include/c_global/cerrno
+++ b/libstdc++-v3/include/c_global/cerrno
@@ -36,14 +36,14 @@ 
 // ISO C++ 14882: 19.3  Error numbers
 //
 
+#ifndef _GLIBCXX_CERRNO
+#define _GLIBCXX_CERRNO 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
 #include <errno.h>
 
-#ifndef _GLIBCXX_CERRNO
-#define _GLIBCXX_CERRNO 1
-
 // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
 #ifndef errno
 #define errno errno
diff --git a/libstdc++-v3/include/c_global/cfloat b/libstdc++-v3/include/c_global/cfloat
index 38ff8309f19..bc90e75ba57 100644
--- a/libstdc++-v3/include/c_global/cfloat
+++ b/libstdc++-v3/include/c_global/cfloat
@@ -36,14 +36,14 @@ 
 // ISO C++ 14882: 18.2.2  Implementation properties: C library
 //
 
+#ifndef _GLIBCXX_CFLOAT
+#define _GLIBCXX_CFLOAT 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
 #include <float.h>
 
-#ifndef _GLIBCXX_CFLOAT
-#define _GLIBCXX_CFLOAT 1
-
 #if __cplusplus >= 201103L
 #  ifndef DECIMAL_DIG
 #    define DECIMAL_DIG __DECIMAL_DIG__
diff --git a/libstdc++-v3/include/c_global/climits b/libstdc++-v3/include/c_global/climits
index 7e374ef0c79..3fee65d36d2 100644
--- a/libstdc++-v3/include/c_global/climits
+++ b/libstdc++-v3/include/c_global/climits
@@ -36,14 +36,14 @@ 
 // ISO C++ 14882: 18.2.2  Implementation properties: C library
 //
 
+#ifndef _GLIBCXX_CLIMITS
+#define _GLIBCXX_CLIMITS 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
 #include <limits.h>
 
-#ifndef _GLIBCXX_CLIMITS
-#define _GLIBCXX_CLIMITS 1
-
 #ifndef LLONG_MIN
 #define LLONG_MIN (-__LONG_LONG_MAX__ - 1)
 #endif
diff --git a/libstdc++-v3/include/c_global/clocale b/libstdc++-v3/include/c_global/clocale
index 74114455a66..b795f5759d1 100644
--- a/libstdc++-v3/include/c_global/clocale
+++ b/libstdc++-v3/include/c_global/clocale
@@ -36,14 +36,14 @@ 
 // ISO C++ 14882: 18.2.2  Implementation properties: C library
 //
 
+#ifndef _GLIBCXX_CLOCALE
+#define _GLIBCXX_CLOCALE 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
 #include <locale.h>
 
-#ifndef _GLIBCXX_CLOCALE
-#define _GLIBCXX_CLOCALE 1
-
 // Get rid of those macros defined in <locale.h> in lieu of real functions.
 #undef setlocale
 #undef localeconv
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index dd0174f1987..ea76f446652 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -36,6 +36,9 @@ 
 // ISO C++ 14882: 26.5  C library
 //
 
+#ifndef _GLIBCXX_CMATH
+#define _GLIBCXX_CMATH 1
+
 #pragma GCC system_header
 
 #include <bits/requires_hosted.h>
@@ -48,9 +51,6 @@ 
 #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
 #include <bits/std_abs.h>
 
-#ifndef _GLIBCXX_CMATH
-#define _GLIBCXX_CMATH 1
-
 #define __glibcxx_want_hypot
 #define __glibcxx_want_interpolate
 #include <bits/version.h>
diff --git a/libstdc++-v3/include/c_global/csetjmp b/libstdc++-v3/include/c_global/csetjmp
index c378dfaa54c..6b1a484d539 100644
--- a/libstdc++-v3/include/c_global/csetjmp
+++ b/libstdc++-v3/include/c_global/csetjmp
@@ -36,14 +36,14 @@ 
 // ISO C++ 14882: 20.4.6  C library
 //
 
+#ifndef _GLIBCXX_CSETJMP
+#define _GLIBCXX_CSETJMP 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
 #include <setjmp.h>
 
-#ifndef _GLIBCXX_CSETJMP
-#define _GLIBCXX_CSETJMP 1
-
 // Get rid of those macros defined in <setjmp.h> in lieu of real functions.
 #undef longjmp
 
diff --git a/libstdc++-v3/include/c_global/csignal b/libstdc++-v3/include/c_global/csignal
index 4a6f25e86ea..dc8a3e00b29 100644
--- a/libstdc++-v3/include/c_global/csignal
+++ b/libstdc++-v3/include/c_global/csignal
@@ -36,14 +36,14 @@ 
 // ISO C++ 14882: 20.4.6  C library
 //
 
+#ifndef _GLIBCXX_CSIGNAL
+#define _GLIBCXX_CSIGNAL 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
 #include <signal.h>
 
-#ifndef _GLIBCXX_CSIGNAL
-#define _GLIBCXX_CSIGNAL 1
-
 // Get rid of those macros defined in <signal.h> in lieu of real functions.
 #undef raise
 
diff --git a/libstdc++-v3/include/c_global/cstdarg b/libstdc++-v3/include/c_global/cstdarg
index ed5e0509094..fd960c8ca4b 100644
--- a/libstdc++-v3/include/c_global/cstdarg
+++ b/libstdc++-v3/include/c_global/cstdarg
@@ -36,15 +36,15 @@ 
 // ISO C++ 14882: 20.4.6  C library
 //
 
+#ifndef _GLIBCXX_CSTDARG
+#define _GLIBCXX_CSTDARG 1
+
 #pragma GCC system_header
 
 #undef __need___va_list
 #include <bits/c++config.h>
 #include <stdarg.h>
 
-#ifndef _GLIBCXX_CSTDARG
-#define _GLIBCXX_CSTDARG 1
-
 // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998
 #ifndef va_end
 #define va_end(ap) va_end (ap)
diff --git a/libstdc++-v3/include/c_global/cstdio b/libstdc++-v3/include/c_global/cstdio
index 7674a4330c1..2b1f4fe78cd 100644
--- a/libstdc++-v3/include/c_global/cstdio
+++ b/libstdc++-v3/include/c_global/cstdio
@@ -36,14 +36,14 @@ 
 // ISO C++ 14882: 27.8.2  C Library files
 //
 
+#ifndef _GLIBCXX_CSTDIO
+#define _GLIBCXX_CSTDIO 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
 #include <stdio.h>
 
-#ifndef _GLIBCXX_CSTDIO
-#define _GLIBCXX_CSTDIO 1
-
 #if __cplusplus <= 201103L && !defined(_GLIBCXX_HAVE_GETS)
 extern "C" char* gets (char* __s) __attribute__((__deprecated__));
 #endif
diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib
index 69e7a39eb44..e210b23e588 100644
--- a/libstdc++-v3/include/c_global/cstdlib
+++ b/libstdc++-v3/include/c_global/cstdlib
@@ -36,13 +36,13 @@ 
 // ISO C++ 14882: 20.4.6  C library
 //
 
+#ifndef _GLIBCXX_CSTDLIB
+#define _GLIBCXX_CSTDLIB 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
 
-#ifndef _GLIBCXX_CSTDLIB
-#define _GLIBCXX_CSTDLIB 1
-
 #if !_GLIBCXX_HOSTED
 // The C standard does not require a freestanding implementation to
 // provide <stdlib.h>.  However, the C++ standard does still require
diff --git a/libstdc++-v3/include/c_global/cstring b/libstdc++-v3/include/c_global/cstring
index 5ccc6cc686e..eba409fd613 100644
--- a/libstdc++-v3/include/c_global/cstring
+++ b/libstdc++-v3/include/c_global/cstring
@@ -36,15 +36,15 @@ 
 // ISO C++ 14882: 20.4.6  C library
 //
 
+#ifndef _GLIBCXX_CSTRING
+#define _GLIBCXX_CSTRING 1
+
 #pragma GCC system_header
 
 #define __glibcxx_want_freestanding_cstring
 #include <bits/version.h>
 #include <string.h>
 
-#ifndef _GLIBCXX_CSTRING
-#define _GLIBCXX_CSTRING 1
-
 // Get rid of those macros defined in <string.h> in lieu of real functions.
 #undef memchr
 #undef memcmp
diff --git a/libstdc++-v3/include/c_global/ctime b/libstdc++-v3/include/c_global/ctime
index cb6eb88959f..da16ba686db 100644
--- a/libstdc++-v3/include/c_global/ctime
+++ b/libstdc++-v3/include/c_global/ctime
@@ -36,14 +36,14 @@ 
 // ISO C++ 14882: 20.5  Date and time
 //
 
+#ifndef _GLIBCXX_CTIME
+#define _GLIBCXX_CTIME 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
 #include <time.h>
 
-#ifndef _GLIBCXX_CTIME
-#define _GLIBCXX_CTIME 1
-
 // Get rid of those macros defined in <time.h> in lieu of real functions.
 #undef clock
 #undef difftime
diff --git a/libstdc++-v3/include/c_global/cwchar b/libstdc++-v3/include/c_global/cwchar
index 325b3ac6bad..fabe178429f 100644
--- a/libstdc++-v3/include/c_global/cwchar
+++ b/libstdc++-v3/include/c_global/cwchar
@@ -36,6 +36,9 @@ 
 // ISO C++ 14882: 21.4
 //
 
+#ifndef _GLIBCXX_CWCHAR
+#define _GLIBCXX_CWCHAR 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
@@ -44,9 +47,6 @@ 
 #include <wchar.h>
 #endif
 
-#ifndef _GLIBCXX_CWCHAR
-#define _GLIBCXX_CWCHAR 1
-
 // Need to do a bit of trickery here with mbstate_t as char_traits
 // assumes it is in wchar.h, regardless of wchar_t specializations.
 #ifndef _GLIBCXX_HAVE_MBSTATE_T
diff --git a/libstdc++-v3/include/c_global/cwctype b/libstdc++-v3/include/c_global/cwctype
index 55c79d63cd2..54c8572426a 100644
--- a/libstdc++-v3/include/c_global/cwctype
+++ b/libstdc++-v3/include/c_global/cwctype
@@ -36,6 +36,9 @@ 
 // ISO C++ 14882: <cwctype>
 //
 
+#ifndef _GLIBCXX_CWCTYPE
+#define _GLIBCXX_CWCTYPE 1
+
 #pragma GCC system_header
 
 #include <bits/c++config.h>
@@ -50,9 +53,6 @@ 
 #include <wctype.h>
 #endif // _GLIBCXX_HAVE_WCTYPE_H
 
-#ifndef _GLIBCXX_CWCTYPE
-#define _GLIBCXX_CWCTYPE 1
-
 // Get rid of those macros defined in <wctype.h> in lieu of real functions.
 #undef iswalnum
 #undef iswalpha