-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[C11] Claim conformance to WG14 N1518 #133749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This paper introduced ranges of valid start and continuation characters for identifiers. C23 made further changes to these sets.
@llvm/pr-subscribers-clang Author: Aaron Ballman (AaronBallman) ChangesThis paper introduced ranges of valid start and continuation characters for identifiers. C23 made further changes to these sets. Full diff: https://github.com/llvm/llvm-project/pull/133749.diff 2 Files Affected:
diff --git a/clang/test/C/C11/n1518.c b/clang/test/C/C11/n1518.c
new file mode 100644
index 0000000000000..7b11e09ee819f
--- /dev/null
+++ b/clang/test/C/C11/n1518.c
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -verify=c11 -std=c11 %s
+// RUN: %clang_cc1 -verify=c23 -std=c23 %s
+
+/* WG14 N1518: Clang 15
+ * Recommendations for extended identifier characters for C and C++
+ *
+ * This paper effectively adopts UAX #31, which was later officially adopted
+ * for C23 via WG14 N2836 and supersedes N1518.
+ */
+
+// This file takes test cases from clang/test/C/C23/n2836_n2939.c.
+// This file contains Unicode characters; please do not "fix" them!
+
+// This was fine in C11, is now an error in C23.
+extern int ٢; // c23-error {{character <U+0662> not allowed at the start of an identifier}} \
+ c23-warning {{declaration does not declare anything}}
+
+// This was an error in C11 but is an extension in C23.
+extern int ∞; // c11-error {{unexpected character <U+221E>}} \
+ c11-warning {{declaration does not declare anything}} \
+ c23-warning {{mathematical notation character <U+221E> in an identifier is a Clang extension}}
diff --git a/clang/www/c_status.html b/clang/www/c_status.html
index f4f00ac6dd808..8434ed9ecf6f8 100644
--- a/clang/www/c_status.html
+++ b/clang/www/c_status.html
@@ -1105,7 +1105,7 @@ <h2 id="c11">C11 implementation status</h2>
<tr>
<td>Recommendations for extended identifier characters for C and C++</td>
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1518.htm">N1518</a></td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Clang 15</td>
</tr>
<tr>
<td>Atomic C1x/C++0x compatibility refinements (1st part only)</td>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with an extra test suggestion
// This was an error in C11 but is an extension in C23. | ||
extern int ∞; // c11-error {{unexpected character <U+221E>}} \ | ||
c11-warning {{declaration does not declare anything}} \ | ||
c23-warning {{mathematical notation character <U+221E> in an identifier is a Clang extension}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a test that int \u1DC0 is not valid but e\u1DC0 is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/15269 Here is the relevant piece of the build log for the reference
|
This paper introduced ranges of valid start and continuation characters for identifiers. C23 made further changes to these sets.
This paper introduced ranges of valid start and continuation characters for identifiers. C23 made further changes to these sets.