mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-05-29 04:41:27 +00:00
Always interpret the digit sequence in #line as decimal.
This is what the standards call for.
This commit is contained in:
parent
e3a3548443
commit
81353a9f8a
30
Scanner.pas
30
Scanner.pas
|
@ -245,6 +245,7 @@ var
|
||||||
customDefaultName: stringPtr; {name of custom pre-included default file}
|
customDefaultName: stringPtr; {name of custom pre-included default file}
|
||||||
dateStr: longStringPtr; {macro date string}
|
dateStr: longStringPtr; {macro date string}
|
||||||
doingCommandLine: boolean; {are we processing the cc= command line?}
|
doingCommandLine: boolean; {are we processing the cc= command line?}
|
||||||
|
doingDigitSequence: boolean; {do we want a digit sequence (for #line)?}
|
||||||
doingPPExpression: boolean; {are we processing a preprocessor expression?}
|
doingPPExpression: boolean; {are we processing a preprocessor expression?}
|
||||||
doingStringOrCharacter: boolean; {used to suppress comments in strings}
|
doingStringOrCharacter: boolean; {used to suppress comments in strings}
|
||||||
errors: array[1..maxErr] of errorType; {errors in this line}
|
errors: array[1..maxErr] of errorType; {errors in this line}
|
||||||
|
@ -772,6 +773,7 @@ if list or (numErr <> 0) then begin
|
||||||
177: msg := @'_Thread_local may not be used with the specified storage class';
|
177: msg := @'_Thread_local may not be used with the specified storage class';
|
||||||
178: msg := @'_Thread_local may not appear in a function declaration';
|
178: msg := @'_Thread_local may not appear in a function declaration';
|
||||||
179: msg := @'_Pragma requires one string literal argument';
|
179: msg := @'_Pragma requires one string literal argument';
|
||||||
|
180: msg := @'decimal digit sequence expected';
|
||||||
otherwise: Error(57);
|
otherwise: Error(57);
|
||||||
end; {case}
|
end; {case}
|
||||||
writeln(msg^);
|
writeln(msg^);
|
||||||
|
@ -2411,6 +2413,7 @@ label 2;
|
||||||
var
|
var
|
||||||
lSuppressMacroExpansions: boolean; {local copy of suppressMacroExpansions}
|
lSuppressMacroExpansions: boolean; {local copy of suppressMacroExpansions}
|
||||||
lReportEOL: boolean; {local copy of reportEOL}
|
lReportEOL: boolean; {local copy of reportEOL}
|
||||||
|
lSaveNumber: boolean; {local copy of saveNumber}
|
||||||
tSkipping: boolean; {temp copy of the skipping variable}
|
tSkipping: boolean; {temp copy of the skipping variable}
|
||||||
val: integer; {expression value}
|
val: integer; {expression value}
|
||||||
nextLineNumber: longint; {number for next line}
|
nextLineNumber: longint; {number for next line}
|
||||||
|
@ -3286,17 +3289,26 @@ if ch in ['a','d','e','i','l','p','u','w'] then begin
|
||||||
if token.name^ = 'line' then begin
|
if token.name^ = 'line' then begin
|
||||||
if tskipping then goto 2;
|
if tskipping then goto 2;
|
||||||
FlagPragmas(p_line);
|
FlagPragmas(p_line);
|
||||||
|
lsaveNumber := saveNumber;
|
||||||
|
saveNumber := true;
|
||||||
|
doingDigitSequence := true;
|
||||||
NextToken;
|
NextToken;
|
||||||
if token.kind = intconst then begin
|
doingDigitSequence := false;
|
||||||
nextLineNumber := token.ival;
|
saveNumber := lsaveNumber;
|
||||||
NextToken;
|
if token.kind in [intconst,longconst] then begin
|
||||||
end {if}
|
nextLineNumber := 0;
|
||||||
else if token.kind = longconst then begin
|
for val := 1 to ord(token.numString^[0]) do begin
|
||||||
nextLineNumber := token.lval;
|
if not (token.numString^[val] in ['0'..'9']) then begin
|
||||||
|
Error(180);
|
||||||
|
goto 2;
|
||||||
|
end; {if}
|
||||||
|
nextLineNumber := nextLineNumber * 10 +
|
||||||
|
ord(token.numString^[val]) - ord('0');
|
||||||
|
end; {for}
|
||||||
NextToken;
|
NextToken;
|
||||||
end {if}
|
end {if}
|
||||||
else
|
else
|
||||||
Error(18);
|
Error(180);
|
||||||
if (token.kind = stringconst)
|
if (token.kind = stringconst)
|
||||||
and (token.prefix = prefix_none) then begin
|
and (token.prefix = prefix_none) then begin
|
||||||
LongToPString(
|
LongToPString(
|
||||||
|
@ -3962,7 +3974,8 @@ else begin {hex, octal, & binary}
|
||||||
end {if}
|
end {if}
|
||||||
else begin
|
else begin
|
||||||
if numString[i] in ['8','9'] then
|
if numString[i] in ['8','9'] then
|
||||||
FlagError(7);
|
if not doingDigitSequence then
|
||||||
|
FlagError(7);
|
||||||
ShiftAndOrValue(3, ord(numString[i]) & $0007);
|
ShiftAndOrValue(3, ord(numString[i]) & $0007);
|
||||||
i := i+1;
|
i := i+1;
|
||||||
end; {else}
|
end; {else}
|
||||||
|
@ -4330,6 +4343,7 @@ mergingStrings := false; {not currently merging strings}
|
||||||
customDefaultName := nil; {no custom default name}
|
customDefaultName := nil; {no custom default name}
|
||||||
pragmaKeepFile := nil; {no #pragma keep file so far}
|
pragmaKeepFile := nil; {no #pragma keep file so far}
|
||||||
doingFakeFile := false; {not doing a fake file}
|
doingFakeFile := false; {not doing a fake file}
|
||||||
|
doingDigitSequence := false; {not expecting a digit sequence}
|
||||||
|
|
||||||
{error codes for lint messages}
|
{error codes for lint messages}
|
||||||
{if changed, also change maxLint}
|
{if changed, also change maxLint}
|
||||||
|
|
2
cc.notes
2
cc.notes
|
@ -1944,6 +1944,8 @@ int foo(int[42]);
|
||||||
|
|
||||||
214. If the #line directive was used, line numbering would be off by one when using a .sym file.
|
214. If the #line directive was used, line numbering would be off by one when using a .sym file.
|
||||||
|
|
||||||
|
215. The digit sequence in the #line directive should be interpreted as a decimal number (not octal) even if it begins with a 0.
|
||||||
|
|
||||||
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
-- Bugs from C 2.1.0 that have been fixed -----------------------------------
|
||||||
|
|
||||||
1. In some situations, fread() reread the first 1K or so of the file.
|
1. In some situations, fread() reread the first 1K or so of the file.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user