mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-10-31 17:04:42 +00:00
Add a new #pragma ignore option to treat char and unsigned char as compatible.
This is contrary to the C standards, but ORCA/C historically permitted it (as do some other compilers), and I think there is a fair amount of existing code that relies on it.
This commit is contained in:
parent
5d64436e6e
commit
f0a3808c18
@ -872,7 +872,8 @@ procedure EndInclude {chPtr: ptr};
|
|||||||
| (ord(allowLongIntChar) << 1)
|
| (ord(allowLongIntChar) << 1)
|
||||||
| (ord(allowTokensAfterEndif) << 2)
|
| (ord(allowTokensAfterEndif) << 2)
|
||||||
| (ord(allowSlashSlashComments) << 3)
|
| (ord(allowSlashSlashComments) << 3)
|
||||||
| (ord(allowMixedDeclarations) << 4));
|
| (ord(allowMixedDeclarations) << 4)
|
||||||
|
| (ord(looseCharTypeChecks) << 5));
|
||||||
|
|
||||||
p_segment: begin
|
p_segment: begin
|
||||||
for i := 1 to 10 do begin
|
for i := 1 to 10 do begin
|
||||||
@ -1524,6 +1525,7 @@ var
|
|||||||
allowSlashSlashComments := odd(i >> 3);
|
allowSlashSlashComments := odd(i >> 3);
|
||||||
allowMixedDeclarations := odd(i >> 4);
|
allowMixedDeclarations := odd(i >> 4);
|
||||||
c99Scope := allowMixedDeclarations;
|
c99Scope := allowMixedDeclarations;
|
||||||
|
looseCharTypeChecks := odd(i >> 5);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
p_segment: begin
|
p_segment: begin
|
||||||
|
@ -89,6 +89,7 @@ var
|
|||||||
{Note: The following two are set together}
|
{Note: The following two are set together}
|
||||||
allowMixedDeclarations: boolean; {allow mixed declarations & stmts (C99)?}
|
allowMixedDeclarations: boolean; {allow mixed declarations & stmts (C99)?}
|
||||||
c99Scope: boolean; {follow C99 rules for block scopes?}
|
c99Scope: boolean; {follow C99 rules for block scopes?}
|
||||||
|
looseCharTypeChecks: boolean; {treat char and unsigned char as compatible?}
|
||||||
|
|
||||||
{---------------------------------------------------------------}
|
{---------------------------------------------------------------}
|
||||||
|
|
||||||
@ -2981,6 +2982,7 @@ if ch in ['a','d','e','i','l','p','u','w'] then begin
|
|||||||
allowTokensAfterEndif := odd(val >> 2);
|
allowTokensAfterEndif := odd(val >> 2);
|
||||||
allowSlashSlashComments := odd(val >> 3);
|
allowSlashSlashComments := odd(val >> 3);
|
||||||
allowMixedDeclarations := odd(val >> 4);
|
allowMixedDeclarations := odd(val >> 4);
|
||||||
|
looseCharTypeChecks := odd(val >> 5);
|
||||||
if allowMixedDeclarations <> c99Scope then begin
|
if allowMixedDeclarations <> c99Scope then begin
|
||||||
if doingFunction then
|
if doingFunction then
|
||||||
Error(126)
|
Error(126)
|
||||||
@ -3672,6 +3674,7 @@ allowTokensAfterEndif := false; {allow tokens after #endif}
|
|||||||
allowSlashSlashComments := true; {allow // comments}
|
allowSlashSlashComments := true; {allow // comments}
|
||||||
allowMixedDeclarations := true; {allow mixed declarations & stmts (C99)}
|
allowMixedDeclarations := true; {allow mixed declarations & stmts (C99)}
|
||||||
c99Scope := true; {follow C99 rules for block scopes}
|
c99Scope := true; {follow C99 rules for block scopes}
|
||||||
|
looseCharTypeChecks := true; {make char and unsigned char compatible}
|
||||||
foundFunction := false; {no functions found so far}
|
foundFunction := false; {no functions found so far}
|
||||||
fileList := nil; {no included files}
|
fileList := nil; {no included files}
|
||||||
gettingFileName := false; {not in GetFileName}
|
gettingFileName := false; {not in GetFileName}
|
||||||
|
11
Symbol.pas
11
Symbol.pas
@ -383,9 +383,14 @@ else
|
|||||||
case kind1 of
|
case kind1 of
|
||||||
|
|
||||||
scalarType:
|
scalarType:
|
||||||
if kind2 = scalarType then
|
if kind2 = scalarType then begin
|
||||||
CompTypes :=
|
CompTypes := t1^.baseType = t2^.baseType;
|
||||||
(t1^.baseType = t2^.baseType) and (t1^.cType = t2^.cType)
|
if t1^.cType <> t2^.cType then
|
||||||
|
if not (looseCharTypeChecks
|
||||||
|
and (t1^.cType in [ctChar, ctUChar])
|
||||||
|
and (t2^.cType in [ctChar, ctUChar])) then
|
||||||
|
CompTypes := false;
|
||||||
|
end {if}
|
||||||
else if kind2 = enumType then
|
else if kind2 = enumType then
|
||||||
CompTypes := (t1^.baseType = cgWord) and (t1^.cType = ctInt);
|
CompTypes := (t1^.baseType = cgWord) and (t1^.cType = ctInt);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user