Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lang/gcc10 lang/gcc11 lang/gcc11-devel lang/gcc12 lang/gcc12-devel la…
…ng/gcc13 lang/gcc13-devel lang/gcc14-devel: fix build with libc++ 17 When building relatively recent gcc ports (with C++ in them) against libc++ 17, you get errors similar to: In file included from /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/cp/module.cc:208: In file included from /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/system.h:239: In file included from /usr/include/c++/v1/vector:321: In file included from /usr/include/c++/v1/__format/formatter_bool.h:20: In file included from /usr/include/c++/v1/__format/formatter_integral.h:32: In file included from /usr/include/c++/v1/locale:202: /usr/include/c++/v1/__locale:546:5: error: '__abi_tag__' attribute only applies to structs, variables, functions, and namespaces 546 | _LIBCPP_INLINE_VISIBILITY | ^ /usr/include/c++/v1/__config:813:37: note: expanded from macro '_LIBCPP_INLINE_VISIBILITY' 813 | # define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI | ^ /usr/include/c++/v1/__config:792:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI' 792 | __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_VERSIONED_IDENTIFIER)))) | ^ In file included from /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/cp/module.cc:208: In file included from /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/system.h:239: In file included from /usr/include/c++/v1/vector:321: In file included from /usr/include/c++/v1/__format/formatter_bool.h:20: In file included from /usr/include/c++/v1/__format/formatter_integral.h:32: In file included from /usr/include/c++/v1/locale:202: /usr/include/c++/v1/__locale:547:37: error: expected ';' at end of declaration list 547 | char_type toupper(char_type __c) const | ^ /usr/include/c++/v1/__locale:553:48: error: too many arguments provided to function-like macro invocation 553 | const char_type* toupper(char_type* __low, const char_type* __high) const | ^ /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/gcc/../include/safe-ctype.h:146:9: note: macro 'toupper' defined here 146 | #define toupper(c) do_not_use_toupper_with_safe_ctype | ^ This is because 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 the above conflicts. Fix it by moving the safe-ctype.h inclusion to later in gcc/system.h, which solves this issue, and makes it possible to build against libc++ 17. See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111632 PR: 274041 Approved by: salvadore (maintainer) MFH: 2023Q4
- Loading branch information
1 parent
641e12a
commit b7833e7
Showing
8 changed files
with
336 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- gcc/system.h.orig 2022-06-28 08:54:28 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> | ||
@@ -235,6 +222,19 @@ extern int errno; | ||
# include <cstring> | ||
# include <new> | ||
# include <utility> | ||
+#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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- gcc/system.h.orig 2023-09-14 22:32:14 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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- gcc/system.h.orig 2022-04-21 07:58:53 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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- gcc/system.h.orig 2023-09-15 22:32:10 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> | ||
@@ -243,6 +230,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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- gcc/system.h.orig 2022-08-19 08:09:53 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> | ||
@@ -243,6 +230,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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- gcc/system.h.orig 2023-09-16 22:32:44 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> | ||
@@ -243,6 +230,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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- gcc/system.h.orig 2023-04-26 07:09:40 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> | ||
@@ -243,6 +230,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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- gcc/system.h.orig 2023-09-17 22:32:37 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> | ||
@@ -243,6 +230,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 |