Skip to content

[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

Merged
merged 2 commits into from
Apr 1, 2025

Conversation

AaronBallman
Copy link
Collaborator

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.
@AaronBallman AaronBallman added clang Clang issues not falling into any other category website c11 clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Mar 31, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 31, 2025

@llvm/pr-subscribers-clang

Author: Aaron Ballman (AaronBallman)

Changes

This 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:

  • (added) clang/test/C/C11/n1518.c (+21)
  • (modified) clang/www/c_status.html (+1-1)
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>

Copy link
Contributor

@cor3ntin cor3ntin left a 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}}
Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@AaronBallman AaronBallman merged commit 66b540d into llvm:main Apr 1, 2025
6 of 9 checks passed
@AaronBallman AaronBallman deleted the aballman-wg14-n1518 branch April 1, 2025 15:46
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 1, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building clang at step 6 "test".

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
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: functionalities/stats_api/TestStatisticsAPI.py (585 of 2111)
PASS: lldb-api :: functionalities/gdb_remote_client/TestPlatformClient.py (586 of 2111)
PASS: lldb-api :: functionalities/reverse-execution/TestReverseContinueBreakpoints.py (587 of 2111)
PASS: lldb-api :: functionalities/step-avoids-regexp/TestStepAvoidsRegexp.py (588 of 2111)
PASS: lldb-api :: functionalities/signal/raise/TestRaise.py (589 of 2111)
PASS: lldb-api :: functionalities/step-avoids-no-debug/TestStepNoDebug.py (590 of 2111)
PASS: lldb-api :: functionalities/step_scripted/TestStepScripted.py (591 of 2111)
PASS: lldb-api :: functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py (592 of 2111)
PASS: lldb-api :: functionalities/recursion/TestValueObjectRecursion.py (593 of 2111)
PASS: lldb-api :: functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py (594 of 2111)
FAIL: lldb-api :: functionalities/stop-on-sharedlibrary-load/TestStopOnSharedlibraryEvents.py (595 of 2111)
******************** TEST 'lldb-api :: functionalities/stop-on-sharedlibrary-load/TestStopOnSharedlibraryEvents.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/stop-on-sharedlibrary-load -p TestStopOnSharedlibraryEvents.py
--
Exit Code: -11

Command Output (stdout):
--
lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision 66b540d861ecc5fef0fc398c9c3590c3a7dc6ff9)
  clang revision 66b540d861ecc5fef0fc398c9c3590c3a7dc6ff9
  llvm revision 66b540d861ecc5fef0fc398c9c3590c3a7dc6ff9
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_auto_continue (TestStopOnSharedlibraryEvents.TestStopOnSharedlibraryEvents)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_continue_callback (TestStopOnSharedlibraryEvents.TestStopOnSharedlibraryEvents)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_failing_condition (TestStopOnSharedlibraryEvents.TestStopOnSharedlibraryEvents)
PASS: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_stopping_breakpoints (TestStopOnSharedlibraryEvents.TestStopOnSharedlibraryEvents)
----------------------------------------------------------------------
Ran 4 tests in 2.039s

OK

--

********************
XFAIL: lldb-api :: functionalities/tail_call_frames/cross_dso/TestCrossDSOTailCalls.py (596 of 2111)
XFAIL: lldb-api :: functionalities/tail_call_frames/cross_object/TestCrossObjectTailCalls.py (597 of 2111)
PASS: lldb-api :: functionalities/step-vrs-interrupt/TestStepVrsInterruptTimeout.py (598 of 2111)
PASS: lldb-api :: functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py (599 of 2111)
PASS: lldb-api :: functionalities/tail_call_frames/sbapi_support/TestTailCallFrameSBAPI.py (600 of 2111)
PASS: lldb-api :: functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py (601 of 2111)
PASS: lldb-api :: functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py (602 of 2111)
PASS: lldb-api :: functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py (603 of 2111)
PASS: lldb-api :: functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py (604 of 2111)

Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this pull request Apr 2, 2025
This paper introduced ranges of valid start and continuation characters
for identifiers. C23 made further changes to these sets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c11 clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category website
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants