Allow some C23 features in earlier compatibility modes.

Currently, this covers the following features, which should not cause compatibility problems:

-Recognize :: as a punctuator
-Allow one-argument _Static_assert
-Let variadic macro invocations omit final comma for empty varargs
-Define va_start() such that the second parameter is not required
-Allow UCNs less that \u00A0 in string literals and character constants
This commit is contained in:
Stephen Heumann 2024-09-14 15:24:53 -05:00
parent fd0b4920f6
commit 08f1380d21
3 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ typedef char *__va_list[2];
typedef __va_list va_list;
#define va_end(ap) __record_va_info(ap)
#if __STDC_VERSION__ >= 202311L
#if !defined(__KeepNamespacePure__) || __STDC_VERSION__ >= 202311L
#define va_start(ap,...) ((void) ((ap)[0] = (char *)__orcac_va_info[1], (ap)[1] = (char *)&__orcac_va_info))
#else
#define va_start(ap,LastFixedParm) ((void) ((ap)[0] = (char *)__orcac_va_info[1], (ap)[1] = (char *)&__orcac_va_info))

View File

@ -2786,7 +2786,7 @@ if token.kind = commach then begin
NextToken;
Match(stringconst, 83);
end {if}
else if cStd < c23 then
else if (cStd < c23) and strictMode then
Error(86);
Match(rparench, 12);
Match(semicolonch, 22);

View File

@ -1591,7 +1591,7 @@ else if kind1 = colonch then begin
tk1.isDigraph := true;
goto 1;
end {if}
else if (kind2 = colonch) and (cStd >= c23) then begin
else if (kind2 = colonch) and ((cStd >= c23) or not strictMode) then begin
tk1.kind := coloncolonsy;
goto 1;
end; {else if}
@ -1993,7 +1993,7 @@ if macro^.parameters >= 0 then begin {find the values of the parameters}
NextToken;
done := false;
end {if}
else if (cStd >= c23)
else if ((cStd >= c23) or not strictMode)
and macro^.isVarargs
and (token.kind = rparench)
and (paramCount = macro^.parameters - 1) then
@ -4334,7 +4334,7 @@ ucnString[0] := chr(i - 1);
if (codePoint < 0) or (codePoint > maxUCSCodePoint)
or ((codePoint >= $00D800) and (codePoint <= $00DFFF))
or ((codePoint < $A0) and not (ord(codePoint) in [$24,$40,$60])
and (cStd < c23))
and (cStd < c23) and strictMode)
then begin
Error(145);
UniversalCharacterName := $0000C0;
@ -5785,7 +5785,7 @@ case charKinds[ord(ch)] of
token.isDigraph := true;
NextCh;
end
else if (ch = ':') and (cStd >= c23) then begin
else if (ch = ':') and ((cStd >= c23) or not strictMode) then begin
token.kind := coloncolonsy;
NextCh;
end