https://github.com/nfedotenko updated 
https://github.com/llvm/llvm-project/pull/236263

>From f6c28840c379dcd008a61e3f97ed530929886b78 Mon Sep 17 00:00:00 2001
From: Nikolay Fedotenko <[email protected]>
Date: Wed, 28 Oct 2026 02:30:57 +0400
Subject: [PATCH 1/3] [C++26] Define the __cpp_pp_embed feature-test macro

Now that the known #embed bugs affecting valid code are fixed --
the multi-byte braced-list miscompile (#222796, fixed by #231938)
and the parameter-lexing assertion (#212075, fixed by #235934) -- define 
__cpp_pp_embed to 202502L. It is defined in all C++ language modes, like the 
other C++26 features Clang supports as extensions in earlier modes.
The C++ status page entry for P1967R14 is updated accordingly.

Part of #127610.
---
 clang/docs/ReleaseNotes.md                     |  4 ++--
 clang/lib/Frontend/InitPreprocessor.cpp        |  1 +
 clang/test/Lexer/cxx-features.cpp              |  4 ++++
 clang/test/Preprocessor/embed_feature_test.cpp | 10 ++++++++++
 clang/www/cxx_status.html                      | 12 ++++++------
 5 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index c5532359ef7af8..1770aae51b053a 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -235,8 +235,8 @@ documentation](CIR/index.md) for more information regarding 
ClangIR's status and
   now diagnosed as a C++26 extension under `-Wc++26-extensions` (previously it
   was diagnosed as a Clang extension under `-Wc23-extensions`), and a new
   `-Wpre-c++26-compat` warning is available in C++26 mode. The
-  `__cpp_pp_embed` feature-test macro is not yet defined because of known
-  issues in the implementation.
+  `__cpp_pp_embed` feature-test macro is now defined, following the fixes for
+  the known initialization bugs with multi-byte `#embed` in braced lists.
 
 - Added `__builtin_type_order` for compatibility with GCC as part of the
   implementation of 
[P2830R10](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2830r10.html)
 (Constexpr Type Ordering).
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp 
b/clang/lib/Frontend/InitPreprocessor.cpp
index 784ff9951a25ad..4f2a2a1bd28b79 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -765,6 +765,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const 
LangOptions &LangOpts,
   Builder.defineMacro("__cpp_deleted_function", "202403L");
   Builder.defineMacro("__cpp_variadic_friend", "202403L");
   Builder.defineMacro("__cpp_trivial_relocatability", "202502L");
+  Builder.defineMacro("__cpp_pp_embed", "202502L");
 
   if (LangOpts.Char8)
     Builder.defineMacro("__cpp_char8_t", "202207L");
diff --git a/clang/test/Lexer/cxx-features.cpp 
b/clang/test/Lexer/cxx-features.cpp
index b505f18dff14fe..f920ad64ba056b 100644
--- a/clang/test/Lexer/cxx-features.cpp
+++ b/clang/test/Lexer/cxx-features.cpp
@@ -54,6 +54,10 @@
 #error "wrong value for __cpp_placeholder_variables"
 #endif
 
+#if check(pp_embed, 202502, 202502, 202502, 202502, 202502, 202502, 202502)
+#error "wrong value for __cpp_pp_embed"
+#endif
+
 #if check(trivial_relocatability, 202502, 202502, 202502, 202502, 202502, 
202502, 202502)
 #error "wrong value for __cpp_trivial_relocatability"
 #endif
diff --git a/clang/test/Preprocessor/embed_feature_test.cpp 
b/clang/test/Preprocessor/embed_feature_test.cpp
index 2648804132599b..2b44586012a168 100644
--- a/clang/test/Preprocessor/embed_feature_test.cpp
+++ b/clang/test/Preprocessor/embed_feature_test.cpp
@@ -5,3 +5,13 @@
 #if !defined(__has_embed)
 #error 1
 #endif
+
+#ifdef __cplusplus
+#if __cpp_pp_embed != 202502L
+#error 2
+#endif
+#else
+#ifdef __cpp_pp_embed
+#error 3
+#endif
+#endif
diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 67a73771b05a6c..540f3d10c8ce7b 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -400,13 +400,13 @@ <h2 id="cxx26">C++2c implementation status</h2>
  <tr>
   <td><pre>#embed</pre></td>
   <td><a href="https://wg21.link/P1967";>P1967R14</a></td>
-  <td class="partial" align="center">
+  <td class="full" align="center">
     <details>
-      <summary>Clang 24 (Partial)</summary>
-      The directive and its parameters are supported since Clang 19. A
-      multi-byte <tt>#embed</tt> in a braced initializer list that initializes
-      a non-aggregate object is not yet handled correctly in some contexts, so
-      the <tt>__cpp_pp_embed</tt> feature-test macro is not defined yet.
+      <summary>Clang 24</summary>
+      The directive and its parameters are supported since Clang 19; Clang 24
+      fixed the remaining initialization bugs with multi-byte <tt>#embed</tt>
+      in braced lists and defines the <tt>__cpp_pp_embed</tt> feature-test
+      macro.
     </details>
   </td>
  </tr>

