From 83029d75705e029ba17494d4132e1c01294ce85e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 24 Jan 2021 16:48:42 -0800 Subject: =?UTF-8?q?packages/gcc/libstdc++:=20#include=5Fnext=20=E2=86=92?= =?UTF-8?q?=20#include?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of the installed libstdc++ header files use '#include_next' to work around toolchain oddities that might cause loops in the compiler. However, these also cause mistakes in locating header files when there are multiple C libraries installed as '#include_next' often ends up finding default C library header files. It doesn't seem like this patch could be accepted upstream; there's a long discussion about the use of include_next in these headers which I cannot fully understand. Signed-off-by: Keith Packard diff --git a/packages/gcc/10.3.0/0023-Remove-use-of-include_next-from-c-headers.patch b/packages/gcc/10.3.0/0023-Remove-use-of-include_next-from-c-headers.patch new file mode 100644 index 0000000..47584c2 --- /dev/null +++ b/packages/gcc/10.3.0/0023-Remove-use-of-include_next-from-c-headers.patch @@ -0,0 +1,307 @@ +From 4cea8f51c23ce7112f21ff4091e7d97272b81664 Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Sun, 24 Jan 2021 14:20:33 -0800 +Subject: [PATCH] Remove use of include_next from c++ headers + +Using include_next bypasses the default header search path and lets +files later in the include path take priority over earlier files. + +This makes replacing libc impossible as the default libc headers will +occur after the libstdc++ headers, and so be picked up in place of +headers inserted at the begining of the search path or appended to the +end of the search path. + +Using include_next is a hack to work-around broken combinations of +libraries, and is not necessary in a well constructed toolchain. + +Signed-off-by: Keith Packard +--- + libstdc++-v3/include/bits/std_abs.h | 4 ++-- + libstdc++-v3/include/c/cassert | 2 +- + libstdc++-v3/include/c/cctype | 2 +- + libstdc++-v3/include/c/cerrno | 2 +- + libstdc++-v3/include/c/cfloat | 2 +- + libstdc++-v3/include/c/climits | 2 +- + libstdc++-v3/include/c/clocale | 2 +- + libstdc++-v3/include/c/cmath | 2 +- + libstdc++-v3/include/c/csetjmp | 2 +- + libstdc++-v3/include/c/csignal | 2 +- + libstdc++-v3/include/c/cstdarg | 2 +- + libstdc++-v3/include/c/cstddef | 2 +- + libstdc++-v3/include/c/cstdio | 2 +- + libstdc++-v3/include/c/cstdlib | 2 +- + libstdc++-v3/include/c/cstring | 2 +- + libstdc++-v3/include/c/ctime | 2 +- + libstdc++-v3/include/c/cuchar | 2 +- + libstdc++-v3/include/c/cwchar | 2 +- + libstdc++-v3/include/c/cwctype | 2 +- + libstdc++-v3/include/c_global/cmath | 2 +- + libstdc++-v3/include/c_global/cstdlib | 2 +- + 21 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/libstdc++-v3/include/bits/std_abs.h b/libstdc++-v3/include/bits/std_abs.h +index ae6bfc1b1ac..249ed53a3ce 100644 +--- a/libstdc++-v3/include/bits/std_abs.h ++++ b/libstdc++-v3/include/bits/std_abs.h +@@ -35,9 +35,9 @@ + #include + + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #ifdef __CORRECT_ISO_CPP_MATH_H_PROTO +-# include_next ++# include + #endif + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + +diff --git a/libstdc++-v3/include/c/cassert b/libstdc++-v3/include/c/cassert +index abd8c0538ef..3e1b97f1626 100644 +--- a/libstdc++-v3/include/c/cassert ++++ b/libstdc++-v3/include/c/cassert +@@ -31,4 +31,4 @@ + #pragma GCC system_header + + #include +-#include_next ++#include +diff --git a/libstdc++-v3/include/c/cctype b/libstdc++-v3/include/c/cctype +index d53cb3d43f3..3def33f2077 100644 +--- a/libstdc++-v3/include/c/cctype ++++ b/libstdc++-v3/include/c/cctype +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cerrno b/libstdc++-v3/include/c/cerrno +index a8d3869efb6..3725137c115 100644 +--- a/libstdc++-v3/include/c/cerrno ++++ b/libstdc++-v3/include/c/cerrno +@@ -41,7 +41,7 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 + #ifndef errno +diff --git a/libstdc++-v3/include/c/cfloat b/libstdc++-v3/include/c/cfloat +index 5865d427c20..df821645e4d 100644 +--- a/libstdc++-v3/include/c/cfloat ++++ b/libstdc++-v3/include/c/cfloat +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/climits b/libstdc++-v3/include/c/climits +index 849afadeffc..b153fa8c27c 100644 +--- a/libstdc++-v3/include/c/climits ++++ b/libstdc++-v3/include/c/climits +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/clocale b/libstdc++-v3/include/c/clocale +index fc84745397d..5ebccdf5006 100644 +--- a/libstdc++-v3/include/c/clocale ++++ b/libstdc++-v3/include/c/clocale +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cmath b/libstdc++-v3/include/c/cmath +index 2c51f2f13bc..2fcd09e4ef9 100644 +--- a/libstdc++-v3/include/c/cmath ++++ b/libstdc++-v3/include/c/cmath +@@ -33,7 +33,7 @@ + + #include + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef abs +diff --git a/libstdc++-v3/include/c/csetjmp b/libstdc++-v3/include/c/csetjmp +index db83610d95f..5abafcb160d 100644 +--- a/libstdc++-v3/include/c/csetjmp ++++ b/libstdc++-v3/include/c/csetjmp +@@ -31,7 +31,7 @@ + + #pragma GCC system_header + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef longjmp +diff --git a/libstdc++-v3/include/c/csignal b/libstdc++-v3/include/c/csignal +index 986c5d3daca..77cb7634a69 100644 +--- a/libstdc++-v3/include/c/csignal ++++ b/libstdc++-v3/include/c/csignal +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstdarg b/libstdc++-v3/include/c/cstdarg +index 6b6e1850753..0dfc60cc6ba 100644 +--- a/libstdc++-v3/include/c/cstdarg ++++ b/libstdc++-v3/include/c/cstdarg +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #undef __need___va_list +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstddef b/libstdc++-v3/include/c/cstddef +index 7fc8ce34efc..fc90dfb3f18 100644 +--- a/libstdc++-v3/include/c/cstddef ++++ b/libstdc++-v3/include/c/cstddef +@@ -35,6 +35,6 @@ + #define __need_ptrdiff_t + #define __need_NULL + #define __need_offsetof +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstdio b/libstdc++-v3/include/c/cstdio +index e943aa8e725..89bcd2d7391 100644 +--- a/libstdc++-v3/include/c/cstdio ++++ b/libstdc++-v3/include/c/cstdio +@@ -31,7 +31,7 @@ + + #pragma GCC system_header + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef clearerr +diff --git a/libstdc++-v3/include/c/cstdlib b/libstdc++-v3/include/c/cstdlib +index 86d9587482f..a26013286be 100644 +--- a/libstdc++-v3/include/c/cstdlib ++++ b/libstdc++-v3/include/c/cstdlib +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstring b/libstdc++-v3/include/c/cstring +index 8b1e89b13b6..ca56c75e753 100644 +--- a/libstdc++-v3/include/c/cstring ++++ b/libstdc++-v3/include/c/cstring +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/ctime b/libstdc++-v3/include/c/ctime +index 367172b21eb..135da2a25c4 100644 +--- a/libstdc++-v3/include/c/ctime ++++ b/libstdc++-v3/include/c/ctime +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cuchar b/libstdc++-v3/include/c/cuchar +index e63b55ae12c..c79708fba6a 100644 +--- a/libstdc++-v3/include/c/cuchar ++++ b/libstdc++-v3/include/c/cuchar +@@ -39,7 +39,7 @@ + #include + + #if _GLIBCXX_USE_C11_UCHAR_CXX11 +-# include_next ++# include + #endif + + #endif // C++11 +diff --git a/libstdc++-v3/include/c/cwchar b/libstdc++-v3/include/c/cwchar +index 05d4d70c6fc..0fc9a9a394a 100644 +--- a/libstdc++-v3/include/c/cwchar ++++ b/libstdc++-v3/include/c/cwchar +@@ -36,7 +36,7 @@ + #include + + #if _GLIBCXX_HAVE_WCHAR_H +-#include_next ++#include + #endif + + // Need to do a bit of trickery here with mbstate_t as char_traits +diff --git a/libstdc++-v3/include/c/cwctype b/libstdc++-v3/include/c/cwctype +index 0626765d6c8..4839b693e46 100644 +--- a/libstdc++-v3/include/c/cwctype ++++ b/libstdc++-v3/include/c/cwctype +@@ -34,7 +34,7 @@ + #include + + #if _GLIBCXX_HAVE_WCTYPE_H +-#include_next ++#include + #endif + + #endif +diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath +index 39a6b036b8c..bfb6dcd4c88 100644 +--- a/libstdc++-v3/include/c_global/cmath ++++ b/libstdc++-v3/include/c_global/cmath +@@ -42,7 +42,7 @@ + #include + #include + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + #include + +diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib +index 47b954cf2fa..996a87b372c 100644 +--- a/libstdc++-v3/include/c_global/cstdlib ++++ b/libstdc++-v3/include/c_global/cstdlib +@@ -72,7 +72,7 @@ namespace std + // Need to ensure this finds the C library's not a libstdc++ + // wrapper that might already be installed later in the include search path. + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + #include + +-- +2.30.0 + diff --git a/packages/gcc/11.1.0/0009-Remove-use-of-include_next-from-c-headers.patch b/packages/gcc/11.1.0/0009-Remove-use-of-include_next-from-c-headers.patch new file mode 100644 index 0000000..a4e3215 --- /dev/null +++ b/packages/gcc/11.1.0/0009-Remove-use-of-include_next-from-c-headers.patch @@ -0,0 +1,307 @@ +From 9db1164d68ee1da7434af48db4f828d7df51b055 Mon Sep 17 00:00:00 2001 +From: Keith Packard +Date: Sun, 24 Jan 2021 14:20:33 -0800 +Subject: [PATCH] Remove use of include_next from c++ headers + +Using include_next bypasses the default header search path and lets +files later in the include path take priority over earlier files. + +This makes replacing libc impossible as the default libc headers will +occur after the libstdc++ headers, and so be picked up in place of +headers inserted at the begining of the search path or appended to the +end of the search path. + +Using include_next is a hack to work-around broken combinations of +libraries, and is not necessary in a well constructed toolchain. + +Signed-off-by: Keith Packard +--- + libstdc++-v3/include/bits/std_abs.h | 4 ++-- + libstdc++-v3/include/c/cassert | 2 +- + libstdc++-v3/include/c/cctype | 2 +- + libstdc++-v3/include/c/cerrno | 2 +- + libstdc++-v3/include/c/cfloat | 2 +- + libstdc++-v3/include/c/climits | 2 +- + libstdc++-v3/include/c/clocale | 2 +- + libstdc++-v3/include/c/cmath | 2 +- + libstdc++-v3/include/c/csetjmp | 2 +- + libstdc++-v3/include/c/csignal | 2 +- + libstdc++-v3/include/c/cstdarg | 2 +- + libstdc++-v3/include/c/cstddef | 2 +- + libstdc++-v3/include/c/cstdio | 2 +- + libstdc++-v3/include/c/cstdlib | 2 +- + libstdc++-v3/include/c/cstring | 2 +- + libstdc++-v3/include/c/ctime | 2 +- + libstdc++-v3/include/c/cuchar | 2 +- + libstdc++-v3/include/c/cwchar | 2 +- + libstdc++-v3/include/c/cwctype | 2 +- + libstdc++-v3/include/c_global/cmath | 2 +- + libstdc++-v3/include/c_global/cstdlib | 2 +- + 21 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/libstdc++-v3/include/bits/std_abs.h b/libstdc++-v3/include/bits/std_abs.h +index ae6bfc1b1ac..249ed53a3ce 100644 +--- a/libstdc++-v3/include/bits/std_abs.h ++++ b/libstdc++-v3/include/bits/std_abs.h +@@ -35,9 +35,9 @@ + #include + + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #ifdef __CORRECT_ISO_CPP_MATH_H_PROTO +-# include_next ++# include + #endif + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + +diff --git a/libstdc++-v3/include/c/cassert b/libstdc++-v3/include/c/cassert +index abd8c0538ef..3e1b97f1626 100644 +--- a/libstdc++-v3/include/c/cassert ++++ b/libstdc++-v3/include/c/cassert +@@ -31,4 +31,4 @@ + #pragma GCC system_header + + #include +-#include_next ++#include +diff --git a/libstdc++-v3/include/c/cctype b/libstdc++-v3/include/c/cctype +index d53cb3d43f3..3def33f2077 100644 +--- a/libstdc++-v3/include/c/cctype ++++ b/libstdc++-v3/include/c/cctype +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cerrno b/libstdc++-v3/include/c/cerrno +index a8d3869efb6..3725137c115 100644 +--- a/libstdc++-v3/include/c/cerrno ++++ b/libstdc++-v3/include/c/cerrno +@@ -41,7 +41,7 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 + #ifndef errno +diff --git a/libstdc++-v3/include/c/cfloat b/libstdc++-v3/include/c/cfloat +index 5865d427c20..df821645e4d 100644 +--- a/libstdc++-v3/include/c/cfloat ++++ b/libstdc++-v3/include/c/cfloat +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/climits b/libstdc++-v3/include/c/climits +index 849afadeffc..b153fa8c27c 100644 +--- a/libstdc++-v3/include/c/climits ++++ b/libstdc++-v3/include/c/climits +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #include +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/clocale b/libstdc++-v3/include/c/clocale +index fc84745397d..5ebccdf5006 100644 +--- a/libstdc++-v3/include/c/clocale ++++ b/libstdc++-v3/include/c/clocale +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cmath b/libstdc++-v3/include/c/cmath +index 2c51f2f13bc..2fcd09e4ef9 100644 +--- a/libstdc++-v3/include/c/cmath ++++ b/libstdc++-v3/include/c/cmath +@@ -33,7 +33,7 @@ + + #include + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef abs +diff --git a/libstdc++-v3/include/c/csetjmp b/libstdc++-v3/include/c/csetjmp +index db83610d95f..5abafcb160d 100644 +--- a/libstdc++-v3/include/c/csetjmp ++++ b/libstdc++-v3/include/c/csetjmp +@@ -31,7 +31,7 @@ + + #pragma GCC system_header + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef longjmp +diff --git a/libstdc++-v3/include/c/csignal b/libstdc++-v3/include/c/csignal +index 986c5d3daca..77cb7634a69 100644 +--- a/libstdc++-v3/include/c/csignal ++++ b/libstdc++-v3/include/c/csignal +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstdarg b/libstdc++-v3/include/c/cstdarg +index 6b6e1850753..0dfc60cc6ba 100644 +--- a/libstdc++-v3/include/c/cstdarg ++++ b/libstdc++-v3/include/c/cstdarg +@@ -32,6 +32,6 @@ + #pragma GCC system_header + + #undef __need___va_list +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstddef b/libstdc++-v3/include/c/cstddef +index 7fc8ce34efc..fc90dfb3f18 100644 +--- a/libstdc++-v3/include/c/cstddef ++++ b/libstdc++-v3/include/c/cstddef +@@ -35,6 +35,6 @@ + #define __need_ptrdiff_t + #define __need_NULL + #define __need_offsetof +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstdio b/libstdc++-v3/include/c/cstdio +index e943aa8e725..89bcd2d7391 100644 +--- a/libstdc++-v3/include/c/cstdio ++++ b/libstdc++-v3/include/c/cstdio +@@ -31,7 +31,7 @@ + + #pragma GCC system_header + +-#include_next ++#include + + // Get rid of those macros defined in in lieu of real functions. + #undef clearerr +diff --git a/libstdc++-v3/include/c/cstdlib b/libstdc++-v3/include/c/cstdlib +index 86d9587482f..a26013286be 100644 +--- a/libstdc++-v3/include/c/cstdlib ++++ b/libstdc++-v3/include/c/cstdlib +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cstring b/libstdc++-v3/include/c/cstring +index 8b1e89b13b6..ca56c75e753 100644 +--- a/libstdc++-v3/include/c/cstring ++++ b/libstdc++-v3/include/c/cstring +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/ctime b/libstdc++-v3/include/c/ctime +index 367172b21eb..135da2a25c4 100644 +--- a/libstdc++-v3/include/c/ctime ++++ b/libstdc++-v3/include/c/ctime +@@ -31,6 +31,6 @@ + + #pragma GCC system_header + +-#include_next ++#include + + #endif +diff --git a/libstdc++-v3/include/c/cuchar b/libstdc++-v3/include/c/cuchar +index e63b55ae12c..c79708fba6a 100644 +--- a/libstdc++-v3/include/c/cuchar ++++ b/libstdc++-v3/include/c/cuchar +@@ -39,7 +39,7 @@ + #include + + #if _GLIBCXX_USE_C11_UCHAR_CXX11 +-# include_next ++# include + #endif + + #endif // C++11 +diff --git a/libstdc++-v3/include/c/cwchar b/libstdc++-v3/include/c/cwchar +index 05d4d70c6fc..0fc9a9a394a 100644 +--- a/libstdc++-v3/include/c/cwchar ++++ b/libstdc++-v3/include/c/cwchar +@@ -36,7 +36,7 @@ + #include + + #if _GLIBCXX_HAVE_WCHAR_H +-#include_next ++#include + #endif + + // Need to do a bit of trickery here with mbstate_t as char_traits +diff --git a/libstdc++-v3/include/c/cwctype b/libstdc++-v3/include/c/cwctype +index 0626765d6c8..4839b693e46 100644 +--- a/libstdc++-v3/include/c/cwctype ++++ b/libstdc++-v3/include/c/cwctype +@@ -34,7 +34,7 @@ + #include + + #if _GLIBCXX_HAVE_WCTYPE_H +-#include_next ++#include + #endif + + #endif +diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath +index 39a6b036b8c..bfb6dcd4c88 100644 +--- a/libstdc++-v3/include/c_global/cmath ++++ b/libstdc++-v3/include/c_global/cmath +@@ -42,7 +42,7 @@ + #include + #include + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + #include + +diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib +index 47b954cf2fa..996a87b372c 100644 +--- a/libstdc++-v3/include/c_global/cstdlib ++++ b/libstdc++-v3/include/c_global/cstdlib +@@ -72,7 +72,7 @@ namespace std + // Need to ensure this finds the C library's not a libstdc++ + // wrapper that might already be installed later in the include search path. + #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS +-#include_next ++#include + #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS + #include + +-- +2.31.1 + -- cgit v0.10.2-6-g49f6