Last active
September 4, 2025 08:40
-
-
Save skull-squadron/b7919373b21c1d809fff3b03dcdafeb6 to your computer and use it in GitHub Desktop.
gcc11-clang17 fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libcc1/libcc1plugin.cc b/libcc1/libcc1plugin.cc | |
index e80ecd8f4b35..e58fa55c0f58 100644 | |
--- a/libcc1/libcc1plugin.cc | |
+++ b/libcc1/libcc1plugin.cc | |
@@ -31,6 +31,8 @@ | |
#undef PACKAGE_TARNAME | |
#undef PACKAGE_VERSION | |
+#define INCLUDE_MEMORY | |
+#define INCLUDE_VECTOR | |
#include "gcc-plugin.h" | |
#include "system.h" | |
#include "coretypes.h" | |
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc | |
index 27a6175e34e6..378c65d43c25 100644 | |
--- a/libcc1/libcp1plugin.cc | |
+++ b/libcc1/libcp1plugin.cc | |
@@ -32,6 +32,8 @@ | |
#undef PACKAGE_TARNAME | |
#undef PACKAGE_VERSION | |
+#define INCLUDE_MEMORY | |
+#define INCLUDE_VECTOR | |
#include "gcc-plugin.h" | |
#include "system.h" | |
#include "coretypes.h" | |
diff --git a/gcc/system.h b/gcc/system.h | |
index e10c34f70eca..38733dd81a6e 100644 | |
--- a/gcc/system.h | |
+++ b/gcc/system.h | |
@@ -194,27 +194,8 @@ extern int fprintf_unlocked (FILE *, const char *, ...); | |
#undef fread_unlocked | |
#undef fwrite_unlocked | |
-/* Include <string> before "safe-ctype.h" to avoid GCC poisoning | |
- the ctype macros through safe-ctype.h */ | |
- | |
-#ifdef __cplusplus | |
-#ifdef INCLUDE_STRING | |
-# include <string> | |
-#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 | |
+/* Include C++ standard headers before "safe-ctype.h" to avoid GCC | |
+ poisoning the ctype macros through safe-ctype.h */ | |
#ifdef __cplusplus | |
#if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) | |
@@ -229,6 +210,9 @@ extern int errno; | |
#ifdef INCLUDE_SET | |
# include <set> | |
#endif | |
+#ifdef INCLUDE_STRING | |
+# include <string> | |
+#endif | |
#ifdef INCLUDE_VECTOR | |
# include <vector> | |
#endif | |
@@ -245,6 +229,19 @@ extern int errno; | |
# 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 | |
rely on (and therefore test) GCC's string builtins. */ | |
#define __NO_STRING_INLINES |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment