aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-03-21 01:09:41 -0400
committerJason Merrill <jason@gcc.gnu.org>2012-03-21 01:09:41 -0400
commit552b8185be26149ffcc8c879f4644d52aa1c85a8 (patch)
tree9106f53126560094c079914853af9d31398a04a7 /gcc/c-family
parentc19267cbaf0188acd862e628b72fb32e68d08d48 (diff)
downloadgcc-552b8185be26149ffcc8c879f4644d52aa1c85a8.zip
gcc-552b8185be26149ffcc8c879f4644d52aa1c85a8.tar.gz
gcc-552b8185be26149ffcc8c879f4644d52aa1c85a8.tar.bz2
c-common.h (enum cxx_dialect): Add cxx1y.
* 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
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog11
-rw-r--r--gcc/c-family/c-common.c4
-rw-r--r--gcc/c-family/c-common.h4
-rw-r--r--gcc/c-family/c-cppbuiltin.c2
-rw-r--r--gcc/c-family/c-opts.c23
-rw-r--r--gcc/c-family/c.opt8
6 files changed, 47 insertions, 5 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 1b586e5..350ee14 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -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
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index b83f45b..fc83b04 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -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);
}
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 835b13b..8552f0c 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -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. */
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 40a0a62..49804f9 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -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
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index f2a7971..0ee4390 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -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
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 1ec5504..f785b60 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -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)