mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-11-15 07:06:05 +00:00
Give an error if you try to define a macro to + or - on the command line.
This affects command lines like: cmpl myprog.c cc=(-da=+) ... Previously, this would be accepted, but a was actually defined to 0 rather than +. Now, this gives an error, consistent with other tokens that are not supported in such definitions on the command line. (Perhaps we should support definitions using any tokens, but that would require bigger code changes.) This also cleans up some related code to avoid possible null-pointer dereferences.
This commit is contained in:
parent
32b0d53b07
commit
4a95dbc597
22
Scanner.pas
22
Scanner.pas
@ -3853,6 +3853,10 @@ repeat
|
||||
bp := pointer(ord4(macros) + hash(mp^.name));
|
||||
mp^.next := bp^;
|
||||
bp^ := mp;
|
||||
token.kind := intconst; {create the default value}
|
||||
token.numString := nil;
|
||||
token.class := intConstant;
|
||||
token.ival := 1;
|
||||
if lch = '=' then begin
|
||||
NextCh; {record the value}
|
||||
token.numString := nil;
|
||||
@ -3876,12 +3880,8 @@ repeat
|
||||
otherwise: ;
|
||||
end; {case}
|
||||
end {if}
|
||||
else begin
|
||||
token.kind := intconst;
|
||||
token.numString := nil;
|
||||
token.class := intConstant;
|
||||
token.ival := 0;
|
||||
end; {else}
|
||||
else
|
||||
Error(108);
|
||||
end {else if}
|
||||
else if lch in ['.','0'..'9'] then begin
|
||||
token.name := GetWord;
|
||||
@ -3891,17 +3891,11 @@ repeat
|
||||
GetString
|
||||
else
|
||||
Error(108);
|
||||
end {if}
|
||||
else begin
|
||||
token.kind := intconst; {create the default value}
|
||||
token.numString := nil;
|
||||
token.class := intConstant;
|
||||
token.ival := 1;
|
||||
end; {else}
|
||||
end; {if}
|
||||
new(mp^.tokens); {add the value to the definition}
|
||||
with mp^.tokens^ do begin
|
||||
next := nil;
|
||||
tokenString := nil;
|
||||
tokenString := @'';
|
||||
expandEnabled := true;
|
||||
tokenStart := nil;
|
||||
tokenEnd := nil;
|
||||
|
Loading…
Reference in New Issue
Block a user