Browse Source

* UpdateTargetSwitchStr moved from unit globals to unit options in order to
avoid the dependency of unit globals on unit symtable, which breaks the build
of ppudump

git-svn-id: trunk@25596 -

nickysn 12 năm trước cách đây
mục cha
commit
989c543ea2
3 tập tin đã thay đổi với 92 bổ sung94 xóa
  1. 1 92
      compiler/globals.pas
  2. 90 1
      compiler/options.pas
  3. 1 1
      compiler/scandir.pas

+ 1 - 92
compiler/globals.pas

@@ -532,7 +532,6 @@ interface
     function UpdateOptimizerStr(s:string;var a:toptimizerswitches):boolean;
     function UpdateWpoStr(s: string; var a: twpoptimizerswitches): boolean;
     function UpdateDebugStr(s:string;var a:tdebugswitches):boolean;
-    function UpdateTargetSwitchStr(s: string; var a: ttargetswitches; global: boolean): boolean;
     function IncludeFeature(const s : string) : boolean;
     function SetMinFPConstPrec(const s: string; var a: tfloattype) : boolean;
 
@@ -567,8 +566,7 @@ implementation
       windirs,
 {$endif VER2_4}
 {$endif}
-      comphook,
-      symtable;
+      comphook;
 
 {****************************************************************************
                                  TLinkStrMap
@@ -1392,95 +1390,6 @@ implementation
       end;
 
 
-    function UpdateTargetSwitchStr(s: string; var a: ttargetswitches; global: boolean): boolean;
-      var
-        tok,
-        value : string;
-        setstr: string[2];
-        equalspos: longint;
-        doset,
-        gotvalue,
-        found : boolean;
-        opt   : ttargetswitch;
-      begin
-        result:=true;
-        repeat
-          tok:=GetToken(s,',');
-          if tok='' then
-           break;
-          setstr:=upper(copy(tok,length(tok),1));
-          if setstr='-' then
-            begin
-              setlength(tok,length(tok)-1);
-              doset:=false;
-            end
-          else
-            doset:=true;
-          { value specified? }
-          gotvalue:=false;
-          equalspos:=pos('=',tok);
-          if equalspos<>0 then
-            begin
-              value:=copy(tok,equalspos+1,length(tok));
-              delete(tok,equalspos,length(tok));
-              gotvalue:=true;
-            end;
-          found:=false;
-          uppervar(tok);
-          for opt:=low(ttargetswitch) to high(ttargetswitch) do
-            begin
-              if TargetSwitchStr[opt].name=tok then
-                begin
-                  found:=true;
-                  break;
-                end;
-            end;
-          if found then
-            begin
-              if not global and
-                 TargetSwitchStr[opt].isglobal then
-                result:=false
-              else if not TargetSwitchStr[opt].hasvalue then
-                begin
-                  if gotvalue then
-                    result:=false;
-                  if (TargetSwitchStr[opt].define<>'') and (doset xor (opt in a)) then
-                    if doset then
-                      def_system_macro(TargetSwitchStr[opt].define)
-                    else
-                      undef_system_macro(TargetSwitchStr[opt].define);
-                  if doset then
-                    include(a,opt)
-                  else
-                    exclude(a,opt)
-                end
-              else
-                begin
-                  if not gotvalue or
-                     not doset then
-                    result:=false
-                  else
-                    begin
-                      case opt of
-                        ts_auto_getter_prefix:
-                          prop_auto_getter_prefix:=value;
-                        ts_auto_setter_predix:
-                          prop_auto_setter_prefix:=value;
-                        else
-                          begin
-                            writeln('Internalerror 2012053001');
-                            halt(1);
-                          end;
-                      end;
-                    end;
-                end;
-            end
-          else
-            result:=false;
-        until false;
-      end;
-
-
     function IncludeFeature(const s : string) : boolean;
       var
         i : tfeature;

+ 90 - 1
compiler/options.pas

@@ -79,9 +79,9 @@ Type
 var
   coption : TOptionClass;
 
+function UpdateTargetSwitchStr(s: string; var a: ttargetswitches; global: boolean): boolean;
 procedure read_arguments(cmd:TCmdStr);
 
-
 implementation
 
 uses
@@ -150,6 +150,95 @@ begin
   init_settings.globalswitches:=init_settings.globalswitches-[cs_link_shared,cs_link_smart];
 end;
 
+
+function UpdateTargetSwitchStr(s: string; var a: ttargetswitches; global: boolean): boolean;
+var
+  tok,
+  value : string;
+  setstr: string[2];
+  equalspos: longint;
+  doset,
+  gotvalue,
+  found : boolean;
+  opt   : ttargetswitch;
+begin
+  result:=true;
+  repeat
+    tok:=GetToken(s,',');
+    if tok='' then
+     break;
+    setstr:=upper(copy(tok,length(tok),1));
+    if setstr='-' then
+      begin
+        setlength(tok,length(tok)-1);
+        doset:=false;
+      end
+    else
+      doset:=true;
+    { value specified? }
+    gotvalue:=false;
+    equalspos:=pos('=',tok);
+    if equalspos<>0 then
+      begin
+        value:=copy(tok,equalspos+1,length(tok));
+        delete(tok,equalspos,length(tok));
+        gotvalue:=true;
+      end;
+    found:=false;
+    uppervar(tok);
+    for opt:=low(ttargetswitch) to high(ttargetswitch) do
+      begin
+        if TargetSwitchStr[opt].name=tok then
+          begin
+            found:=true;
+            break;
+          end;
+      end;
+    if found then
+      begin
+        if not global and
+           TargetSwitchStr[opt].isglobal then
+          result:=false
+        else if not TargetSwitchStr[opt].hasvalue then
+          begin
+            if gotvalue then
+              result:=false;
+            if (TargetSwitchStr[opt].define<>'') and (doset xor (opt in a)) then
+              if doset then
+                def_system_macro(TargetSwitchStr[opt].define)
+              else
+                undef_system_macro(TargetSwitchStr[opt].define);
+            if doset then
+              include(a,opt)
+            else
+              exclude(a,opt)
+          end
+        else
+          begin
+            if not gotvalue or
+               not doset then
+              result:=false
+            else
+              begin
+                case opt of
+                  ts_auto_getter_prefix:
+                    prop_auto_getter_prefix:=value;
+                  ts_auto_setter_predix:
+                    prop_auto_setter_prefix:=value;
+                  else
+                    begin
+                      writeln('Internalerror 2012053001');
+                      halt(1);
+                    end;
+                end;
+              end;
+          end;
+      end
+    else
+      result:=false;
+  until false;
+end;
+
 {****************************************************************************
                                  Toption
 ****************************************************************************}

+ 1 - 1
compiler/scandir.pas

@@ -52,7 +52,7 @@ unit scandir;
     uses
       SysUtils,
       cutils,cfileutl,
-      globals,systems,widestr,cpuinfo,
+      globals,systems,options,widestr,cpuinfo,
       verbose,comphook,ppu,
       scanner,switches,
       fmodule,