* [patch] libstdc++/69581 Don't define guard macros when doing #include_next in math.h and stdlib.h
@ 2016-02-01 11:24 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2016-02-01 11:24 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 361 bytes --]
The new <math.h> and <stdlib.h> wrapper headers should not define
their guard macros when being included in "pass-through" mode, i.e.
when _GLIBCXX_INCLUDE_NEXT_C_HEADERS is defined. This patch allows the
wrapper to pass-through as many layers of wrapper headers as needed
until the real C library header is found.
Tested powerpc64-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1929 bytes --]
commit c501dcd83400039b74f79f338580f25e148556ac
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Feb 1 10:53:35 2016 +0000
Don't define guard macros when doing #include_next in math.h and stdlib.h
2016-02-01 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR libstdc++/69581
* include/c_compatibility/math.h: Move header guards.
* include/c_compatibility/stdlib.h: Likewise.
diff --git a/libstdc++-v3/include/c_compatibility/math.h b/libstdc++-v3/include/c_compatibility/math.h
index 243e631..1f579ee 100644
--- a/libstdc++-v3/include/c_compatibility/math.h
+++ b/libstdc++-v3/include/c_compatibility/math.h
@@ -26,13 +26,13 @@
* This is a Standard C++ Library header.
*/
+#if !defined __cplusplus || defined _GLIBCXX_INCLUDE_NEXT_C_HEADERS
+# include_next <math.h>
+#else
#ifndef _GLIBCXX_MATH_H
#define _GLIBCXX_MATH_H 1
-#if !defined __cplusplus || defined _GLIBCXX_INCLUDE_NEXT_C_HEADERS
-# include_next <math.h>
-#else
# include <cmath>
using std::abs;
@@ -177,7 +177,5 @@ using std::sph_neumannl;
using std::sph_neumann;
#endif // __STDCPP_WANT_MATH_SPEC_FUNCS__
-#endif // __cplusplus
-
#endif // _GLIBCXX_MATH_H
-
+#endif // __cplusplus
diff --git a/libstdc++-v3/include/c_compatibility/stdlib.h b/libstdc++-v3/include/c_compatibility/stdlib.h
index 31e7e5f..747ad76 100644
--- a/libstdc++-v3/include/c_compatibility/stdlib.h
+++ b/libstdc++-v3/include/c_compatibility/stdlib.h
@@ -26,12 +26,13 @@
* This is a Standard C++ Library header.
*/
-#ifndef _GLIBCXX_STDLIB_H
-#define _GLIBCXX_STDLIB_H 1
-
#if !defined __cplusplus || defined _GLIBCXX_INCLUDE_NEXT_C_HEADERS
# include_next <stdlib.h>
#else
+
+#ifndef _GLIBCXX_STDLIB_H
+#define _GLIBCXX_STDLIB_H 1
+
# include <cstdlib>
using std::abort;
@@ -81,5 +82,5 @@ using std::wctomb;
#endif // _GLIBCXX_USE_WCHAR_T
#endif
-#endif
-#endif
+#endif // _GLIBCXX_STDLIB_H
+#endif // __cplusplus
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-02-01 11:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01 11:24 [patch] libstdc++/69581 Don't define guard macros when doing #include_next in math.h and stdlib.h Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).