Skip to content

Commit aa04be1

Browse files
committed
Implement UAX31's quick check algorithm
1 parent e397d5e commit aa04be1

23 files changed

+2331
-4372
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Identifiers are verifiable against normalization form C
2+
3+
It is now possible to verify identifiers against normalization form C, as per UAX31 and C23.
4+
5+
The quick check algorithm that is in use is an incomplete form that does not handle maybes and can result in false positives in errors.
6+
The purpose of this algorithm in its incomplete state is to minimize normalization in a future update.
7+
8+
It is configurable for both D and ImportC using ``-normalization=<strategy>`` and ``-normalization-importc=<strategy>``.
9+
Using the options ``ignore``, ``deprecate``, ``warn``, and ``error``.
10+
11+
Unless you use non-ASCII characters, this change will not affect you.

compiler/src/dmd/cli.d

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,26 @@ dmd -cov -unittest myprog.d
639639
`Turns off all array bounds checking, even for safe functions. $(RED Deprecated
640640
(use $(TT $(SWLINK -boundscheck)=off) instead).)`,
641641
),
642+
Option("normalization=<strategy>",
643+
"Specify what to do when an identifier is not normalized",
644+
`The strategy that will be used when an identifier may not be normalized (quick check algorithm).
645+
$(UL
646+
$(LI $(I ignore): Silently accept any failing identifiers (default))
647+
$(LI $(I deprecate): Emit a deprecation but accept)
648+
$(LI $(I warn): Emit a warning but accept)
649+
$(LI $(I error): Emit an error and fail)
650+
)`
651+
),
652+
Option("normalization-importc=<strategy>",
653+
"Specify what to do when an identifier is not normalized",
654+
`The strategy that will be used when an identifier may not be normalized (quick check algorithm).
655+
$(UL
656+
$(LI $(I ignore): Silently accept any failing identifiers (default))
657+
$(LI $(I deprecate): Emit a deprecation but accept)
658+
$(LI $(I warn): Emit a warning but accept)
659+
$(LI $(I error): Emit an error and fail)
660+
)`
661+
),
642662
Option("nothrow",
643663
"assume no Exceptions will be thrown",
644664
`Turns off generation of exception stack unwinding code, enables

0 commit comments

Comments
 (0)