public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libcpp: Enable P1949R7 for C++11 and up as it was a DR [PR100977]
@ 2021-11-29 11:24 Jakub Jelinek
  2021-11-29 22:53 ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2021-11-29 11:24 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches, Jonathan Wakely

Hi!

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.

So far lightly tested, ok for trunk if it passes full bootstrap/regtest
on x86_64-linux/i686-linux?

2021-11-29  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.

--- libcpp/init.c.jj	2021-11-17 20:08:18.359724792 +0100
+++ libcpp/init.c	2021-11-29 11:40:05.989432952 +0100
@@ -114,14 +114,14 @@ static const struct lang_flags lang_defa
   /* 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 }
--- gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c.jj	2020-01-14 20:02:46.649611841 +0100
+++ gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c	2021-11-29 12:11:51.640324720 +0100
@@ -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++ } } */
--- gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c.jj	2020-01-14 20:02:46.649611841 +0100
+++ gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c	2021-11-29 12:12:02.230174227 +0100
@@ -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++ } } */
--- gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C.jj	2020-01-14 20:02:46.702611047 +0100
+++ gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C	2021-11-29 12:09:44.871126209 +0100
@@ -1,5 +1,5 @@
 /* { dg-do preprocess } */
-/* { dg-options "-std=gnu++98"} */
+/* { dg-options "-std=gnu++98" } */
 
 ª
 « /* { dg-error "not valid in an identifier" } */
--- gcc/testsuite/g++.dg/cpp23/normalize3.C.jj	2021-09-01 22:32:39.624869716 +0200
+++ gcc/testsuite/g++.dg/cpp23/normalize3.C	2021-11-29 11:42:49.283104059 +0100
@@ -1,4 +1,4 @@
-// { dg-do preprocess { target { c++23 } } }
+// { dg-do preprocess { target { c++11 } } }
 // { dg-options "-pedantic-errors" }
 
 \u00AA
--- gcc/testsuite/g++.dg/cpp23/normalize4.C.jj	2021-09-01 22:32:39.624869716 +0200
+++ gcc/testsuite/g++.dg/cpp23/normalize4.C	2021-11-29 11:43:03.542900685 +0100
@@ -1,4 +1,4 @@
-// { dg-do preprocess { target { c++23 } } }
+// { dg-do preprocess { target { c++11 } } }
 // { dg-options "" }
 
 \u00AA
--- gcc/testsuite/g++.dg/cpp23/normalize5.C.jj	2021-09-01 22:32:39.624869716 +0200
+++ gcc/testsuite/g++.dg/cpp23/normalize5.C	2021-11-29 11:43:14.662742096 +0100
@@ -1,4 +1,4 @@
-// { dg-do preprocess { target { c++23 } } }
+// { dg-do preprocess { target { c++11 } } }
 // { dg-options "-pedantic-errors" }
 
 \u00AA
--- gcc/testsuite/g++.dg/cpp23/normalize7.C.jj	2021-09-01 22:32:39.624869716 +0200
+++ gcc/testsuite/g++.dg/cpp23/normalize7.C	2021-11-29 11:51:00.691111036 +0100
@@ -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, "");
--- gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C.jj	2021-09-01 22:32:39.624869716 +0200
+++ gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C	2021-11-29 11:44:49.803387527 +0100
@@ -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" }

	Jakub


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libcpp: Enable P1949R7 for C++11 and up as it was a DR [PR100977]
  2021-11-29 11:24 [PATCH] libcpp: Enable P1949R7 for C++11 and up as it was a DR [PR100977] Jakub Jelinek
@ 2021-11-29 22:53 ` Jason Merrill
  2021-11-30 18:19   ` [PATCH] libcpp: Enable P1949R7 for C++98 too [PR100977] Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Merrill @ 2021-11-29 22:53 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches, Jonathan Wakely

On 11/29/21 06:24, Jakub Jelinek wrote:
> Hi!
> 
> 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.

I'm inclined to go ahead and change C++98 as well; I doubt anyone is 
relying on the particular C++98 extended character set rules, and we 
already accept the union of the different sets when not pedantic.

> So far lightly tested, ok for trunk if it passes full bootstrap/regtest
> on x86_64-linux/i686-linux?

OK.

