瀏覽代碼

+ added new field 'define' to ttargetswitchinfo, which specifies a system macro
to be defined while the target switch is active
* the CLD target switch defines 'FPC_ENABLED_CLD' once again

git-svn-id: trunk@25594 -

nickysn 12 年之前
父節點
當前提交
ac66f3ae1b
共有 2 個文件被更改,包括 18 次插入11 次删除
  1. 7 1
      compiler/globals.pas
  2. 11 10
      compiler/globtype.pas

+ 7 - 1
compiler/globals.pas

@@ -567,7 +567,8 @@ implementation
       windirs,
       windirs,
 {$endif VER2_4}
 {$endif VER2_4}
 {$endif}
 {$endif}
-      comphook;
+      comphook,
+      symtable;
 
 
 {****************************************************************************
 {****************************************************************************
                                  TLinkStrMap
                                  TLinkStrMap
@@ -1443,6 +1444,11 @@ implementation
                 begin
                 begin
                   if gotvalue then
                   if gotvalue then
                     result:=false;
                     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
                   if doset then
                     include(a,opt)
                     include(a,opt)
                   else
                   else

+ 11 - 10
compiler/globtype.pas

@@ -298,6 +298,7 @@ interface
           hasvalue: boolean;
           hasvalue: boolean;
           { target switch can be used only globally }
           { target switch can be used only globally }
           isglobal: boolean;
           isglobal: boolean;
+          define: string[15];
        end;
        end;
 
 
     const
     const
@@ -316,16 +317,16 @@ interface
          'DWARFSETS','STABSABSINCLUDES','DWARFMETHODCLASSPREFIX');
          'DWARFSETS','STABSABSINCLUDES','DWARFMETHODCLASSPREFIX');
 
 
        TargetSwitchStr : array[ttargetswitch] of ttargetswitchinfo = (
        TargetSwitchStr : array[ttargetswitch] of ttargetswitchinfo = (
-         (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 ),
-         (name: 'LOWERCASEPROCSTART';  hasvalue: false; isglobal: true ),
-         (name: 'INITLOCALS';          hasvalue: false; isglobal: true ),
-         (name: 'CLD';                 hasvalue: false; isglobal: true )
+         (name: '';                    hasvalue: false; isglobal: true ; define: ''),
+         (name: 'SMALLTOC';            hasvalue: false; isglobal: true ; define: ''),
+         (name: 'COMPACTINTARRAYINIT'; hasvalue: false; isglobal: true ; define: ''),
+         (name: 'ENUMFIELDINIT';       hasvalue: false; isglobal: true ; define: ''),
+         (name: 'AUTOGETTERPREFIX';    hasvalue: true ; isglobal: false; define: ''),
+         (name: 'AUTOSETTERPREFIX';    hasvalue: true ; isglobal: false; define: ''),
+         (name: 'THUMBINTERWORKING';   hasvalue: false; isglobal: true ; define: ''),
+         (name: 'LOWERCASEPROCSTART';  hasvalue: false; isglobal: true ; define: ''),
+         (name: 'INITLOCALS';          hasvalue: false; isglobal: true ; define: ''),
+         (name: 'CLD';                 hasvalue: false; isglobal: true ; define: 'FPC_ENABLED_CLD')
        );
        );
 
 
        { switches being applied to all CPUs at the given level }
        { switches being applied to all CPUs at the given level }