Add an option to print file names in error messages.

This can help identify if an error is in the main source file or an include file.
This commit is contained in:
Stephen Heumann 2022-02-04 22:10:50 -06:00
parent 4cb2106ee4
commit 7322428e1d
4 changed files with 21 additions and 0 deletions

1
CC.pas
View File

@ -56,6 +56,7 @@ sourceFileGS := includeFileGS;
doingPartial := partialFileGS.theString.size <> 0;
with liDCBGS do begin
enterEditor := pFlags & flag_e <> 0; {enter editor on terminal errors?}
filenamesInErrors := pFlags & flag_f <> 0; {filenames in error messages?}
ignoreSymbols := mFlags & flag_i <> 0; {ignore symbol file?}
list := pFlags & flag_l <> 0; {list the source file?}
memoryCompile := pflags & flag_m <> 0; {memory based compile?}

View File

@ -98,6 +98,7 @@ const
{----------------------------}
flag_d = $10000000; {generate debug code?}
flag_e = $08000000; {abort to editor on terminal error?}
flag_f = $04000000; {print filenames in error messages?}
flag_i = $00800000; {ignore symbol files?}
flag_l = $00100000; {list source lines?}
flag_m = $00080000; {memory based compile?}
@ -521,6 +522,7 @@ var
doingFunction: boolean; {are we processing a function?}
doingPartial: boolean; {are we doing a partial compile?}
enterEditor: boolean; {enter editor on terminal errors?}
filenamesInErrors: boolean; {print filenames in error messages?}
foundFunction: boolean; {has a function been found?}
lint: integer; {lint flags}
list: boolean; {generate source listing?}

View File

@ -542,6 +542,9 @@ var
begin {WriteLine}
if list or (numErr <> 0) then begin
if not wroteLine and not doingCommandLine then begin
if numErr <> 0 then
if filenamesInErrors then
writeln('In ',sourceFileGS.theString.theString,':');
write(lineNumber:4, ' '); {write the line #}
cp := firstPtr; {write the characters in the line}
while (cp <> eofPtr) and (charKinds[ord(cp^)] <> ch_eol) do begin
@ -1135,6 +1138,8 @@ if len > 255 then
pstr^[0] := chr(len);
for i := 1 to len do
pstr^[i] := lstr^.str[i];
if len < 255 then
pstr^[len+1] := chr(0);
end; {LongToPString}

View File

@ -44,6 +44,9 @@ Updated by Stephen Heumann and Kelvin Sherlock, 2017-2022
14. New bit added to control floating-point optimizations that may
violate the IEEE standard. See "Floating-Point Optimizations."
15. New option to print file names in error messages. See
"File Names in Error Messages."
2.1.1 B3 1. Bugs squashed. See bug notes, below.
2.1.0 1. Bugs squashed. See bug notes, below.
@ -111,6 +114,10 @@ p. 107
The table shows the language number for C as 7. It should be 8.
p. 128
The ASML, ASMLG, ASSEMBLE, CMPL, CMPLG, COMPILE, and RUN commands now accept a new flag, +F. The +F flag causes the compiler to include the file name in any error messages that it prints. It is currently only effective for ORCA/C.
p. 233
Identifiers may now contain universal character names, a type of escape sequence that can denote a Unicode character. See "New Language Features," below.
@ -621,6 +628,12 @@ ORCA/C can now detect several elements of C syntax that were allowed in C89 but
If #pragma lint bit 7 (a value of 128) is set, ORCA/C detects some situations where a function with a non-void return type may return an unpredictable value, either by executing a return statement with no value or by executing to the end of the function with no return statement. (The former case is also detected by #pragma lint bit 6.) It also detects some situations where a _Noreturn function could return. Note that these checks only detect some cases of these problems, not all of them. Also, they may report a potential problem in some situations where the code at the end of a function is not actually reachable.
File Names in Error Messages
----------------------------
When ORCA/C prints out error messages, it can now optionally include the name of the file containing the error. This can help you to understand whether an error is in the main source file or an include file. To enable this option, use the new +F flag to the ASML, ASMLG, ASSEMBLE, CMPL, CMPLG, COMPILE, or RUN commands.
Locales
-------