c-common.h (enum cxx_dialect): Add cxx1y.
authorJason Merrill <jason@redhat.com>
Wed, 21 Mar 2012 05:09:41 +0000 (01:09 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 21 Mar 2012 05:09:41 +0000 (01:09 -0400)
* c-common.h (enum cxx_dialect): Add cxx1y.
* c-common.c (c_common_nodes_and_builtins): Use >= for cxx_dialect
test.
* c-cppbuiltin.c (c_cpp_builtins): Likewise.
* c-opts.c (c_common_post_options): Likewise.
(set_std_cxx1y): New.
(c_common_handle_option): Call it.
* c.opt (-std=c++1y, -std=gnu++1y): New flags.
cp/
* lex.c (init_reswords): Use >= for cxx_dialect test.
* parser.c (cp_parser_exception_specification_opt): Likewise.
testsuite/
* lib/target-supports.exp: Add { target c++1y }.

From-SVN: r185596

12 files changed:
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c-family/c-common.h
gcc/c-family/c-cppbuiltin.c
gcc/c-family/c-opts.c
gcc/c-family/c.opt
gcc/cp/ChangeLog
gcc/cp/lex.c
gcc/cp/parser.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/lib/target-supports.exp

index 1b586e505b96db278abeeb8cd60fcff9623808e7..350ee14b90deff56f17e749ee9227c7078700588 100644 (file)
@@ -1,3 +1,14 @@
+2012-03-20  Jason Merrill  <jason@redhat.com>
+
+       * c-common.h (enum cxx_dialect): Add cxx1y.
+       * c-common.c (c_common_nodes_and_builtins): Use >= for cxx_dialect
+       test.
+       * c-cppbuiltin.c (c_cpp_builtins): Likewise.
+       * c-opts.c (c_common_post_options): Likewise.
+       (set_std_cxx1y): New.
+       (c_common_handle_option): Call it.
+       * c.opt (-std=c++1y, -std=gnu++1y): New flags.
+
 2012-03-19  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/14710
index b83f45b9d2c2a8c18406502cc9da316673e3f344..fc83b04c8a141ccb0320fb9d90795b0b43a290ac 100644 (file)
@@ -4940,7 +4940,7 @@ c_common_nodes_and_builtins (void)
     {
       char16_type_node = make_unsigned_type (char16_type_size);
 
-      if (cxx_dialect == cxx0x)
+      if (cxx_dialect >= cxx0x)
        record_builtin_type (RID_CHAR16, "char16_t", char16_type_node);
     }
 
@@ -4956,7 +4956,7 @@ c_common_nodes_and_builtins (void)
     {
       char32_type_node = make_unsigned_type (char32_type_size);
 
-      if (cxx_dialect == cxx0x)
+      if (cxx_dialect >= cxx0x)
        record_builtin_type (RID_CHAR32, "char32_t", char32_type_node);
     }
 
index 835b13bbce8bb1798df73de89ba4f861fd31cbae..8552f0c92e981bd391844ccf38da8b79b80ab56d 100644 (file)
@@ -649,7 +649,9 @@ enum cxx_dialect {
   cxx03 = cxx98,
   /* C++11  */
   cxx0x,
-  cxx11 = cxx0x
+  cxx11 = cxx0x,
+  /* C++1y (C++17?) */
+  cxx1y
 };
 
 /* The C++ dialect being used. C++98 is the default.  */
index 40a0a620dbfd9e6570c4b9744fdc20cf86bcde46..49804f98146075e02af4e7bdfc9515abda31fcab 100644 (file)
@@ -714,7 +714,7 @@ c_cpp_builtins (cpp_reader *pfile)
        cpp_define (pfile, "__DEPRECATED");
       if (flag_rtti)
        cpp_define (pfile, "__GXX_RTTI");
-      if (cxx_dialect == cxx0x)
+      if (cxx_dialect >= cxx0x)
         cpp_define (pfile, "__GXX_EXPERIMENTAL_CXX0X__");
     }
   /* Note that we define this for C as well, so that we know if
index f2a7971781d3f00f709d37ac7435277ce25891a5..0ee4390d5899d0bdeaf3032a9d3b6eeb407549df 100644 (file)
@@ -111,6 +111,7 @@ static size_t include_cursor;
 static void handle_OPT_d (const char *);
 static void set_std_cxx98 (int);
 static void set_std_cxx11 (int);
+static void set_std_cxx1y (int);
 static void set_std_c89 (int, int);
 static void set_std_c99 (int);
 static void set_std_c11 (int);
@@ -774,6 +775,12 @@ c_common_handle_option (size_t scode, const char *arg, int value,
        set_std_cxx11 (code == OPT_std_c__11 /* ISO */);
       break;
 
