mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 00:36:13 +02:00
Converter: Add cthreads only if not added already.
git-svn-id: trunk@29162 -
This commit is contained in:
parent
5c4d059729
commit
ea6083c980
@ -634,18 +634,21 @@ function TUsedUnitsTool.AddThreadSupport: TModalResult;
|
||||
// AddUnitToSpecificUsesSection would insert cthreads in the beginning automatically
|
||||
// It doesn't work with {$IFDEF UNIX} directive -> use UsesInsertPolicy.
|
||||
var
|
||||
i: Integer;
|
||||
OldPolicy: TUsesInsertPolicy;
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
with fCTLink do
|
||||
try
|
||||
OldPolicy:=SrcCache.BeautifyCodeOptions.UsesInsertPolicy;
|
||||
SrcCache.BeautifyCodeOptions.UsesInsertPolicy:=uipFirst;
|
||||
if not CodeTool.AddUnitToSpecificUsesSection(fMainUsedUnits.fUsesSection,
|
||||
'{$IFDEF UNIX}cthreads{$ENDIF}', '', SrcCache) then exit;
|
||||
finally
|
||||
SrcCache.BeautifyCodeOptions.UsesInsertPolicy:=OldPolicy;
|
||||
end;
|
||||
if not ( fMainUsedUnits.fExistingUnits.Find('cthreads', i) or
|
||||
fImplUsedUnits.fExistingUnits.Find('cthreads', i) ) then
|
||||
with fCTLink do
|
||||
try
|
||||
OldPolicy:=SrcCache.BeautifyCodeOptions.UsesInsertPolicy;
|
||||
SrcCache.BeautifyCodeOptions.UsesInsertPolicy:=uipFirst;
|
||||
if not CodeTool.AddUnitToSpecificUsesSection(fMainUsedUnits.fUsesSection,
|
||||
'{$IFDEF UNIX}cthreads{$ENDIF}', '', SrcCache) then exit;
|
||||
finally
|
||||
SrcCache.BeautifyCodeOptions.UsesInsertPolicy:=OldPolicy;
|
||||
end;
|
||||
Result:=mrOK;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user