genode/repos/libports/src/lib/stdcxx/include_next.patch

61 lines
2.1 KiB
Diff

include_next.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
---
include/bits/std_abs.h | 2 +-
include/c_global/cmath | 7 ++++++-
include/c_global/cstdlib | 7 ++++++-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/include/bits/std_abs.h b/include/bits/std_abs.h
index 6e4551d..65d50b5 100644
--- a/include/bits/std_abs.h
+++ b/include/bits/std_abs.h
@@ -35,7 +35,7 @@
#include <bits/c++config.h>
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
-#include_next <stdlib.h>
+#include <stdlib.h>
#ifdef __CORRECT_ISO_CPP_MATH_H_PROTO
# include_next <math.h>
#endif
diff --git a/include/c_global/cmath b/include/c_global/cmath
index 4489e17..83f4937 100644
--- a/include/c_global/cmath
+++ b/include/c_global/cmath
@@ -42,7 +42,12 @@
#include <bits/cpp_type_traits.h>
#include <ext/type_traits.h>
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
-#include_next <math.h>
+// On Genode, the libc include paths appear before the stdcxx include paths
+// and the original '#include_next' failed. Adding the libc include paths
+// to INC_DIR again did not help, because the duplication was detected
+// and ignored. So, math.h is included with '#include' again, like in
+// previous GCC versions.
+#include <math.h>
#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include <bits/std_abs.h>
diff --git a/include/c_global/cstdlib b/include/c_global/cstdlib
index 1033501..e39ed31 100644
--- a/include/c_global/cstdlib
+++ b/include/c_global/cstdlib
@@ -72,7 +72,12 @@ namespace std
// Need to ensure this finds the C library's <stdlib.h> not a libstdc++
// wrapper that might already be installed later in the include search path.
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
-#include_next <stdlib.h>
+// On Genode, the libc include paths appear before the stdcxx include paths
+// and the original '#include_next' failed. Adding the libc include paths
+// to INC_DIR again did not help, because the duplication was detected
+// and ignored. So, stdlib.h is included with '#include' again, like in
+// previous GCC versions.
+#include <stdlib.h>
#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include <bits/std_abs.h>