>From 4d07e3851021969e3310b86d4c53f7f3b3ef2b3f Mon Sep 17 00:00:00 2001
From: Nikolay Fedotenko <[email protected]>
Date: Thu, 29 Oct 2026 23:35:45 +0400
Subject: [PATCH 2/3] Address review: unreleased status class, shorter notes,
 back-ported extensions table

---
 clang/docs/LanguageExtensions.md |  1 +
 clang/docs/ReleaseNotes.md       |  3 +--
 clang/www/cxx_status.html        | 10 +---------
 3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/clang/docs/LanguageExtensions.md b/clang/docs/LanguageExtensions.md
index 3db8d083c40756..7b930e2ac0a534 100644
--- a/clang/docs/LanguageExtensions.md
+++ b/clang/docs/LanguageExtensions.md
@@ -1782,6 +1782,7 @@ More information can be found [here](Modules.md).
 | `= delete ("should have a reason");`          | \_\_cpp_deleted_function     
      | C++26         | C++03         |
 | Variadic Friends                              | \_\_cpp_variadic_friend      
      | C++26         | C++03         |
 | Trivial Relocatability                        | 
\_\_cpp_trivial_relocatability     | C++26         | C++03         |
+| `#embed`                                      | \_\_cpp_pp_embed             
      | C++26         | C++03         |
 |``auto()`` cast                                | \_\_cpp_auto_cast            
      | C++26         | C++03         |
 | Pack Indexing for Template Names              | \_\_cpp_pack_indexing >= 
202606L   | C++2d         | C++03         |
 | Designated initializers (N494)                |                              
      | C99           | C89           |
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index 1770aae51b053a..e6d039f73e7093 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -235,8 +235,7 @@ documentation](CIR/index.md) for more information regarding 
ClangIR's status and
   now diagnosed as a C++26 extension under `-Wc++26-extensions` (previously it
   was diagnosed as a Clang extension under `-Wc23-extensions`), and a new
   `-Wpre-c++26-compat` warning is available in C++26 mode. The
-  `__cpp_pp_embed` feature-test macro is now defined, following the fixes for
-  the known initialization bugs with multi-byte `#embed` in braced lists.
+  `__cpp_pp_embed` feature-test macro is now defined.
 
 - Added `__builtin_type_order` for compatibility with GCC as part of the
   implementation of 
[P2830R10](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2830r10.html)
 (Constexpr Type Ordering).
diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 540f3d10c8ce7b..aacb26dfeddc80 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -400,15 +400,7 @@ <h2 id="cxx26">C++2c implementation status</h2>
  <tr>
   <td><pre>#embed</pre></td>
   <td><a href="https://wg21.link/P1967";>P1967R14</a></td>
-  <td class="full" align="center">
-    <details>
-      <summary>Clang 24</summary>
-      The directive and its parameters are supported since Clang 19; Clang 24
-      fixed the remaining initialization bugs with multi-byte <tt>#embed</tt>
-      in braced lists and defines the <tt>__cpp_pp_embed</tt> feature-test
-      macro.
-    </details>
-  </td>
+  <td class="unreleased" align="center">Clang 24</td>
  </tr>
  <!-- Bulgaria, Spring 2025 -->
  <tr>

>From 6b4eb835e0e98b9037cbc9dcfb298ec900d18896 Mon Sep 17 00:00:00 2001
From: Nikolay Fedotenko <[email protected]>
Date: Fri, 30 Oct 2026 11:51:56 +0400
Subject: [PATCH 3/3] Drop C++ from the N3017 #embed backported-to entry, now
 covered by the C++26 row

---
 clang/docs/LanguageExtensions.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/docs/LanguageExtensions.md b/clang/docs/LanguageExtensions.md
index 7b930e2ac0a534..6c1eddb4bc863b 100644
--- a/clang/docs/LanguageExtensions.md
+++ b/clang/docs/LanguageExtensions.md
@@ -1808,7 +1808,7 @@ More information can be found [here](Modules.md).
 | `_Thread_local` (N1364)                       |                              
      | C11           | C89, C++      |
 | Array & element qualification (N2607)         |                              
      | C23           | C89           |
 | Attributes (N2335)                            |                              
      | C23           | C89           |
-| `#embed` (N3017)                              |                              
      | C23           | C89, C++      |
+| `#embed` (N3017)                              |                              
      | C23           | C89           |
 | Enum with fixed underlying type (N3030)       |                              
      | C23           | C89           |
 | `#warning` (N2686)                            |                              
      | C23           | C89           |
 | `_BitInt` (N3035)                             |                              
      | C23           | C89, C++      |

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to