From 9ca9afd6d08662d6e019d0c905ffc1cd160479c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Sun, 22 Jun 2025 23:45:03 +0300 Subject: [PATCH 1/3] CWG3013 Disallowing macros for #embed parameters --- source/preprocessor.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/preprocessor.tex b/source/preprocessor.tex index fb4df1d308..36dcd025fa 100644 --- a/source/preprocessor.tex +++ b/source/preprocessor.tex @@ -275,6 +275,11 @@ semantics. \pnum +If one of the \grammarterm{pp-tokens} of a \tcode{\#embed} directive +(before macro replacement) is the \grammarterm{identifier} +\tcode{limit}, \tcode{prefix}, \tcode{suffix}, or \tcode{if_empty} +and that \grammarterm{identifier} is defined +as a macro\iref{cpp.replace.general}, the program is ill-formed. Any \grammarterm{embed-prefixed-parameter} is conditionally-supported, with \impldef{supported forms of \#embed prefix parameters} semantics. @@ -523,6 +528,13 @@ \tcode{defined} unary operator), just as in normal text. +If replacement of macros in the preprocessing tokens following the sequence +\tcode{\xname{has_embed} (} and before a matching \tcode{)} +(possibly produced by macro expansion) +encounters a preprocessing token that is one of the \grammarterm{identifier}s +\tcode{limit}, \tcode{prefix}, \tcode{suffix}, or \tcode{if_empty} +and that \grammarterm{identifier} is defined +as a macro\iref{cpp.replace.general}, the program is ill-formed. If the preprocessing token \tcode{defined} is generated as a result of this replacement process From 756808b68e7fa899457a66cd1128751ab2967fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Sun, 22 Jun 2025 23:47:00 +0300 Subject: [PATCH 2/3] CWG3014 Comma-delimited vs. comma-separated output for #embed --- source/preprocessor.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/preprocessor.tex b/source/preprocessor.tex index 36dcd025fa..f6839083bf 100644 --- a/source/preprocessor.tex +++ b/source/preprocessor.tex @@ -941,12 +941,12 @@ \end{example} \pnum -The \tcode{\#embed} directive is replaced by a comma-delimited list of integer +The \tcode{\#embed} directive is replaced by a comma-separated list of integer literals of type \tcode{int}, unless otherwise modified by embed parameters\iref{cpp.embed.param}. \pnum -The integer literals in the comma-delimited list correspond to +The integer literals in the comma-separated list correspond to resource-count consecutive calls to \tcode{std::fgetc}\iref{cstdio.syn} from the resource, as a binary file. If any call to \tcode{std::fgetc} returns \tcode{EOF}, the program is From 389aa6bae9292fcbc93f0641a5a934bdd6c62ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Sun, 22 Jun 2025 23:48:48 +0300 Subject: [PATCH 3/3] CWG3020 Missing specification for __has_cpp_attribute(indeterminate) --- source/preprocessor.tex | 1 + 1 file changed, 1 insertion(+) diff --git a/source/preprocessor.tex b/source/preprocessor.tex index f6839083bf..3603cac280 100644 --- a/source/preprocessor.tex +++ b/source/preprocessor.tex @@ -485,6 +485,7 @@ \tcode{assume} & \tcode{202207L} \\ \tcode{deprecated} & \tcode{201309L} \\ \tcode{fallthrough} & \tcode{201603L} \\ +\tcode{indeterminate} & \tcode{202403L} \\ \tcode{likely} & \tcode{201803L} \\ \tcode{maybe_unused} & \tcode{201603L} \\ \tcode{no_unique_address} & \tcode{201803L} \\