]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libcpp: Enable P1949R7 for C++11 and up as it was a DR [PR100977]
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 Nov 2021 08:50:52 +0000 (09:50 +0100)
committerJakub Jelinek <jakub@redhat.com>
Tue, 30 Nov 2021 08:50:52 +0000 (09:50 +0100)
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.

gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c
gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c
gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C
gcc/testsuite/g++.dg/cpp23/normalize3.C
gcc/testsuite/g++.dg/cpp23/normalize4.C
gcc/testsuite/g++.dg/cpp23/normalize5.C
gcc/testsuite/g++.dg/cpp23/normalize7.C
gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C
libcpp/init.c

index 02c5fc08f8452344d11aa17a7ed9e53718ca5d77..970d53ecd55c39aa73576f84ef7ed54f82e34a8b 100644 (file)
@@ -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++ } } */
 
 B̀
 
@@ -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++ } } */
index b7ebce8ea60b6cb46702b4201f5880201f183578..6babb4069b7dbfefea62ce2bc6ceedc8f86c967a 100644 (file)
@@ -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++ } } */
index de252e87165da541a0cd197248b96dc408ed2162..1e5e3fc99db62b1ab9a9b57dcc36b043f32409d5 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do preprocess } */
-/* { dg-options "-std=gnu++98"} */
+/* { dg-options "-std=gnu++98" } */
 
 ª
 « /* { dg-error "not valid in an identifier" } */
index bf4bb3a1e828733b8231ffae48819e83fa858c16..1733d3845542d4a3da1ff933de5dfb8654aa822c 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-do preprocess { target { c++23 } } }
+// { dg-do preprocess { target { c++11 } } }
 // { dg-options "-pedantic-errors" }
 
 \u00AA
index 9f83cd76e85490bb01a7491b61d0e4d266faf49a..48e723103ca767ccb9adc0f7fcd3415358ed6650 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-do preprocess { target { c++23 } } }
+// { dg-do preprocess { target { c++11 } } }
 // { dg-options "" }
 
 \u00AA
index afe339ab5fca93c528710c8640fdad4d6df163a0..cbeb13480bb30973f369a4563e68d1429eb8f735 100644 (file)
@@ -1,4 +1,4 @@
-// { dg-do preprocess { target { c++23 } } }
+// { dg-do preprocess { target { c++11 } } }
 // { dg-options "-pedantic-errors" }
 
 \u00AA
index f639d657b393f9128456afe1810b73b37b4ddb42..a1c0a2f413a0c47e1a0d14a6ae4f917e36470fa6 100644 (file)
@@ -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, "");
index 6c8aa6a4d242591884ee5b6d8b1cfaffb017b824..712785ccc202a36c18413d88f5fcb3f40d1e9672 100644 (file)
@@ -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" }
index f9a8f5f088f36ec662aae8fbbb86b390582b7d6f..78719abfe204add7994f1668a34613f2f25bc343 100644 (file)
@@ -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 },
-  /* GNUCXX20 */  { 1,  1,  1,  1,  1,  0,    0,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   0,   0 },
-  /* CXX20    */  { 1,  1,  1,  1,  1,  0,    1,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   0,   0 },
+  /* GNUCXX11 */  { 1,  1,  1,  1,  1,  1,    0,  1,   1,   1,   1,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
+  /* CXX11    */  { 1,  1,  0,  1,  1,  1,    1,  1,   1,   1,   1,    0,     0,     1,   0,      0,   1,     0,   0,   0 },
+  /* GNUCXX14 */  { 1,  1,  1,  1,  1,  1,    0,  1,   1,   1,   1,    1,     1,     0,   0,      1,   1,     0,   0,   0 },
+  /* CXX14    */  { 1,  1,  0,  1,  1,  1,    1,  1,   1,   1,   1,    1,     1,     1,   0,      0,   1,     0,   0,   0 },
+  /* GNUCXX17 */  { 1,  1,  1,  1,  1,  1,    0,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   0,   0 },
+  /* CXX17    */  { 1,  1,  1,  1,  1,  1,    1,  1,   1,   1,   1,    1,     1,     0,   1,      0,   1,     0,   0,   0 },
+  /* GNUCXX20 */  { 1,  1,  1,  1,  1,  1,    0,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   0,   0 },
+  /* CXX20    */  { 1,  1,  1,  1,  1,  1,    1,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   0,   0 },
   /* GNUCXX23 */  { 1,  1,  1,  1,  1,  1,    0,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   1,   1 },
   /* CXX23    */  { 1,  1,  1,  1,  1,  1,    1,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   1,   1 },
   /* ASM      */  { 0,  0,  1,  0,  0,  0,    0,  0,   0,   0,   0,    0,     0,     0,   0,      0,   0,     0,   0,   0 }