c++: Predefine __cpp_named_character_escapes=202207L for C++23 [PR106648]

Message ID YwOlu2HxOJsWaiSZ@tucnak
State New, archived
Headers
Series c++: Predefine __cpp_named_character_escapes=202207L for C++23 [PR106648] |

Commit Message

Jakub Jelinek Aug. 22, 2022, 3:50 p.m. UTC
  On Sun, Aug 21, 2022 at 08:18:02PM +0200, Jakub Jelinek via Gcc-patches wrote:
> Resending with the generated uname2c.h part of patch split into
> compressed attachment, as it was too large for gcc-patches.

Unfortunately seems I forgot about the feature test macro for this, here
is an incremental patch for it.

Tested on x86_64-linux and i686-linux, ok for trunk together with the
rest of the implementation?

2022-08-22  Jakub Jelinek  <jakub@redhat.com>

	PR c++/106648
	* c-cppbuiltin.cc (c_cpp_builtins): Predefine
	__cpp_named_character_escapes to 202207L.

	* g++.dg/cpp23/feat-cxx2b.C: Test __cpp_named_character_escapes.



	Jakub
  

Patch

--- gcc/c-family/c-cppbuiltin.cc.jj	2022-02-09 20:13:51.492305530 +0100
+++ gcc/c-family/c-cppbuiltin.cc	2022-08-22 17:43:50.882791224 +0200
@@ -1080,6 +1080,7 @@  c_cpp_builtins (cpp_reader *pfile)
 	  cpp_define (pfile, "__cpp_if_consteval=202106L");
 	  cpp_define (pfile, "__cpp_constexpr=202110L");
 	  cpp_define (pfile, "__cpp_multidimensional_subscript=202110L");
+	  cpp_define (pfile, "__cpp_named_character_escapes=202207L");
 	}
       if (flag_concepts)
         {
--- gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C.jj	2022-02-09 20:13:51.577304369 +0100
+++ gcc/testsuite/g++.dg/cpp23/feat-cxx2b.C	2022-08-22 17:45:26.920478034 +0200
@@ -557,3 +557,9 @@ 
 #elif __cpp_multidimensional_subscript != 202110
 #  error "__cpp_multidimensional_subscript != 202110"
 #endif
+
+#ifndef __cpp_named_character_escapes
+#  error "__cpp_named_character_escapes"
+#elif __cpp_named_character_escapes != 202207
+#  error "__cpp_named_character_escapes != 202207"
+#endif