+    case OPT_std_c__1y:
+    case OPT_std_gnu__1y:
+      if (!preprocessing_asm_p)
+       set_std_cxx1y (code == OPT_std_c__11 /* ISO */);
+      break;
+
     case OPT_std_c90:
     case OPT_std_iso9899_199409:
       if (!preprocessing_asm_p)
@@ -990,7 +997,7 @@ c_common_post_options (const char **pfilename)
   if (warn_implicit_function_declaration == -1)
     warn_implicit_function_declaration = flag_isoc99;
 
-  if (cxx_dialect == cxx0x)
+  if (cxx_dialect >= cxx0x)
     {
       /* If we're allowing C++0x constructs, don't warn about C++98
         identifiers which are keywords in C++0x.  */
@@ -1522,6 +1529,20 @@ set_std_cxx11 (int iso)
   cxx_dialect = cxx11;
 }
 
+/* Set the C++ 201y draft standard (without GNU extensions if ISO).  */
+static void
+set_std_cxx1y (int iso)
+{
+  cpp_set_lang (parse_in, iso ? CLK_CXX11: CLK_GNUCXX11);
+  flag_no_gnu_keywords = iso;
+  flag_no_nonansi_builtin = iso;
+  flag_iso = iso;
+  /* C++11 includes the C99 standard library.  */
+  flag_isoc94 = 1;
+  flag_isoc99 = 1;
+  cxx_dialect = cxx1y;
+}
+
 /* Args to -d specify what to dump.  Silently ignore
    unrecognized options; they may be aimed at toplev.c.  */
 static void
index 1ec5504d5e477d8386d47e3e0b42fcdc2d182596..f785b6061558e65b18a9dbea3486132fa23882b4 100644 (file)
@@ -1215,6 +1215,10 @@ std=c++0x
 C++ ObjC++ Alias(std=c++11)
 Deprecated in favor of -std=c++11
 
+std=c++1y
+C++ ObjC++
+Conform to the ISO 201y(7?) C++ draft standard (experimental and incomplete support)
+
 std=c11
 C ObjC
 Conform to the ISO 2011 C standard (experimental and incomplete support)
@@ -1257,6 +1261,10 @@ std=gnu++0x
 C++ ObjC++ Alias(std=gnu++11)
 Deprecated in favor of -std=gnu++11
 
+std=gnu++1y
+C++ ObjC++
+Conform to the ISO 201y(7?) C++ draft standard with GNU extensions (experimental and incomplete support)
+
 std=gnu11
 C ObjC
 Conform to the ISO 2011 C standard with GNU extensions (experimental and incomplete support)
index 8dcc4462d04959165fc36a2b544c5991cda74652..370fd7abd638abc9b6ff28d6c7735ca639055359 100644 (file)
@@ -1,5 +1,8 @@
 2012-03-20  Jason Merrill  <jason@redhat.com>
 
+       * lex.c (init_reswords): Use >= for cxx_dialect test.
+       * parser.c (cp_parser_exception_specification_opt): Likewise.
+
        * mangle.c (write_type): Handle 'auto'.
        * init.c (build_new): Don't do auto deduction where it might
        affect template mangling.