> 2021-11-29  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.
> 
> --- libcpp/init.c.jj	2021-11-17 20:08:18.359724792 +0100
> +++ libcpp/init.c	2021-11-29 11:40:05.989432952 +0100
> @@ -114,14 +114,14 @@ static const struct lang_flags lang_defa
>     /* 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 }
> --- gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c.jj	2020-01-14 20:02:46.649611841 +0100
> +++ gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c	2021-11-29 12:11:51.640324720 +0100
> @@ -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++ } } */
> --- gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c.jj	2020-01-14 20:02:46.649611841 +0100
> +++ gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c	2021-11-29 12:12:02.230174227 +0100
> @@ -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++ } } */
> --- gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C.jj	2020-01-14 20:02:46.702611047 +0100
> +++ gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C	2021-11-29 12:09:44.871126209 +0100
> @@ -1,5 +1,5 @@
>   /* { dg-do preprocess } */
> -/* { dg-options "-std=gnu++98"} */
> +/* { dg-options "-std=gnu++98" } */
>   
>   ª
>   « /* { dg-error "not valid in an identifier" } */
> --- gcc/testsuite/g++.dg/cpp23/normalize3.C.jj	2021-09-01 22:32:39.624869716 +0200
> +++ gcc/testsuite/g++.dg/cpp23/normalize3.C	2021-11-29 11:42:49.283104059 +0100
> @@ -1,4 +1,4 @@
> -// { dg-do preprocess { target { c++23 } } }
> +// { dg-do preprocess { target { c++11 } } }
>   // { dg-options "-pedantic-errors" }
>   
>   \u00AA
> --- gcc/testsuite/g++.dg/cpp23/normalize4.C.jj	2021-09-01 22:32:39.624869716 +0200
> +++ gcc/testsuite/g++.dg/cpp23/normalize4.C	2021-11-29 11:43:03.542900685 +0100
> @@ -1,4 +1,4 @@
> -// { dg-do preprocess { target { c++23 } } }
> +// { dg-do preprocess { target { c++11 } } }
>   // { dg-options "" }
>   
>   \u00AA
> --- gcc/testsuite/g++.dg/cpp23/normalize5.C.jj	2021-09-01 22:32:39.624869716 +0200
> +++ gcc/testsuite/g++.dg/cpp23/normalize5.C	2021-11-29 11:43:14.662742096 +0100
> @@ -1,4 +1,4 @@
> -// { dg-do preprocess { target { c++23 } } }
> +// { dg-do preprocess { target { c++11 } } }
>   // { dg-options "-pedantic-errors" }
>   
>   \u00AA
> --- gcc/testsuite/g++.dg/cpp23/normalize7.C.jj	2021-09-01 22:32:39.624869716 +0200
> +++ gcc/testsuite/g++.dg/cpp23/normalize7.C	2021-11-29 11:51:00.691111036 +0100
> @@ -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, "");
> --- gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C.jj	2021-09-01 22:32:39.624869716 +0200
> +++ gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C	2021-11-29 11:44:49.803387527 +0100
> @@ -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" }
> 
> 	Jakub
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] libcpp: Enable P1949R7 for C++98 too [PR100977]
  2021-11-29 22:53 ` Jason Merrill
@ 2021-11-30 18:19   ` Jakub Jelinek
  2021-11-30 18:28     ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2021-11-30 18:19 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches, Jonathan Wakely

On Mon, Nov 29, 2021 at 05:53:58PM -0500, Jason Merrill wrote:
> I'm inclined to go ahead and change C++98 as well; I doubt anyone is relying
> on the particular C++98 extended character set rules, and we already accept
> the union of the different sets when not pedantic.

Ok, here is an incremental patch to do that also for -std={c,gnu}++98.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2021-11-30  Jakub Jelinek  <jakub@redhat.com>

	* init.c (struct lang_flags): Remove cxx23_identifiers.
	(lang_defaults): Remove cxx23_identifiers initializers.
	(cpp_set_lang): Don't copy cxx23_identifiers.
	* include/cpplib.h (struct cpp_options): Adjust comment about
	c11_identifiers.  Remove cxx23_identifiers field.
	* lex.c (warn_about_normalization): Use cplusplus instead of
	cxx23_identifiers.
	* charset.c (ucn_valid_in_identifier): Likewise.

	* g++.dg/cpp/ucnid-1.C: Adjust expected diagnostics.
	* g++.dg/cpp/ucnid-1-utf8.C: Likewise.

