summaryrefslogtreecommitdiff
path: root/compiler/switches.pas
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2008-11-03 21:18:27 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2008-11-03 21:18:27 +0000
commitb1b42155e3b45dce935adab290f8ddad1c144578 (patch)
tree3d99f4ecfa68a5d96361331daed234229b01f31c /compiler/switches.pas
parent92f3795a1ab31435750ef21be045f579ba8f84e5 (diff)
downloadfpc-b1b42155e3b45dce935adab290f8ddad1c144578.tar.gz
* delay verbosity changes just like localswitches changes
* store a node's verbosity in the node so that e.g. disabling warnings also disables warnings for this node in pass_1 (the above together fix mantis #12076) * save/restore verbosity with {$push}/{$pop} (mantis #12075) * if warnings/notes/hints are turned off, also do not count encountered ones for the totals (otherwise -Sew cannot be used properly in combination with {$warnings off}, because disabled warnings will still trigger a compiler error) -- this required adding -vw/-vn/-vh to all tests using -Sew/-Sen/-Seh - removed some superfluous state saving/restoring from firstpass() git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@12025 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/switches.pas')
-rw-r--r--compiler/switches.pas83
1 files changed, 72 insertions, 11 deletions
diff --git a/compiler/switches.pas b/compiler/switches.pas
index 6a90eac86d..31f7741a44 100644
--- a/compiler/switches.pas
+++ b/compiler/switches.pas
@@ -25,14 +25,23 @@ unit switches;
interface
+uses
+ globtype;
+
procedure HandleSwitch(switch,state:char);
function CheckSwitch(switch,state:char):boolean;
+procedure recordpendingverbosityswitch(sw: char; state: char);
+procedure recordpendinglocalswitch(sw: tlocalswitch; state: char);
+procedure recordpendinglocalfullswitch(const switches: tlocalswitches);
+procedure recordpendingverbosityfullswitch(verbosity: longint);
+procedure flushpendingswitchesstate;
implementation
uses
- globtype,systems,cpuinfo,
- globals,verbose,fmodule;
+ systems,cpuinfo,
+ globals,verbose,comphook,
+ fmodule;
{****************************************************************************
Main Switches Parsing
@@ -149,15 +158,7 @@ begin
unsupportedsw :
Message1(scan_w_unsupported_switch,'$'+switch);
localsw :
- begin
- if not localswitcheschanged then
- nextlocalswitches:=current_settings.localswitches;
- if state='+' then
- include(nextlocalswitches,tlocalswitch(setsw))
- else
- exclude(nextlocalswitches,tlocalswitch(setsw));
- localswitcheschanged:=true;
- end;
+ recordpendinglocalswitch(tlocalswitch(setsw),state);
modulesw :
begin
if current_module.in_global then
@@ -256,4 +257,64 @@ begin
end;
+procedure recordpendingverbosityswitch(sw: char; state: char);
+ begin
+ pendingstate.nextverbositystr:=pendingstate.nextverbositystr+sw+state;
+ end;
+
+
+procedure recordpendinglocalswitch(sw: tlocalswitch; state: char);
+ begin
+ if not pendingstate.localswitcheschanged then
+ pendingstate.nextlocalswitches:=current_settings.localswitches;
+ if state='-' then
+ exclude(pendingstate.nextlocalswitches,sw)
+ else if state='+' then
+ include(pendingstate.nextlocalswitches,sw)
+ else { state = '*' }
+ begin
+ if sw in init_settings.localswitches then
+ include(pendingstate.nextlocalswitches,sw)
+ else
+ exclude(pendingstate.nextlocalswitches,sw);
+ end;
+ pendingstate.localswitcheschanged:=true;
+ end;
+
+
+procedure recordpendinglocalfullswitch(const switches: tlocalswitches);
+ begin
+ pendingstate.nextlocalswitches:=switches;
+ pendingstate.localswitcheschanged:=true;
+ end;
+
+
+procedure recordpendingverbosityfullswitch(verbosity: longint);
+ begin
+ pendingstate.nextverbositystr:='';
+ pendingstate.nextverbosityfullswitch:=verbosity;
+ pendingstate.verbosityfullswitched:=true;
+ end;
+
+
+procedure flushpendingswitchesstate;
+ begin
+ if pendingstate.localswitcheschanged then
+ begin
+ current_settings.localswitches:=pendingstate.nextlocalswitches;
+ pendingstate.localswitcheschanged:=false;
+ end;
+ if pendingstate.verbosityfullswitched then
+ begin
+ status.verbosity:=pendingstate.nextverbosityfullswitch;
+ pendingstate.verbosityfullswitched:=false;
+ end;
+ if pendingstate.nextverbositystr<>'' then
+ begin
+ setverbosity(pendingstate.nextverbositystr);
+ pendingstate.nextverbositystr:='';
+ end;
+ end;
+
+
end.