mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-03-06 06:29:57 +00:00
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:
parent
fd0b4920f6
commit
08f1380d21
@ -31,7 +31,7 @@ typedef char *__va_list[2];
|
|||||||
|
|
||||||
typedef __va_list va_list;
|
typedef __va_list va_list;
|
||||||
#define va_end(ap) __record_va_info(ap)
|
#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))
|
#define va_start(ap,...) ((void) ((ap)[0] = (char *)__orcac_va_info[1], (ap)[1] = (char *)&__orcac_va_info))
|
||||||
#else
|
#else
|
||||||
#define va_start(ap,LastFixedParm) ((void) ((ap)[0] = (char *)__orcac_va_info[1], (ap)[1] = (char *)&__orcac_va_info))
|
#define va_start(ap,LastFixedParm) ((void) ((ap)[0] = (char *)__orcac_va_info[1], (ap)[1] = (char *)&__orcac_va_info))
|
||||||
|
@ -2786,7 +2786,7 @@ if token.kind = commach then begin
|
|||||||
NextToken;
|
NextToken;
|
||||||
Match(stringconst, 83);
|
Match(stringconst, 83);
|
||||||
end {if}
|
end {if}
|
||||||
else if cStd < c23 then
|
else if (cStd < c23) and strictMode then
|
||||||
Error(86);
|
Error(86);
|
||||||
Match(rparench, 12);
|
Match(rparench, 12);
|
||||||
Match(semicolonch, 22);
|
Match(semicolonch, 22);
|
||||||
|
@ -1591,7 +1591,7 @@ else if kind1 = colonch then begin
|
|||||||
tk1.isDigraph := true;
|
tk1.isDigraph := true;
|
||||||
goto 1;
|
goto 1;
|
||||||
end {if}
|
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;
|
tk1.kind := coloncolonsy;
|
||||||
goto 1;
|
goto 1;
|
||||||
end; {else if}
|
end; {else if}
|
||||||
@ -1993,7 +1993,7 @@ if macro^.parameters >= 0 then begin {find the values of the parameters}
|
|||||||
NextToken;
|
NextToken;
|
||||||
done := false;
|
done := false;
|
||||||
end {if}
|
end {if}
|
||||||
else if (cStd >= c23)
|
else if ((cStd >= c23) or not strictMode)
|
||||||
and macro^.isVarargs
|
and macro^.isVarargs
|
||||||
and (token.kind = rparench)
|
and (token.kind = rparench)
|
||||||
and (paramCount = macro^.parameters - 1) then
|
and (paramCount = macro^.parameters - 1) then
|
||||||
@ -4334,7 +4334,7 @@ ucnString[0] := chr(i - 1);
|
|||||||
if (codePoint < 0) or (codePoint > maxUCSCodePoint)
|
if (codePoint < 0) or (codePoint > maxUCSCodePoint)
|
||||||
or ((codePoint >= $00D800) and (codePoint <= $00DFFF))
|
or ((codePoint >= $00D800) and (codePoint <= $00DFFF))
|
||||||
or ((codePoint < $A0) and not (ord(codePoint) in [$24,$40,$60])
|
or ((codePoint < $A0) and not (ord(codePoint) in [$24,$40,$60])
|
||||||
and (cStd < c23))
|
and (cStd < c23) and strictMode)
|
||||||
then begin
|
then begin
|
||||||
Error(145);
|
Error(145);
|
||||||
UniversalCharacterName := $0000C0;
|
UniversalCharacterName := $0000C0;
|
||||||
@ -5785,7 +5785,7 @@ case charKinds[ord(ch)] of
|
|||||||
token.isDigraph := true;
|
token.isDigraph := true;
|
||||||
NextCh;
|
NextCh;
|
||||||
end
|
end
|
||||||
else if (ch = ':') and (cStd >= c23) then begin
|
else if (ch = ':') and ((cStd >= c23) or not strictMode) then begin
|
||||||
token.kind := coloncolonsy;
|
token.kind := coloncolonsy;
|
||||||
NextCh;
|
NextCh;
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user