aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-11-30 09:50:52 +0100
committerJakub Jelinek <jakub@redhat.com>2021-11-30 09:50:52 +0100
commit7abcc9ca20d4e17deabb308b5f483aaccc3dc02c (patch)
treec21e63f7f6d56c10092fca7fbf157987f2c5ac43
parent2af2f55a500adad73451f3b859cfaa8974920caf (diff)
downloadgcc-7abcc9ca20d4e17deabb308b5f483aaccc3dc02c.zip
gcc-7abcc9ca20d4e17deabb308b5f483aaccc3dc02c.tar.gz
gcc-7abcc9ca20d4e17deabb308b5f483aaccc3dc02c.tar.bz2
libcpp: Enable P1949R7 for C++11 and up as it was a DR [PR100977]
Jonathan mentioned on IRC that: "Accept P1949R7 (C++ Identifier Syntax using Unicode Standard Annex 31) as a Defect Report and apply the changes therein to the C++ working paper." while I've actually implemented it only for -std={gnu,c}++{23,2b}. As the C++98 rules were significantly different, I'm not trying to change anything for C++98. 2021-11-30 Jakub Jelinek <jakub@redhat.com> PR c++/100977 * init.c (lang_defaults): Enable cxx23_identifiers for -std={gnu,c}++{11,14,17,20} too. * c-c++-common/cpp/ucnid-2011-1-utf8.c: Expect errors in C++. * c-c++-common/cpp/ucnid-2011-1.c: Likewise. * g++.dg/cpp/ucnid-4-utf8.C: Add missing space to dg-options. * g++.dg/cpp23/normalize3.C: Enable for c++11 rather than just c++23. * g++.dg/cpp23/normalize4.C: Likewise. * g++.dg/cpp23/normalize5.C: Likewise. * g++.dg/cpp23/normalize7.C: Expect errors rather than just warnings for c++11 and up rather than just c++23. * g++.dg/cpp23/ucnid-2-utf8.C: Expect errors even for c++11 .. c++20.
-rw-r--r--gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c6
-rw-r--r--gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c6
-rw-r--r--gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp23/normalize3.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp23/normalize4.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp23/normalize5.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp23/normalize7.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C14
-rw-r--r--libcpp/init.c16
9 files changed, 27 insertions, 29 deletions
diff --git a/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c b/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c
index 02c5fc0..970d53e 100644
--- a/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c
+++ b/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c
@@ -2,7 +2,7 @@
/* { dg-options "-std=c11 -pedantic" { target c } } */
/* { dg-options "-std=c++11 -pedantic" { target c++ } } */
+¨ /* { dg-error "is not valid in an identifier" "" { target c++ } } */
@@ -11,5 +11,5 @@ B̀
À /* { dg-warning "not in NFC" } */
𐀀
-🿽
-󡈴
+🿽 /* { dg-error "is not valid in an identifier" "" { target c++ } } */
+󡈴 /* { dg-error "is not valid in an identifier" "" { target c++ } } */
diff --git a/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c b/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c
index b7ebce8..6babb40 100644
--- a/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c
+++ b/gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c
@@ -2,7 +2,7 @@
/* { dg-options "-std=c11 -pedantic" { target c } } */
/* { dg-options "-std=c++11 -pedantic" { target c++ } } */
-\u00A8
+\u00A8 /* { dg-error "is not valid in an identifier" "" { target c++ } } */
B\u0300
@@ -11,5 +11,5 @@ B\u0300
A\u0300 /* { dg-warning "not in NFC" } */
\U00010000
-\U0001FFFD
-\U000E1234
+\U0001FFFD /* { dg-error "is not valid in an identifier" "" { target c++ } } */
+\U000E1234 /* { dg-error "is not valid in an identifier" "" { target c++ } } */
diff --git a/gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C b/gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C
index de252e8..1e5e3fc 100644
--- a/gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C
+++ b/gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C
@@ -1,5 +1,5 @@
/* { dg-do preprocess } */
-/* { dg-options "-std=gnu++98"} */
+/* { dg-options "-std=gnu++98" } */
ª
« /* { dg-error "not valid in an identifier" } */
diff --git a/gcc/testsuite/g++.dg/cpp23/normalize3.C b/gcc/testsuite/g++.dg/cpp23/normalize3.C
index bf4bb3a..1733d38 100644
--- a/gcc/testsuite/g++.dg/cpp23/normalize3.C
+++ b/gcc/testsuite/g++.dg/cpp23/normalize3.C
@@ -1,4 +1,4 @@
-// { dg-do preprocess { target { c++23 } } }
+// { dg-do preprocess { target { c++11 } } }
// { dg-options "-pedantic-errors" }
\u00AA
diff --git a/gcc/testsuite/g++.dg/cpp23/normalize4.C b/gcc/testsuite/g++.dg/cpp23/normalize4.C
index 9f83cd7..48e7231 100644
--- a/gcc/testsuite/g++.dg/cpp23/normalize4.C
+++ b/gcc/testsuite/g++.dg/cpp23/normalize4.C
@@ -1,4 +1,4 @@
-// { dg-do preprocess { target { c++23 } } }
+// { dg-do preprocess { target { c++11 } } }
// { dg-options "" }
\u00AA
diff --git a/gcc/testsuite/g++.dg/cpp23/normalize5.C b/gcc/testsuite/g++.dg/cpp23/normalize5.C
index afe339a..cbeb134 100644
--- a/gcc/testsuite/g++.dg/cpp23/normalize5.C
+++ b/gcc/testsuite/g++.dg/cpp23/normalize5.C
@@ -1,4 +1,4 @@
-// { dg-do preprocess { target { c++23 } } }
+// { dg-do preprocess { target { c++11 } } }
// { dg-options "-pedantic-errors" }
\u00AA
diff --git a/gcc/testsuite/g++.dg/cpp23/normalize7.C b/gcc/testsuite/g++.dg/cpp23/normalize7.C
index f639d65..a1c0a2f 100644
--- a/gcc/testsuite/g++.dg/cpp23/normalize7.C
+++ b/gcc/testsuite/g++.dg/cpp23/normalize7.C
@@ -3,10 +3,8 @@
// { dg-options "-pedantic-errors" }
constexpr int À = 1; // U+00C0
-constexpr int À = 2; // U+0041 U+0300 { dg-warning "is not in NFC" "" { target { ! c++23 } } }
-// { dg-error "is not in NFC" "" { target c++23 } .-1 }
+constexpr int À = 2; // U+0041 U+0300 { dg-error "is not in NFC" }
constexpr int gv1 = \u00c0;
-constexpr int gv2 = A\u0300; // { dg-warning "is not in NFC" "" { target { ! c++23 } } }
-// { dg-error "is not in NFC" "" { target c++23 } .-1 }
+constexpr int gv2 = A\u0300; // { dg-error "is not in NFC" }
static_assert(gv1 == 1, "");
static_assert(gv2 == 2, "");
diff --git a/gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C b/gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C
index 6c8aa6a..712785c 100644
--- a/gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C
+++ b/gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C
@@ -2,17 +2,17 @@
// { dg-do compile }
// { dg-options "-pedantic-errors" }
-bool 👷 = true; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+bool 👷 = true; // { dg-error "is not valid in an identifier" }
bool 👷‍♀ = false; // { dg-error "is not valid in an identifier" }
int ⏰ = 0; // { dg-error "is not valid in an identifier" }
-int 🕐 = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+int 🕐 = 0; // { dg-error "is not valid in an identifier" }
int ☠ = 0; // { dg-error "is not valid in an identifier" }
-int 💀 = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+int 💀 = 0; // { dg-error "is not valid in an identifier" }
int ✋ = 0; // { dg-error "is not valid in an identifier" }
-int 👊 = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+int 👊 = 0; // { dg-error "is not valid in an identifier" }
int ✈ = 0; // { dg-error "is not valid in an identifier" }
-int 🚀 = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+int 🚀 = 0; // { dg-error "is not valid in an identifier" }
int ☹ = 0; // { dg-error "is not valid in an identifier" }
-int 😀 = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+int 😀 = 0; // { dg-error "is not valid in an identifier" }
struct E {};
-class 💩 : public E {}; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } }
+class 💩 : public E {}; // { dg-error "is not valid in an identifier" }
diff --git a/libcpp/init.c b/libcpp/init.c
index f9a8f5f..78719ab 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -114,14 +114,14 @@ static const struct lang_flags lang_defaults[] =
/* STDC2X */ { 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1 },
/* GNUCXX */ { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
/* CXX98 */ { 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0 },
- /* GNUCXX11 */ { 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
- /* CXX11 */ { 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0 },
- /* GNUCXX14 */ { 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0 },
- /* CXX14 */ { 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0 },
- /* GNUCXX17 */ { 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0 },
- /* CXX17 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0 },
- /* GNU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