--- gcc/init.c.jj	2021-11-29 22:54:46.503750631 +0100
+++ gcc/init.c	2021-11-30 01:06:31.704473882 +0100
@@ -82,7 +82,6 @@ struct lang_flags
   char extended_numbers;
   char extended_identifiers;
   char c11_identifiers;
-  char cxx23_identifiers;
   char std;
   char digraphs;
   char uliterals;
@@ -100,31 +99,31 @@ struct lang_flags
 };
 
 static const struct lang_flags lang_defaults[] =
-{ /*              c99 c++ xnum xid c11 c++23 std digr ulit rlit udlit bincst digsep trig u8chlit vaopt scope dfp szlit elifdef */
-  /* GNUC89   */  { 0,  0,  1,  0,  0,  0,    0,  1,   0,   0,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
-  /* GNUC99   */  { 1,  0,  1,  1,  0,  0,    0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
-  /* GNUC11   */  { 1,  0,  1,  1,  1,  0,    0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
-  /* GNUC17   */  { 1,  0,  1,  1,  1,  0,    0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
-  /* GNUC2X   */  { 1,  0,  1,  1,  1,  0,    0,  1,   1,   1,   0,    1,     1,     0,   1,      1,   1,     1,   0,   1 },
-  /* STDC89   */  { 0,  0,  0,  0,  0,  0,    1,  0,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
-  /* STDC94   */  { 0,  0,  0,  0,  0,  0,    1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
-  /* STDC99   */  { 1,  0,  1,  1,  0,  0,    1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
-  /* STDC11   */  { 1,  0,  1,  1,  1,  0,    1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
-  /* STDC17   */  { 1,  0,  1,  1,  1,  0,    1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
-  /* 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,  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 }
+{ /*              c99 c++ xnum xid c11 std digr ulit rlit udlit bincst digsep trig u8chlit vaopt scope dfp szlit elifdef */
+  /* GNUC89   */  { 0,  0,  1,  0,  0,  0,  1,   0,   0,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
+  /* GNUC99   */  { 1,  0,  1,  1,  0,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
+  /* GNUC11   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
+  /* GNUC17   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
+  /* GNUC2X   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    1,     1,     0,   1,      1,   1,     1,   0,   1 },
+  /* STDC89   */  { 0,  0,  0,  0,  0,  1,  0,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
+  /* STDC94   */  { 0,  0,  0,  0,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
+  /* STDC99   */  { 1,  0,  1,  1,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
+  /* STDC11   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
+  /* STDC17   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
+  /* STDC2X   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    1,     1,     1,   1,      0,   1,     1,   0,   1 },
+  /* GNUCXX   */  { 0,  1,  1,  1,  0,  0,  1,   0,   0,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
+  /* CXX98    */  { 0,  1,  0,  1,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   1,     0,   0,   0 },
+  /* GNUCXX11 */  { 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,    0,     0,     1,   0,      0,   1,     0,   0,   0 },
+  /* GNUCXX14 */  { 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,   0,      0,   1,     0,   0,   0 },
+  /* GNUCXX17 */  { 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,     0,   1,      0,   1,     0,   0,   0 },
+  /* GNUCXX20 */  { 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,     0,   1,      1,   1,     0,   0,   0 },
+  /* GNUCXX23 */  { 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,     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 }
 };
 
 /* Sets internal flags correctly for a given language.  */
@@ -140,7 +139,6 @@ cpp_set_lang (cpp_reader *pfile, enum c_
   CPP_OPTION (pfile, extended_numbers)		 = l->extended_numbers;
   CPP_OPTION (pfile, extended_identifiers)	 = l->extended_identifiers;
   CPP_OPTION (pfile, c11_identifiers)		 = l->c11_identifiers;
-  CPP_OPTION (pfile, cxx23_identifiers)		 = l->cxx23_identifiers;
   CPP_OPTION (pfile, std)			 = l->std;
   CPP_OPTION (pfile, digraphs)			 = l->digraphs;
   CPP_OPTION (pfile, uliterals)			 = l->uliterals;
--- gcc/include/cpplib.h.jj	2021-11-17 20:08:18.359724792 +0100
+++ gcc/include/cpplib.h	2021-11-30 01:06:12.325741705 +0100
@@ -491,13 +491,9 @@ struct cpp_options
   unsigned char ext_numeric_literals;
 
   /* Nonzero means extended identifiers allow the characters specified
-     in C11 and C++11.  */
+     in C11.  */
   unsigned char c11_identifiers;
 
-  /* Nonzero means extended identifiers allow the characters specified
-     in C++23.  */
-  unsigned char cxx23_identifiers;
-
   /* Nonzero for C++ 2014 Standard binary constants.  */
   unsigned char binary_constants;
 
--- gcc/lex.c.jj	2021-11-23 23:09:03.404339391 +0100
+++ gcc/lex.c	2021-11-30 01:07:20.713796544 +0100
@@ -1838,7 +1838,7 @@ warn_about_normalization (cpp_reader *pf
       if (NORMALIZE_STATE_RESULT (s) == normalized_C)
 	cpp_warning_at (pfile, CPP_W_NORMALIZE, &rich_loc,
 			"`%.*s' is not in NFKC", (int) sz, buf);
-      else if (CPP_OPTION (pfile, cxx23_identifiers))
+      else if (CPP_OPTION (pfile, cplusplus))
 	cpp_pedwarning_at (pfile, CPP_W_NORMALIZE, &rich_loc,
 				  "`%.*s' is not in NFC", (int) sz, buf);
       else
--- gcc/charset.c.jj	2021-11-01 23:01:30.582702315 +0100
+++ gcc/charset.c	2021-11-30 01:08:13.651064928 +0100
@@ -955,14 +955,12 @@ ucn_valid_in_identifier (cpp_reader *pfi
   valid_flags = C99 | CXX | C11 | CXX23;
   if (CPP_PEDANTIC (pfile))
     {
-      if (CPP_OPTION (pfile, cxx23_identifiers))
+      if (CPP_OPTION (pfile, cplusplus))
 	valid_flags = CXX23;
       else if (CPP_OPTION (pfile, c11_identifiers))
 	valid_flags = C11;
       else if (CPP_OPTION (pfile, c99))
 	valid_flags = C99;
-      else if (CPP_OPTION (pfile, cplusplus))
-	valid_flags = CXX;
     }
   if (! (ucnranges[mn].flags & valid_flags))
       return 0;
@@ -1021,7 +1019,7 @@ ucn_valid_in_identifier (cpp_reader *pfi
       return 2;
     }
 
-  if (CPP_OPTION (pfile, cxx23_identifiers))
+  if (CPP_OPTION (pfile, cplusplus))
     invalid_start_flags = NXX23;
   else if (CPP_OPTION (pfile, c11_identifiers))
     invalid_start_flags = N11;
--- gcc/testsuite/g++.dg/cpp/ucnid-1.C.jj	2020-01-14 20:02:46.702611047 +0100
+++ gcc/testsuite/g++.dg/cpp/ucnid-1.C	2021-11-30 18:40:00.664865172 +0100
@@ -1,17 +1,17 @@
 /* { dg-do preprocess } */
 /* { dg-options "-std=gnu++98 -pedantic" } */
 
-\u00AA /* { dg-error "not valid in an identifier" } */
+\u00AA
 \u00AB /* { dg-error "not valid in an identifier" } */
 \u00B6 /* { dg-error "not valid in an identifier" } */
-\u00BA /* { dg-error "not valid in an identifier" } */
+\u00BA
 \u00C0
 \u00D6
-\u0384
+\u0384 /* { dg-error "not valid in an identifier" } */
 
-\u0669 /* { dg-error "not valid in an identifier" } */
-A\u0669 /* { dg-error "not valid in an identifier" } */
-0\u00BA /* { dg-error "not valid in an identifier" } */
-0\u0669 /* { dg-error "not valid in an identifier" } */
-\u0E59
+\u0669 /* { dg-error "not valid at the start of an identifier" } */
+A\u0669
+0\u00BA
+0\u0669
+\u0E59 /* { dg-error "not valid at the start of an identifier" } */
 A\u0E59
--- gcc/testsuite/g++.dg/cpp/ucnid-1-utf8.C.jj	2020-01-14 20:02:46.702611047 +0100
+++ gcc/testsuite/g++.dg/cpp/ucnid-1-utf8.C	2021-11-30 18:40:51.641121457 +0100
@@ -1,17 +1,17 @@
 /* { dg-do preprocess } */
 /* { dg-options "-std=gnu++98 -pedantic" } */
 
-ª /* { dg-error "not valid in an identifier" } */
+ª
 « /* { dg-error "not valid in an identifier" } */
 ¶ /* { dg-error "not valid in an identifier" } */
-º /* { dg-error "not valid in an identifier" } */
+º
 À
 Ö
-΄
+΄ /* { dg-error "not valid in an identifier" } */
 
-٩ /* { dg-error "not valid in an identifier" } */
-A٩ /* { dg-error "not valid in an identifier" } */
-0º /* { dg-error "not valid in an identifier" } */
-0٩ /* { dg-error "not valid in an identifier" } */
-๙
+٩ /* { dg-error "not valid at the start of an identifier" } */
+A٩
+0º
+0٩
+๙ /* { dg-error "not valid at the start of an identifier" } */
 A๙


	Jakub


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libcpp: Enable P1949R7 for C++98 too [PR100977]
  2021-11-30 18:19   ` [PATCH] libcpp: Enable P1949R7 for C++98 too [PR100977] Jakub Jelinek
@ 2021-11-30 18:28     ` Jason Merrill
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2021-11-30 18:28 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches, Jonathan Wakely

On 11/30/21 13:19, Jakub Jelinek wrote:
> On Mon, Nov 29, 2021 at 05:53:58PM -0500, Jason Merrill wrote:
>> I'm inclined to go ahead and change C++98 as well; I doubt anyone is relying
>> on the particular C++98 extended character set rules, and we already accept
>> the union of the different sets when not pedantic.
> 
> Ok, here is an incremental patch to do that also for -std={c,gnu}++98.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK.

> 2021-11-30  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* init.c (struct lang_flags): Remove cxx23_identifiers.
> 	(lang_defaults): Remove cxx23_identifiers initializers.
> 	(cpp_set_lang): Don't copy cxx23_identifiers.
> 	* include/cpplib.h (struct cpp_options): Adjust comment about
> 	c11_identifiers.  Remove cxx23_identifiers field.
> 	* lex.c (warn_about_normalization): Use cplusplus instead of
> 	cxx23_identifiers.
> 	* charset.c (ucn_valid_in_identifier): Likewise.
> 
> 	* g++.dg/cpp/ucnid-1.C: Adjust expected diagnostics.
> 	* g++.dg/cpp/ucnid-1-utf8.C: Likewise.
> 
> --- gcc/init.c.jj	2021-11-29 22:54:46.503750631 +0100
> +++ gcc/init.c	2021-11-30 01:06:31.704473882 +0100
> @@ -82,7 +82,6 @@ struct lang_flags
>     char extended_numbers;
>     char extended_identifiers;
>     char c11_identifiers;
> -  char cxx23_identifiers;
>     char std;
>     char digraphs;
>     char uliterals;
> @@ -100,31 +99,31 @@ struct lang_flags
>   };
>   
>   static const struct lang_flags lang_defaults[] =
> -{ /*              c99 c++ xnum xid c11 c++23 std digr ulit rlit udlit bincst digsep trig u8chlit vaopt scope dfp szlit elifdef */
> -  /* GNUC89   */  { 0,  0,  1,  0,  0,  0,    0,  1,   0,   0,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
> -  /* GNUC99   */  { 1,  0,  1,  1,  0,  0,    0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
> -  /* GNUC11   */  { 1,  0,  1,  1,  1,  0,    0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
> -  /* GNUC17   */  { 1,  0,  1,  1,  1,  0,    0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
> -  /* GNUC2X   */  { 1,  0,  1,  1,  1,  0,    0,  1,   1,   1,   0,    1,     1,     0,   1,      1,   1,     1,   0,   1 },
> -  /* STDC89   */  { 0,  0,  0,  0,  0,  0,    1,  0,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
> -  /* STDC94   */  { 0,  0,  0,  0,  0,  0,    1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
> -  /* STDC99   */  { 1,  0,  1,  1,  0,  0,    1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
> -  /* STDC11   */  { 1,  0,  1,  1,  1,  0,    1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
> -  /* STDC17   */  { 1,  0,  1,  1,  1,  0,    1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
> -  /* 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,  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 }
> +{ /*              c99 c++ xnum xid c11 std digr ulit rlit udlit bincst digsep trig u8chlit vaopt scope dfp szlit elifdef */
> +  /* GNUC89   */  { 0,  0,  1,  0,  0,  0,  1,   0,   0,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
> +  /* GNUC99   */  { 1,  0,  1,  1,  0,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
> +  /* GNUC11   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
> +  /* GNUC17   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
> +  /* GNUC2X   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    1,     1,     0,   1,      1,   1,     1,   0,   1 },
> +  /* STDC89   */  { 0,  0,  0,  0,  0,  1,  0,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
> +  /* STDC94   */  { 0,  0,  0,  0,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
> +  /* STDC99   */  { 1,  0,  1,  1,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
> +  /* STDC11   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
> +  /* STDC17   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0 },
> +  /* STDC2X   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    1,     1,     1,   1,      0,   1,     1,   0,   1 },
> +  /* GNUCXX   */  { 0,  1,  1,  1,  0,  0,  1,   0,   0,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0 },
> +  /* CXX98    */  { 0,  1,  0,  1,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   1,     0,   0,   0 },
> +  /* GNUCXX11 */  { 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,    0,     0,     1,   0,      0,   1,     0,   0,   0 },
> +  /* GNUCXX14 */  { 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,   0,      0,   1,     0,   0,   0 },
> +  /* GNUCXX17 */  { 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,     0,   1,      0,   1,     0,   0,   0 },
> +  /* GNUCXX20 */  { 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,     0,   1,      1,   1,     0,   0,   0 },
> +  /* GNUCXX23 */  { 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,     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 }
>   };
>   
>   /* Sets internal flags correctly for a given language.  */
> @@ -140,7 +139,6 @@ cpp_set_lang (cpp_reader *pfile, enum c_
>     CPP_OPTION (pfile, extended_numbers)		 = l->extended_numbers;
>     CPP_OPTION (pfile, extended_identifiers)	 = l->extended_identifiers;
>     CPP_OPTION (pfile, c11_identifiers)		 = l->c11_identifiers;
> -  CPP_OPTION (pfile, cxx23_identifiers)		 = l->cxx23_identifiers;
>     CPP_OPTION (pfile, std)			 = l->std;
>     CPP_OPTION (pfile, digraphs)			 = l->digraphs;
>     CPP_OPTION (pfile, uliterals)			 = l->uliterals;
> --- gcc/include/cpplib.h.jj	2021-11-17 20:08:18.359724792 +0100
> +++ gcc/include/cpplib.h	2021-11-30 01:06:12.325741705 +0100
> @@ -491,13 +491,9 @@ struct cpp_options
>     unsigned char ext_numeric_literals;
>   
>     /* Nonzero means extended identifiers allow the characters specified
> -     in C11 and C++11.  */
> +     in C11.  */
>     unsigned char c11_identifiers;
>   
> -  /* Nonzero means extended identifiers allow the characters specified
> -     in C++23.  */
> -  unsigned char cxx23_identifiers;
> -
>     /* Nonzero for C++ 2014 Standard binary constants.  */
>     unsigned char binary_constants;
>   
> --- gcc/lex.c.jj	2021-11-23 23:09:03.404339391 +0100
> +++ gcc/lex.c	2021-11-30 01:07:20.713796544 +0100
> @@ -1838,7 +1838,7 @@ warn_about_normalization (cpp_reader *pf
>         if (NORMALIZE_STATE_RESULT (s) == normalized_C)
>   	cpp_warning_at (pfile, CPP_W_NORMALIZE, &rich_loc,
>   			"`%.*s' is not in NFKC", (int) sz, buf);
> -      else if (CPP_OPTION (pfile, cxx23_identifiers))
> +      else if (CPP_OPTION (pfile, cplusplus))
>   	cpp_pedwarning_at (pfile, CPP_W_NORMALIZE, &rich_loc,
>   				  "`%.*s' is not in NFC", (int) sz, buf);
>         else
> --- gcc/charset.c.jj	2021-11-01 23:01:30.582702315 +0100
> +++ gcc/charset.c	2021-11-30 01:08:13.651064928 +0100
> @@ -955,14 +955,12 @@ ucn_valid_in_identifier (cpp_reader *pfi
>     valid_flags = C99 | CXX | C11 | CXX23;
>     if (CPP_PEDANTIC (pfile))
>       {
> -      if (CPP_OPTION (pfile, cxx23_identifiers))
> +      if (CPP_OPTION (pfile, cplusplus))
>   	valid_flags = CXX23;
>         else if (CPP_OPTION (pfile, c11_identifiers))
>   	valid_flags = C11;
>         else if (CPP_OPTION (pfile, c99))
>   	valid_flags = C99;
> -      else if (CPP_OPTION (pfile, cplusplus))
> -	valid_flags = CXX;
>       }
>     if (! (ucnranges[mn].flags & valid_flags))
>         return 0;
> @@ -1021,7 +1019,7 @@ ucn_valid_in_identifier (cpp_reader *pfi
>         return 2;
>       }
>   
> -  if (CPP_OPTION (pfile, cxx23_identifiers))
> +  if (CPP_OPTION (pfile, cplusplus))
>       invalid_start_flags = NXX23;
>     else if (CPP_OPTION (pfile, c11_identifiers))
>       invalid_start_flags = N11;
> --- gcc/testsuite/g++.dg/cpp/ucnid-1.C.jj	2020-01-14 20:02:46.702611047 +0100
> +++ gcc/testsuite/g++.dg/cpp/ucnid-1.C	2021-11-30 18:40:00.664865172 +0100
> @@ -1,17 +1,17 @@
>   /* { dg-do preprocess } */
>   /* { dg-options "-std=gnu++98 -pedantic" } */
>   
> -\u00AA /* { dg-error "not valid in an identifier" } */
> +\u00AA
>   \u00AB /* { dg-error "not valid in an identifier" } */
>   \u00B6 /* { dg-error "not valid in an identifier" } */
> -\u00BA /* { dg-error "not valid in an identifier" } */
> +\u00BA
>   \u00C0
>   \u00D6
> -\u0384
> +\u0384 /* { dg-error "not valid in an identifier" } */
>   
> -\u0669 /* { dg-error "not valid in an identifier" } */
> -A\u0669 /* { dg-error "not valid in an identifier" } */
> -0\u00BA /* { dg-error "not valid in an identifier" } */
> -0\u0669 /* { dg-error "not valid in an identifier" } */
> -\u0E59
> +\u0669 /* { dg-error "not valid at the start of an identifier" } */
> +A\u0669
> +0\u00BA
> +0\u0669
> +\u0E59 /* { dg-error "not valid at the start of an identifier" } */
>   A\u0E59
> --- gcc/testsuite/g++.dg/cpp/ucnid-1-utf8.C.jj	2020-01-14 20:02:46.702611047 +0100
> +++ gcc/testsuite/g++.dg/cpp/ucnid-1-utf8.C	2021-11-30 18:40:51.641121457 +0100
> @@ -1,17 +1,17 @@
>   /* { dg-do preprocess } */
>   /* { dg-options "-std=gnu++98 -pedantic" } */
>   
> -ª /* { dg-error "not valid in an identifier" } */
> +ª
>   « /* { dg-error "not valid in an identifier" } */
>   ¶ /* { dg-error "not valid in an identifier" } */
> -º /* { dg-error "not valid in an identifier" } */
> +º
>   À
>   Ö
> -΄
> +΄ /* { dg-error "not valid in an identifier" } */
>   
> -٩ /* { dg-error "not valid in an identifier" } */
> -A٩ /* { dg-error "not valid in an identifier" } */
> -0º /* { dg-error "not valid in an identifier" } */
> -0٩ /* { dg-error "not valid in an identifier" } */
> -๙
> +٩ /* { dg-error "not valid at the start of an identifier" } */
> +A٩
> +0º
> +0٩
> +๙ /* { dg-error "not valid at the start of an identifier" } */
>   A๙
> 
> 
> 	Jakub
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-30 18:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 11:24 [PATCH] libcpp: Enable P1949R7 for C++11 and up as it was a DR [PR100977] Jakub Jelinek
2021-11-29 22:53 ` Jason Merrill
2021-11-30 18:19   ` [PATCH] libcpp: Enable P1949R7 for C++98 too [PR100977] Jakub Jelinek
2021-11-30 18:28     ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).