Require C11 for C++17 on Solaris
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Fri, 13 Jan 2017 12:11:00 +0000 (12:11 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Fri, 13 Jan 2017 12:11:00 +0000 (12:11 +0000)
* config/sol2.h (TARGET_OS_CPP_BUILTINS): Define __STDC_VERSION__
to 201112L since C++17.

From-SVN: r244430

gcc/ChangeLog
gcc/config/sol2.h

index 7aebebc..a941be7 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * config/sol2.h (TARGET_OS_CPP_BUILTINS): Define __STDC_VERSION__
+       to 201112L since C++17.
+
 2017-01-13  Maxim Ostapenko  <m.ostapenko@samsung.com>
 
        PR sanitizer/78887
index 93fe084..1ae7f9f 100644 (file)
@@ -82,26 +82,41 @@ along with GCC; see the file COPYING3.  If not see
 /* Names to predefine in the preprocessor for this target machine.  */
 #define TARGET_SUB_OS_CPP_BUILTINS()
 #define TARGET_OS_CPP_BUILTINS()                       \
-    do {                                               \
-       builtin_define_std ("unix");                    \
-       builtin_define_std ("sun");                     \
-       builtin_define ("__svr4__");                    \
-       builtin_define ("__SVR4");                      \
-       builtin_assert ("system=unix");                 \
-       builtin_assert ("system=svr4");                 \
-       /* For C++ we need to add some additional macro \
-          definitions required by the C++ standard     \
-          library.  */                                 \
-       if (c_dialect_cxx ())                           \
+  do {                                                 \
+    builtin_define_std ("unix");                       \
+    builtin_define_std ("sun");                                \
+    builtin_define ("__svr4__");                       \
+    builtin_define ("__SVR4");                         \
+    builtin_assert ("system=unix");                    \
+    builtin_assert ("system=svr4");                    \
+    /* For C++ we need to add some additional macro    \
+       definitions required by the C++ standard                \
+       library.  */                                    \
+    if (c_dialect_cxx ())                              \
+      {                                                        \
+       switch (cxx_dialect)                            \
          {                                             \
+         case cxx98:                                   \
+         case cxx11:                                   \
+         case cxx14:                                   \
+           /* C++11 and C++14 are based on C99.        \
+              libstdc++ makes use of C99 features      \
+              even for C++98.  */                      \
            builtin_define ("__STDC_VERSION__=199901L");\
-           builtin_define ("_XOPEN_SOURCE=600");       \
-           builtin_define ("_LARGEFILE_SOURCE=1");     \
-           builtin_define ("_LARGEFILE64_SOURCE=1");   \
-           builtin_define ("__EXTENSIONS__");          \
+           break;                                      \
+                                                       \
+         default:                                      \
+           /* C++17 is based on C11.  */               \
+           builtin_define ("__STDC_VERSION__=201112L");\
+           break;                                      \
          }                                             \
-       TARGET_SUB_OS_CPP_BUILTINS();                   \
-    } while (0)
+       builtin_define ("_XOPEN_SOURCE=600");           \
+       builtin_define ("_LARGEFILE_SOURCE=1");         \
+       builtin_define ("_LARGEFILE64_SOURCE=1");       \
+       builtin_define ("__EXTENSIONS__");              \
+      }                                                        \
+    TARGET_SUB_OS_CPP_BUILTINS();                      \
+  } while (0)
 
 #define SUBTARGET_OVERRIDE_OPTIONS                     \
   do {                                                 \