index c11e3b315610ee67c15f58d9dbfc19e08cade7aa..a79448ea549650ef1a14c2ee56cdf15ab2a8fd72 100644 (file)
@@ -174,7 +174,7 @@ init_reswords (void)
   tree id;
   int mask = 0;
 
-  if (cxx_dialect != cxx0x)
+  if (cxx_dialect < cxx0x)
     mask |= D_CXX0X;
   if (flag_no_asm)
     mask |= D_ASM | D_EXT;
index b3c87a8047ddb3c96ffc352f07564f5d8d598293..75b7bdb046a34bb487aa3fdb8db134df5e6a21a3 100644 (file)
@@ -19594,7 +19594,7 @@ cp_parser_exception_specification_opt (cp_parser* parser)
 
 #if 0
   /* Enable this once a lot of code has transitioned to noexcept?  */
-  if (cxx_dialect == cxx0x && !in_system_header)
+  if (cxx_dialect >= cxx0x && !in_system_header)
     warning (OPT_Wdeprecated, "dynamic exception specifications are "
             "deprecated in C++0x; use %<noexcept%> instead");
 #endif
index c744cb961929f9b528f98eb6f4f7fdb6e7c35e9b..82f0d30ce6f5bc5b6e7be65f3e3e842dba0666e3 100644 (file)
@@ -1597,20 +1597,36 @@ GNU dialect of ISO C11.  Support is incomplete and experimental.  The
 name @samp{gnu1x} is deprecated.
 
 @item c++98
-The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
-C++ code.
+@itemx c++03
+The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
+additional defect reports. Same as @option{-ansi} for C++ code.
 
 @item gnu++98
+@itemx gnu++03
 GNU dialect of @option{-std=c++98}.  This is the default for
 C++ code.
 
 @item c++11
+@itemx c++0x
 The 2011 ISO C++ standard plus amendments.  Support for C++11 is still
 experimental, and may change in incompatible ways in future releases.
+The name @samp{c++0x} is deprecated.
 
 @item gnu++11
+@itemx gnu++0x
 GNU dialect of @option{-std=c++11}. Support for C++11 is still
 experimental, and may change in incompatible ways in future releases.
+The name @samp{gnu++0x} is deprecated.
+
+@item c++1y
+The next revision of the ISO C++ standard, tentatively planned for
+2017.  Support is highly experimental, and will almost certainly
+change in incompatible ways in future releases.
+
+@item gnu++1y
+GNU dialect of @option{-std=c++1y}.  Support is highly experimental,
+and will almost certainly change in incompatible ways in future
+releases.
 @end table
 
 @item -fgnu89-inline
index 71f1fe7ed773fd6af94a6352d9a21fe8757fcdfe..3501168e94db9436a43b20204b2d86fa4e43a64c 100644 (file)
@@ -1,5 +1,7 @@
 2012-03-20  Jason Merrill  <jason@redhat.com>
 
+       * lib/target-supports.exp: Add { target c++1y }.
+
        * g++.dg/cpp0x/auto32.C: New.
 
 2012-03-20  Georg-Johann Lay  <avr@gjlay.de>
index b9a6601c54d9b097358a8ea245c53b227b30f7c4..23b6ea9440690932de649d21ce0c8e4ed529c841 100644 (file)
@@ -4431,11 +4431,18 @@ proc check_effective_target_c++11 { } {
     return [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
 }
 
+proc check_effective_target_c++1y { } {
+    if ![check_effective_target_c++] {
+       return 0
+    }
+    return [check-flags { { } { } { -std=c++1y -std=gnu++1y } }]
+}
+
 proc check_effective_target_c++98 { } {
     if ![check_effective_target_c++] {
        return 0
     }
-    return [check-flags { { } { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
+    return [check-flags { { } { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 -std=c++1y -std=gnu++1y } }]
 }
 
 # Return 1 if expensive testcases should be run.