Sfoglia il codice sorgente

* fix for Mantis #27378: save and (more importantly) restore verbosity when switching a unit
+ added test

git-svn-id: trunk@40750 -

svenbarth 6 anni fa
parent
commit
04bbfd1746
5 ha cambiato i file con 45 aggiunte e 1 eliminazioni
  1. 3 0
      .gitattributes
  2. 4 1
      compiler/globstat.pas
  3. 14 0
      tests/webtbf/tw27378.pp
  4. 13 0
      tests/webtbf/uw27378a.pp
  5. 11 0
      tests/webtbf/uw27378b.pp

+ 3 - 0
.gitattributes

@@ -14683,6 +14683,7 @@ tests/webtbf/tw26704.pp svneol=native#text/plain
 tests/webtbf/tw2719.pp svneol=native#text/plain
 tests/webtbf/tw2721.pp svneol=native#text/plain
 tests/webtbf/tw2724.pp svneol=native#text/plain
+tests/webtbf/tw27378.pp svneol=native#text/pascal
 tests/webtbf/tw2739.pp svneol=native#text/plain
 tests/webtbf/tw2751.pp svneol=native#text/plain
 tests/webtbf/tw2752.pp svneol=native#text/plain
@@ -14895,6 +14896,8 @@ tests/webtbf/uw0840b.pp svneol=native#text/plain
 tests/webtbf/uw0856.pp svneol=native#text/plain
 tests/webtbf/uw2414.pp svneol=native#text/plain
 tests/webtbf/uw25283.pp svneol=native#text/plain
+tests/webtbf/uw27378a.pp svneol=native#text/pascal
+tests/webtbf/uw27378b.pp svneol=native#text/pascal
 tests/webtbf/uw3450.pp svneol=native#text/plain
 tests/webtbf/uw3969.pp svneol=native#text/plain
 tests/webtbf/uw4103.pp svneol=native#text/plain

+ 4 - 1
compiler/globstat.pas

@@ -60,6 +60,7 @@ type
     old_settings : tsettings;
     old_switchesstatestack : tswitchesstatestack;
     old_switchesstatestackpos : Integer;
+    old_verbosity : longint;
 
   { only saved/restored if "full" is true }
     old_asmdata : tasmdata;
@@ -74,7 +75,7 @@ procedure restore_global_state(const state:tglobalstate;full:boolean);
 implementation
 
 uses
-  pbase;
+  pbase,comphook;
 
   procedure save_global_state(out state:tglobalstate;full:boolean);
     begin
@@ -106,6 +107,7 @@ uses
           //flushpendingswitchesstate;
           oldcurrent_filepos:=current_filepos;
           old_settings:=current_settings;
+          old_verbosity:=status.verbosity;
 
           if full then
             begin
@@ -142,6 +144,7 @@ uses
           current_procinfo:=oldcurrent_procinfo;
           current_filepos:=oldcurrent_filepos;
           current_settings:=old_settings;
+          status.verbosity:=old_verbosity;
 
           if full then
             begin

+ 14 - 0
tests/webtbf/tw27378.pp

@@ -0,0 +1,14 @@
+{ %FAIL }
+{ %OPT=-B -Sen }
+
+{ we want the "Local variable "Var2" not used" hint as an error; if we don't
+  get the error then resetting the verbosity when switching the unit failed }
+
+program tw27378;
+
+uses
+  uw27378a, uw27378b;
+
+begin
+
+end.

+ 13 - 0
tests/webtbf/uw27378a.pp

@@ -0,0 +1,13 @@
+unit uw27378a;
+
+interface
+
+{$NOTES OFF}
+
+implementation
+
+var
+  Var1: Boolean;
+
+end.
+

+ 11 - 0
tests/webtbf/uw27378b.pp

@@ -0,0 +1,11 @@
+unit uw27378b;
+
+interface
+
+implementation
+
+var
+  Var2: Boolean;
+
+end.
+