Browse Source

* Restore messages state

Michaël Van Canneyt 1 year ago
parent
commit
9cc30829fa
1 changed files with 12 additions and 2 deletions
  1. 12 2
      compiler/globstat.pas

+ 12 - 2
compiler/globstat.pas

@@ -81,7 +81,7 @@ procedure restore_global_state(state:tglobalstate;full:boolean);
 implementation
 implementation
 
 
 uses
 uses
-  pbase,comphook;
+  switches, verbose, pbase,comphook;
 
 
 var
 var
   states : array of tglobalstate;
   states : array of tglobalstate;
@@ -159,6 +159,14 @@ var
       oldidtoken:=idtoken;
       oldidtoken:=idtoken;
       old_block_type:=block_type;
       old_block_type:=block_type;
       oldtokenpos:=current_tokenpos;
       oldtokenpos:=current_tokenpos;
+      {
+        consuming the semicolon after a uses clause can add to the
+        pending state if the first directives change warning state.
+        So we must flush before context switch. See for example:
+        ppcgen/cgppc.pas
+        line 144 has a WARN 6018 OFF...
+      }
+      flushpendingswitchesstate;
       old_switchesstatestack:=switchesstatestack;
       old_switchesstatestack:=switchesstatestack;
       old_switchesstatestackpos:=switchesstatestackpos;
       old_switchesstatestackpos:=switchesstatestackpos;
 
 
@@ -167,7 +175,6 @@ var
 
 
       { save akt... state }
       { save akt... state }
       { handle the postponed case first }
       { handle the postponed case first }
-      //flushpendingswitchesstate;
       oldcurrent_filepos:=current_filepos;
       oldcurrent_filepos:=current_filepos;
       old_settings:=current_settings;
       old_settings:=current_settings;
       old_verbosity:=status.verbosity;
       old_verbosity:=status.verbosity;
@@ -205,6 +212,9 @@ var
       current_filepos:=oldcurrent_filepos;
       current_filepos:=oldcurrent_filepos;
       current_settings:=old_settings;
       current_settings:=old_settings;
       status.verbosity:=old_verbosity;
       status.verbosity:=old_verbosity;
+      { restore message settings which were recorded prior to unit switch }
+
+      RestoreLocalVerbosity(current_settings.pmessage);
 
 
       if full then
       if full then
         begin
         begin