mirror of
https://git.freebsd.org/ports.git
synced 2025-06-02 03:16:28 -04:00
gcc/system.h includes safe-ctype.h which redefines ctype macros such as toupper, tolower, etc to "poison" them. However, it should only include the safe-ctype.h header *after* any C++ headers, such as <list>, <map>, <string>, etc, otherwise these might transitively include internal ctype headers (such as with libc++ 17), causing compilation errors. PR: 274038 Reported by: dim
42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
--- gcc/system.h.orig 2021-07-28 06:55:07 UTC
|
|
+++ gcc/system.h
|
|
@@ -203,19 +203,6 @@ extern int fprintf_unlocked (FILE *, const char *, ...
|
|
#endif
|
|
#endif
|
|
|
|
-/* There are an extraordinary number of issues with <ctype.h>.
|
|
- The last straw is that it varies with the locale. Use libiberty's
|
|
- replacement instead. */
|
|
-#include "safe-ctype.h"
|
|
-
|
|
-#include <sys/types.h>
|
|
-
|
|
-#include <errno.h>
|
|
-
|
|
-#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
|
|
-extern int errno;
|
|
-#endif
|
|
-
|
|
#ifdef __cplusplus
|
|
#if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY)
|
|
# include <algorithm>
|
|
@@ -242,6 +229,19 @@ extern int errno;
|
|
# include <new>
|
|
# include <utility>
|
|
# include <type_traits>
|
|
+#endif
|
|
+
|
|
+/* There are an extraordinary number of issues with <ctype.h>.
|
|
+ The last straw is that it varies with the locale. Use libiberty's
|
|
+ replacement instead. */
|
|
+#include "safe-ctype.h"
|
|
+
|
|
+#include <sys/types.h>
|
|
+
|
|
+#include <errno.h>
|
|
+
|
|
+#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
|
|
+extern int errno;
|
|
#endif
|
|
|
|
/* Some of glibc's string inlines cause warnings. Plus we'd rather
|