[PATCH] D132877: Downgrade the UAX31 diagnostic to a warning which defaults to an error

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 29 11:20:33 PDT 2022


aaron.ballman created this revision.
aaron.ballman added reviewers: tahonermann, cor3ntin, clang-language-wg.
Herald added a project: All.
aaron.ballman requested review of this revision.
Herald added a project: clang.

WG21 P1949 <https://reviews.llvm.org/P1949> and WG14 N2836 were both adopted without any deprecation period for users who were making use of now-invalid characters in their identifiers. This caused some amount of pain for people, especially folks using mathematical symbols in their identifiers, which makes it hard to upgrade to newer Clang versions with this diagnostic as an error.

This patch downgrades the error to be a warning which defaults to an error. This continues to signal to users that the identifiers are in fact invalid, but it gives a grace period for people to update their code bases to the new rules (or, alternatively, time for the Unicode consortium to determine whether some of these characters should be allowed in an identifier in the immutable set). I am tentatively documenting that grace period as being until we ship Clang 18 (which should give users a year or two to migrate their code).

Note, because we implemented the UAX31 rules in Clang 14, I would like to try to land this patch and backport it to Clang 15 so that we avoid having *two* releases with no easy migration path for this subset of users. I think this is reasonable because we're not altering the implementation logic at all, just modifying what diagnostic kind is emitted by default. If someone has a concern about wanting to cherry pick this so late in the cycle, please share those concerns ASAP.

Fixes #54732


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132877

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/test/Preprocessor/utf8-allowed-chars.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132877.456413.patch
Type: text/x-patch
Size: 6847 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220829/89b8e67f/attachment.bin>


More information about the cfe-commits mailing list