From 04bbfd174633f7e1131b85d59b1f3ab6c76ed1f5 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Thu, 3 Jan 2019 20:31:34 +0000 Subject: [PATCH] * fix for Mantis #27378: save and (more importantly) restore verbosity when switching a unit + added test git-svn-id: trunk@40750 - --- .gitattributes | 3 +++ compiler/globstat.pas | 5 ++++- tests/webtbf/tw27378.pp | 14 ++++++++++++++ tests/webtbf/uw27378a.pp | 13 +++++++++++++ tests/webtbf/uw27378b.pp | 11 +++++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tests/webtbf/tw27378.pp create mode 100644 tests/webtbf/uw27378a.pp create mode 100644 tests/webtbf/uw27378b.pp diff --git a/.gitattributes b/.gitattributes index dd7c8c2895..01f5cb6512 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/globstat.pas b/compiler/globstat.pas index 124a9f0d8c..5774572b16 100644 --- a/compiler/globstat.pas +++ b/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 diff --git a/tests/webtbf/tw27378.pp b/tests/webtbf/tw27378.pp new file mode 100644 index 0000000000..c03f8744c0 --- /dev/null +++ b/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. diff --git a/tests/webtbf/uw27378a.pp b/tests/webtbf/uw27378a.pp new file mode 100644 index 0000000000..4f51369ae6 --- /dev/null +++ b/tests/webtbf/uw27378a.pp @@ -0,0 +1,13 @@ +unit uw27378a; + +interface + +{$NOTES OFF} + +implementation + +var + Var1: Boolean; + +end. + diff --git a/tests/webtbf/uw27378b.pp b/tests/webtbf/uw27378b.pp new file mode 100644 index 0000000000..24ec13bc6e --- /dev/null +++ b/tests/webtbf/uw27378b.pp @@ -0,0 +1,11 @@ +unit uw27378b; + +interface + +implementation + +var + Var2: Boolean; + +end. +