Przeglądaj źródła

* mark each target switch with whether it's global or not, so a compiler
directive can be added that enables changing the local ones

git-svn-id: trunk@23562 -

Jonas Maebe 12 lat temu
rodzic
commit
4022c29500
3 zmienionych plików z 15 dodań i 11 usunięć
  1. 6 3
      compiler/globals.pas
  2. 8 7
      compiler/globtype.pas
  3. 1 1
      compiler/options.pas

+ 6 - 3
compiler/globals.pas

@@ -511,7 +511,7 @@ 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): 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;
 
@@ -1342,7 +1342,7 @@ implementation
       end;
 
 
-    function UpdateTargetSwitchStr(s: string; var a: ttargetswitches): boolean;
+    function UpdateTargetSwitchStr(s: string; var a: ttargetswitches; global: boolean): boolean;
       var
         tok,
         value : string;
@@ -1387,7 +1387,10 @@ implementation
             end;
           if found then
             begin
-              if not TargetSwitchStr[opt].hasvalue then
+              if not global and
+                 TargetSwitchStr[opt].isglobal then
+                result:=false
+              else if not TargetSwitchStr[opt].hasvalue then
                 begin
                   if gotvalue then
                     result:=false;

+ 8 - 7
compiler/globtype.pas

@@ -278,6 +278,7 @@ interface
        ttargetswitchinfo = record
           name: string[22];
           hasvalue: boolean;
+          isglobal: boolean;
        end;
 
     const
@@ -296,13 +297,13 @@ interface
          'DWARFSETS','STABSABSINCLUDES','DWARFMETHODCLASSPREFIX');
 
        TargetSwitchStr : array[ttargetswitch] of ttargetswitchinfo = (
-         (name: '';                    hasvalue: false),
-         (name: 'SMALLTOC';            hasvalue: false),
-         (name: 'COMPACTINTARRAYINIT'; hasvalue: false),
-         (name:  'ENUMFIELDINIT';      hasvalue: false),
-         (name: 'AUTOGETTERPREFIX';    hasvalue: true ),
-         (name: 'AUTOSETTERPREFIX';    hasvalue: true ),
-         (name: 'THUMBINTERWORKING';   hasvalue: true )
+         (name: '';                    hasvalue: false; isglobal: true ),
+         (name: 'SMALLTOC';            hasvalue: false; isglobal: true ),
+         (name: 'COMPACTINTARRAYINIT'; hasvalue: false; isglobal: true ),
+         (name: 'ENUMFIELDINIT';       hasvalue: false; isglobal: true ),
+         (name: 'AUTOGETTERPREFIX';    hasvalue: true ; isglobal: false),
+         (name: 'AUTOSETTERPREFIX';    hasvalue: true ; isglobal: false),
+         (name: 'THUMBINTERWORKING';   hasvalue: false; isglobal: true )
        );
 
        { switches being applied to all CPUs at the given level }

+ 1 - 1
compiler/options.pas

@@ -976,7 +976,7 @@ begin
                          include(init_settings.moduleswitches,cs_create_smart);
                     'T' :
                       begin
-                        if not UpdateTargetSwitchStr(copy(more,j+1,length(more)),init_settings.targetswitches) then
+                        if not UpdateTargetSwitchStr(copy(more,j+1,length(more)),init_settings.targetswitches,true) then
                           IllegalPara(opt);
                         break;
                       end;