mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 22:36:17 +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
|
// AddUnitToSpecificUsesSection would insert cthreads in the beginning automatically
|
||||||
// It doesn't work with {$IFDEF UNIX} directive -> use UsesInsertPolicy.
|
// It doesn't work with {$IFDEF UNIX} directive -> use UsesInsertPolicy.
|
||||||
var
|
var
|
||||||
|
i: Integer;
|
||||||
OldPolicy: TUsesInsertPolicy;
|
OldPolicy: TUsesInsertPolicy;
|
||||||
begin
|
begin
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
with fCTLink do
|
if not ( fMainUsedUnits.fExistingUnits.Find('cthreads', i) or
|
||||||
try
|
fImplUsedUnits.fExistingUnits.Find('cthreads', i) ) then
|
||||||
OldPolicy:=SrcCache.BeautifyCodeOptions.UsesInsertPolicy;
|
with fCTLink do
|
||||||
SrcCache.BeautifyCodeOptions.UsesInsertPolicy:=uipFirst;
|
try
|
||||||
if not CodeTool.AddUnitToSpecificUsesSection(fMainUsedUnits.fUsesSection,
|
OldPolicy:=SrcCache.BeautifyCodeOptions.UsesInsertPolicy;
|
||||||
'{$IFDEF UNIX}cthreads{$ENDIF}', '', SrcCache) then exit;
|
SrcCache.BeautifyCodeOptions.UsesInsertPolicy:=uipFirst;
|
||||||
finally
|
if not CodeTool.AddUnitToSpecificUsesSection(fMainUsedUnits.fUsesSection,
|
||||||
SrcCache.BeautifyCodeOptions.UsesInsertPolicy:=OldPolicy;
|
'{$IFDEF UNIX}cthreads{$ENDIF}', '', SrcCache) then exit;
|
||||||
end;
|
finally
|
||||||
|
SrcCache.BeautifyCodeOptions.UsesInsertPolicy:=OldPolicy;
|
||||||
|
end;
|
||||||
Result:=mrOK;
|
Result:=mrOK;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user