From babc47283189c5cae91cfe13fd20b0633145655c Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Mon, 21 Jun 2010 15:27:29 +0000 Subject: sol2.h (TARGET_OS_CPP_BUILTINS): Define __STDC_VERSION__=199901L, _XOPEN_SOURCE=600 for C++. gcc: * config/sol2.h (TARGET_OS_CPP_BUILTINS): Define __STDC_VERSION__=199901L, _XOPEN_SOURCE=600 for C++. fixincludes: * inclhack.def (solaris__restrict, solaris_complex_cxx): New fixes * fixincl.x: Regenerate. * tests/base/complex.h [SOLARIS_COMPLEX_CXX_CHECK]: New test. * tests/base/sys/feature_tests.h: New file. libstdc++-v3: * testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc: Add *-*-solaris2.1[0-9]* to dg-xfail-if, dg-excess-errors. From-SVN: r161089 --- fixincludes/inclhack.def | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'fixincludes/inclhack.def') diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 4f70a9f..16f36a1 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -3249,6 +3249,23 @@ fix = { /* + * Solaris 10+ defines _RESTRICT_KYWD as restrict + * for C99. This is wrong for C++, which needs many C99 features, but + * only supports __restrict. + */ +fix = { + hackname = solaris___restrict; + files = sys/feature_tests.h; + select = "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict"; + mach = "*-*-solaris2*"; + c_fix = format; + c_fix_arg = "#ifdef __cplusplus\n#define\t_RESTRICT_KYWD\t__restrict\n" + "#else\n%0\n#endif"; + test_text = "#define _RESTRICT_KYWD restrict"; +}; + + +/* * Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of * themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I * and imaginary definitions which are not supported by GCC. @@ -3273,6 +3290,23 @@ fix = { /* + * Solaris 10+ is wrapped in #ifndef __cplusplus. Wrap in + * extern "C" instead so libstdc++ can use it. + */ +fix = { + hackname = solaris_complex_cxx; + mach = "*-*-solaris2.*"; + files = complex.h; + sed = "/#if[ \t]*!defined(__cplusplus)/c" + "#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif"; + sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c" + "#ifdef\t__cplusplus\\\n}\\\n#endif"; + test_text = "#if !defined(__cplusplus)\n" + "#endif /* !defined(__cplusplus) */"; +}; + + +/* * Sun Solaris 10 defines several C99 math macros in terms of * builtins specific to the Studio compiler, in particular not * compatible with the GNU compiler. -- cgit v1.1