From c96cf4f1dd43a50f7ffecc6c47e2722bc68fb034 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sun, 13 Feb 2022 20:17:33 -0600 Subject: [PATCH] Do not save predefined and command-line macros in the sym file. Previously, these might or might not be saved (based on the contents of uninitialized memory), but in many cases they were. This was unnecessary, since these macros are automatically defined when the scanner is initialized. Reading them from the sym file could result in duplicate copies of them in the macro list. This is usually harmless, but might result in #undefs of macros from the command line not working properly. --- Header.pas | 2 +- Scanner.pas | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Header.pas b/Header.pas index 9c3e27d..3dcde22 100644 --- a/Header.pas +++ b/Header.pas @@ -18,7 +18,7 @@ uses CCommon, MM, Scanner, Symbol, CGI; {$segment 'SCANNER'} const - symFileVersion = 22; {version number of .sym file format} + symFileVersion = 23; {version number of .sym file format} var inhibitHeader: boolean; {should .sym includes be blocked?} diff --git a/Scanner.pas b/Scanner.pas index 0d0d985..9aed3d7 100644 --- a/Scanner.pas +++ b/Scanner.pas @@ -4141,6 +4141,7 @@ mp^.name := @'__LINE__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 1; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4150,6 +4151,7 @@ mp^.name := @'__FILE__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 2; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4159,6 +4161,7 @@ mp^.name := @'__DATE__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 3; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4168,6 +4171,7 @@ mp^.name := @'__TIME__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 4; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4177,6 +4181,7 @@ mp^.name := @'__STDC__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 5; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4186,6 +4191,7 @@ mp^.name := @'__ORCAC__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 5; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4195,6 +4201,7 @@ mp^.name := @'__VERSION__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 6; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4204,6 +4211,7 @@ mp^.name := @'__STDC_UTF_16__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 5; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4213,6 +4221,7 @@ mp^.name := @'__STDC_UTF_32__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 5; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4222,6 +4231,7 @@ mp^.name := @'__ORCAC_HAS_LONG_LONG__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 5; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4231,6 +4241,7 @@ mp^.name := @'__STDC_NO_ATOMICS__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 5; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4240,6 +4251,7 @@ mp^.name := @'__STDC_NO_COMPLEX__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 5; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4249,6 +4261,7 @@ mp^.name := @'__STDC_NO_THREADS__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 5; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4258,6 +4271,7 @@ mp^.name := @'__STDC_NO_VLA__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 5; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4267,6 +4281,7 @@ mp^.name := @'__STDC_HOSTED__'; mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := true; +mp^.saved := true; mp^.algorithm := 7; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; @@ -4297,6 +4312,7 @@ repeat mp^.parameters := -1; mp^.tokens := nil; mp^.readOnly := false; + mp^.saved := true; bp := pointer(ord4(macros) + hash(mp^.name)); mp^.next := bp^; bp^ := mp;