https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64883

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #6)
> Perhaps unconditionally or conditionally for Darwin only include some C
> header or headers before defining those macros, then include the STL headers?

Yes, something like this:

--- a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
@@ -18,6 +18,19 @@
 // { dg-options "-std=gnu++98" }
 // { dg-do compile }

+#ifdef __APPLE__
+// darwin headers use noreturn and deprecated, PR 64883
+#include <assert.h>
+#include <math.h>
+#include <setjmp.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#endif
+
+// gthr-single.h uses unused, PR 64885
+#include <bits/gthr.h>
+
 // Ensure the library only uses the __name__ form for attributes.
 // Don't test 'const' because it is reserved anyway.
 #define abi_tag 1


But it's a bit fragile, as the list of C headers might vary between darwin
versions. This would be more reliable, and we still test that libstdc++ doesn't
use those names on all other targets:

--- a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc
@@ -18,12 +18,18 @@
 // { dg-options "-std=gnu++98" }
 // { dg-do compile }

+// gthr-single.h uses unused, see PR 64885
+#include <bits/gthr.h>
+
 // Ensure the library only uses the __name__ form for attributes.
 // Don't test 'const' because it is reserved anyway.
 #define abi_tag 1
 #define always_inline 1
-#define deprecated 1
-#define noreturn 1
+#ifndef __APPLE__
+// darwin headers use these, see PR 64883
+# define deprecated 1
+# define noreturn 1
+#endif
 #define packed 1
 #define pure 1
 #define unused 1

Reply via email to