aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo@gcc.gnu.org>2013-04-24 19:33:54 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2013-04-24 19:33:54 +0000
commit61949153f4972928c912cf1a93f5ef869e5c9484 (patch)
tree91930b32804dd6992b551ef2b873cca0c78f0181
parent5576178bbdd88f7e5a3ceb27c1de3d6bf4856de0 (diff)
downloadgcc-61949153f4972928c912cf1a93f5ef869e5c9484.zip
gcc-61949153f4972928c912cf1a93f5ef869e5c9484.tar.gz
gcc-61949153f4972928c912cf1a93f5ef869e5c9484.tar.bz2
cpplib.h (enum c_lang): Add CLK_GNUCXX1Y and CLK_CXX1Y.
/libcpp 2013-04-24 Paolo Carlini <paolo.carlini@oracle.com> * include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Y and CLK_CXX1Y. * init.c (lang_defaults): Add defaults for the latter. (cpp_init_builtins): Define __cplusplus as 201300L for the latter. * lex.c (_cpp_lex_direct): Update. /gcc/c-family 2013-04-24 Paolo Carlini <paolo.carlini@oracle.com> * c-opts.c (set_std_cxx11): Use CLK_CXX1Y and CLK_GNUCXX1Y. /gcc/testsuite 2013-04-24 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/cpp1y/cplusplus.C: New. From-SVN: r198261
-rw-r--r--gcc/c-family/ChangeLog4
-rw-r--r--gcc/c-family/c-opts.c2
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/cplusplus.C5
-rw-r--r--libcpp/ChangeLog9
-rw-r--r--libcpp/include/cpplib.h3
-rw-r--r--libcpp/init.c17
-rw-r--r--libcpp/lex.c4
8 files changed, 37 insertions, 11 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index b246b2b..39390db 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,5 +1,9 @@
2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
+ * c-opts.c (set_std_cxx11): Use CLK_CXX1Y and CLK_GNUCXX1Y.
+
+2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
+
* c-cppbuiltin.c (c_cpp_builtins): Do not define
__GXX_EXPERIMENTAL_CXX1Y__.
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 4b6990a..ea5a605 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -1471,7 +1471,7 @@ set_std_cxx11 (int iso)
static void
set_std_cxx1y (int iso)
{
- cpp_set_lang (parse_in, iso ? CLK_CXX11: CLK_GNUCXX11);
+ cpp_set_lang (parse_in, iso ? CLK_CXX1Y: CLK_GNUCXX1Y);
flag_no_gnu_keywords = iso;
flag_no_nonansi_builtin = iso;
flag_iso = iso;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b199baa..e3b4a56 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
+ * g++.dg/cpp1y/cplusplus.C: New.
+
+2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
+
* g++.dg/cpp1y/cxx1y_macro.C: Remove.
2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
diff --git a/gcc/testsuite/g++.dg/cpp1y/cplusplus.C b/gcc/testsuite/g++.dg/cpp1y/cplusplus.C
new file mode 100644
index 0000000..0b69593
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/cplusplus.C
@@ -0,0 +1,5 @@
+// { dg-options "-std=c++1y" }
+
+#if __cplusplus <= 201103L
+#error
+#endif
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 8ec815d..329f5e0 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,10 @@
+2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Y and CLK_CXX1Y.
+ * init.c (lang_defaults): Add defaults for the latter.
+ (cpp_init_builtins): Define __cplusplus as 201300L for the latter.
+ * lex.c (_cpp_lex_direct): Update.
+
2013-04-03 Sebastian Huber <sebastian.huber@embedded-brains.de>
PR target/56771
@@ -46,7 +53,7 @@
2013-02-13 Ed Smith-Rowland <3dw4rd@verizon.net>
PR c++/55582
- * libcpp/lex.c (lex_raw_string): Allow string literal with suffix
+ * lex.c (lex_raw_string): Allow string literal with suffix
beginning with 's' to be parsed as a C++11 user-defined literal.
2013-01-14 Richard Sandiford <rdsandiford@googlemail.com>
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index a48ac87..3084a11 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -165,7 +165,8 @@ enum cpp_ttype
/* C language kind, used when calling cpp_create_reader. */
enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_GNUC11,
CLK_STDC89, CLK_STDC94, CLK_STDC99, CLK_STDC11,
- CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11, CLK_ASM};
+ CLK_GNUCXX, CLK_CXX98, CLK_GNUCXX11, CLK_CXX11,
+ CLK_GNUCXX1Y, CLK_CXX1Y, CLK_ASM};
/* Payload of a NUMBER, STRING, CHAR or COMMENT token. */
struct GTY(()) cpp_string {
diff --git a/libcpp/init.c b/libcpp/init.c
index 3037ecd..c3fa4af 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -98,11 +98,13 @@ static const struct lang_flags lang_defaults[] =
/* CXX98 */ { 0, 1, 1, 0, 1, 1, 1, 0, 0, 0 },
/* GNUCXX11 */ { 1, 1, 1, 0, 0, 1, 1, 1, 1, 1 },
/* CXX11 */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 },
+ /* GNUCXX1Y */ { 1, 1, 1, 0, 0, 1, 1, 1, 1, 1 },
+ /* CXX1Y */ { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 },
/* ASM */ { 0, 0, 1, 0, 0, 1, 0, 0, 0, 0 }
- /* xid should be 1 for GNUC99, STDC99, GNUCXX, CXX98, GNUCXX11, and
- CXX11 when no longer experimental (when all uses of identifiers
- in the compiler have been audited for correct handling of
- extended identifiers). */
+ /* xid should be 1 for GNUC99, STDC99, GNUCXX, CXX98, GNUCXX11, CXX11,
+ GNUCXX1Y, and CXX1Y when no longer experimental (when all uses of
+ identifiers in the compiler have been audited for correct handling
+ of extended identifiers). */
};
/* Sets internal flags correctly for a given language. */
@@ -476,8 +478,11 @@ cpp_init_builtins (cpp_reader *pfile, int hosted)
if (CPP_OPTION (pfile, cplusplus))
{
- if (CPP_OPTION (pfile, lang) == CLK_CXX11
- || CPP_OPTION (pfile, lang) == CLK_GNUCXX11)
+ if (CPP_OPTION (pfile, lang) == CLK_CXX1Y
+ || CPP_OPTION (pfile, lang) == CLK_GNUCXX1Y)
+ _cpp_define_builtin (pfile, "__cplusplus 201300L");
+ else if (CPP_OPTION (pfile, lang) == CLK_CXX11
+ || CPP_OPTION (pfile, lang) == CLK_GNUCXX11)
_cpp_define_builtin (pfile, "__cplusplus 201103L");
else
_cpp_define_builtin (pfile, "__cplusplus 199711L");
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 570c007..3e59d40 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -2298,8 +2298,8 @@ _cpp_lex_direct (cpp_reader *pfile)
is neither : nor >, the < is treated as a preprocessor
token by itself". */
if (CPP_OPTION (pfile, cplusplus)
- && (CPP_OPTION (pfile, lang) == CLK_CXX11
- || CPP_OPTION (pfile, lang) == CLK_GNUCXX11)
+ && CPP_OPTION (pfile, lang) != CLK_CXX98
+ && CPP_OPTION (pfile, lang) != CLK_GNUCXX
&& buffer->cur[1] == ':'
&& buffer->cur[2] != ':' && buffer->cur[2] != '>')
break;