mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 21:19:31 +02:00
* 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 -
This commit is contained in:
parent
a48b44cfe5
commit
989c543ea2
@ -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;
|
||||
|
@ -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
|
||||
****************************************************************************}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user