Respect compiler OPT='-v0' by using {$push} and {$pop} in code. Issue #34955.

git-svn-id: trunk@60706 -
This commit is contained in:
juha 2019-03-16 21:17:58 +00:00
parent 3784bfa8df
commit d9ac09795b
19 changed files with 53 additions and 39 deletions

View File

@ -1184,9 +1184,10 @@ type
property UTF8Decode: Boolean read FUtf8Decode write FUtf8Decode;
{$PUSH}
{$WARNINGS OFF}
property UnitName: tbtString read FUnitName;
{$WARNINGS ON}
{$POP}
end;
TIFPSPascalCompiler = TPSPascalCompiler;

View File

@ -2532,6 +2532,7 @@ var
Result := True;
end;
{$PUSH}
{$WARNINGS OFF}
function LoadTypes: Boolean;
@ -2932,7 +2933,7 @@ var
FProcs.Add(Curr);
end;
end;
{$WARNINGS ON}
{$POP}
function LoadVars: Boolean;
var

View File

@ -425,9 +425,10 @@ type
function HasUses(pUnitName: TbtString): Boolean;
{$PUSH}
{$WARNINGS OFF}
property UnitName: TbtString read fUnitName write SetUnitName;
{$WARNINGS ON}
{$POP}
end;
TPSUnitList = class

View File

@ -110,6 +110,7 @@ begin
IDEDialogLayoutList.ApplyLayout(Self);
end;
{$PUSH}
{$HINTS OFF}
procedure TChangeParentDlg.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
@ -118,7 +119,7 @@ begin
FSavedShowClasses := chShowClasses.Checked;
IDEDialogLayoutList.SaveLayout(Self);
end;
{$HINTS ON}
{$POP}
procedure TChangeParentDlg.chShowClassesClick(Sender: TObject);
begin
@ -131,12 +132,13 @@ begin
ButtonPanel.OKButton.Click;
end;
{$PUSH}
{$HINTS OFF}
procedure TChangeParentDlg.ListBoxSelectionChange(Sender: TObject; User: boolean);
begin
UpdateOKButtonState;
end;
{$HINTS ON}
{$POP}
procedure TChangeParentDlg.ListFilterEditAfterFilter(Sender: TObject);
begin

View File

@ -6061,12 +6061,13 @@ procedure TURLPropertyEditor.SetFilename(const Filename: string);
i: Integer;
begin
Result:=Filename;
{$push}
{$warnings off}
if PathDelim<>'/' then
for i:=1 to length(Result) do
if Result[i]=PathDelim then
Result[i]:='/';
{$warnings on}
{$pop}
if Result<>'' then
Result:='file://'+Result;
end;

View File

@ -36,7 +36,7 @@ unit FileWriter;
interface
uses CodeWriter;
uses SysUtils, CodeWriter;
type
TFileWriter = class(TCodeWriter)
@ -57,16 +57,12 @@ type
implementation
uses
{ delphi }SysUtils;
constructor TFileWriter.Create;
begin
inherited;
FOutputFileName := '';
end;
procedure TFileWriter.SetOutputFileName(const Value: string);
begin
FOutputFileName := Value;
@ -89,9 +85,10 @@ begin
{ write the file }
AssignFile(lfOutput, OutputFileName);
Rewrite(lfOutput, 1);
{$PUSH}
{$WARNINGS OFF}
BlockWrite(lfOutput, pChars^, Length(fsDestText));
{$WARNINGS ON}
{$POP}
CloseFile(lfOutput);
{ reset state }

View File

@ -37,7 +37,7 @@ interface
uses Dialogs;
{$ELSE}
{$IFDEF WIN32}
uses {$WARNINGS OFF} FileCtrl {$WARNINGS ON};
uses {$PUSH} {$WARNINGS OFF} FileCtrl {$POP};
{$ENDIF}
{$ENDIF}
@ -56,10 +56,11 @@ uses SysUtils;
liAttr: integer;
begin
Assert(FileExists(ps));
{$PUSH}
{$WARNINGS OFF}
liAttr := FileGetAttr(ps);
Result := ((liAttr and faReadOnly) <> 0);
{$WARNINGS ON}
{$POP}
end;
{$ELSE}
@ -71,10 +72,11 @@ uses SysUtils;
liAttr: integer;
begin
Assert(FileExists(ps));
{$PUSH}
{$WARNINGS OFF}
liAttr := FileGetAttr(ps);
Result := ((liAttr and faReadOnly) <> 0);
{$WARNINGS ON}
{$POP}
end;
{$ENDIF}

View File

@ -61,7 +61,7 @@ implementation
uses
{$ifdef MSWINDOWS}
Windows, ShellApi, {$WARNINGS OFF} FileCtrl {$WARNINGS ON}
Windows, ShellApi, {$PUSH} {$WARNINGS OFF} FileCtrl {$POP}
{$endif}
{$ifdef Unix}
Unix
@ -95,10 +95,11 @@ end;
liAttr: integer;
begin
Assert(FileExists(ps));
{$PUSH}
{$WARNINGS OFF}
liAttr := FileGetAttr(ps);
Result := ((liAttr and faReadOnly) <> 0);
{$WARNINGS ON}
{$POP}
end;
{$ELSE}
@ -110,10 +111,11 @@ end;
liAttr: integer;
begin
Assert(FileExists(ps));
{$PUSH}
{$WARNINGS OFF}
liAttr := FileGetAttr(ps);
Result := ((liAttr and faReadOnly) <> 0);
{$WARNINGS ON}
{$POP}
end;
{$ENDIF}

View File

@ -3015,10 +3015,11 @@ begin
end;
end;
{$PUSH}
{$WARNINGS off}
if DirectorySeparator <> '/' then
Result := StringReplace(Result, DirectorySeparator, '/', [rfReplaceAll]);
{$WARNINGS on}
{$POP}
if esc = gdfeEscSpace
then Result := StringReplace(Result, ' ', '\ ', [rfReplaceAll]);
if esc = gdfeQuote

View File

@ -387,6 +387,7 @@ begin
fCairoPrinter.Canvas.LineTo(X2,Y2);
end;
{$PUSH}
{$HINTS OFF}
{$NOTES OFF}
function isNumeric(St: String): Boolean;
@ -397,8 +398,7 @@ begin
Val(St, R, E);
Result := (E = 0);
end;
{$NOTES ON}
{$HINTS ON}
{$POP}
procedure TlrCairoExportFilter.ShowBarCode(View: TfrCustomBarCodeView; x, y, h,
w: integer);

View File

@ -199,6 +199,7 @@ const
defaultFontSize = 10;
{$PUSH}
{$HINTS OFF}
{$NOTES OFF}
function isNumeric(St: String): Boolean;
@ -209,8 +210,7 @@ begin
Val(St, R, E);
Result := (E = 0);
end;
{$NOTES ON}
{$HINTS ON}
{$POP}
function TfrCustomBarCodeView.GetBarType: TBarcodeType;
begin

View File

@ -4303,6 +4303,7 @@ begin
ScrollBox1.VertScrollBar.Range := ScrollBox1.VertScrollBar.Range + 10;
end;
{$PUSH}
{$HINTS OFF}
{$ifdef sbod}
procedure TfrDesignerForm.DrawStatusPanel(const ACanvas: TCanvas;
@ -4708,7 +4709,7 @@ begin
Result:=AppendPathDelim(lrConfigFolderName(false))+'lrDesigner.cfg';
end;
{$HINTS ON}
{$POP}
function TfrDesignerForm.RectTypEnabled: Boolean;
begin

View File

@ -66,6 +66,7 @@ implementation
uses LR_Const;
{$PUSH}
{$WARNINGS OFF}
procedure TfrFmtForm.ComboBox2Select(Sender: TObject);
begin
@ -141,7 +142,7 @@ procedure TfrFmtForm.SplEditEnter(Sender: TObject);
begin
SplEdit.SelectAll;
end;
{$WARNINGS ON}
{$POP}
procedure TfrFmtForm.FormCreate(Sender: TObject);
begin

View File

@ -587,6 +587,7 @@ begin
end;
end;
{$PUSH}
{$HINTS OFF}
procedure frGetComponents(Owner: TComponent; ClassRef: TClass;
List: TStrings; Skip: TComponent);
@ -711,7 +712,7 @@ begin
end;
end;
end;
{$HINTS ON}
{$POP}
function frGetWindowsVersion: String;
{$IFDEF WIN32}

View File

@ -728,6 +728,7 @@ end;
{ TFreeTypeGlyph }
{$push}
{$hints off}
function TFreeTypeGlyph.GetBounds: TRect;
var metrics: TT_Glyph_Metrics;
@ -737,18 +738,14 @@ begin
result := rect(IncludeFullGrainMin(xMin,64) div 64,IncludeFullGrainMin(-yMax,64) div 64,
(IncludeFullGrainMax(xMax,64)+1) div 64,(IncludeFullGrainMax(-yMin,64)+1) div 64);
end;
{$hints on}
{$hints off}
function TFreeTypeGlyph.GetAdvance: single;
var metrics: TT_Glyph_Metrics;
begin
TT_Get_Glyph_Metrics(FGlyphData, metrics);
result := metrics.advance/64;
end;
{$hints on}
{$hints off}
function TFreeTypeGlyph.GetBoundsWithOffset(x, y: single): TRect;
var metrics: TT_Glyph_Metrics;
begin
@ -757,7 +754,7 @@ begin
result := rect(IncludeFullGrainMin(xMin+round(x*64),64) div 64,IncludeFullGrainMin(-yMax+round(y*64),64) div 64,
(IncludeFullGrainMax(xMax+round(x*64),64)+1) div 64,(IncludeFullGrainMax(-yMin+round(y*64),64)+1) div 64);
end;
{$hints on}
{$pop}
constructor TFreeTypeGlyph.Create(AFont: TFreeTypeFont; AIndex: integer);
begin
@ -887,6 +884,7 @@ begin
FaceChanged;
end;
{$push}
{$hints off}
function TFreeTypeFont.GetDPI: integer;
var metrics: TT_Instance_Metrics;
@ -903,7 +901,7 @@ begin
result := FDPI;
end;
end;
{$hints on}
{$pop}
function TFreeTypeFont.GetFamily: string;
begin
@ -997,6 +995,7 @@ begin
result := lGlyph;
end;
{$push}
{$hints off}
function TFreeTypeFont.GetGlyphCount: integer;
var prop : TT_Face_Properties;
@ -1020,8 +1019,7 @@ begin
else
result := FNamesArray[ord(AIndex)];
end;
{$hints on}
{$pop}
function TFreeTypeFont.GetLineFullHeight: single;
begin

View File

@ -828,9 +828,10 @@ uses
var
ins : PInstance;
begin
{$push}
{$hints off}
fillchar(m, sizeof(m),0);
{$hints on}
{$pop}
ins := _ins.z;
if ins <> nil then
begin

View File

@ -696,10 +696,11 @@ begin
Result := SizeOf(TTypeKind)
+ 1 + length(AClassName) // packed shortstring: length byte + chars
+ CalculateTypeDataSize(PropInfoCount);
{$push}
{$warnings off}
if SizeOf(TTypeKind)<>1 then
raise Exception.Create('CalculateTypeInfoSize SizeOf(TTypeInfo^.Kind)<>1');
{$warnings on}
{$pop}
end;
function GetTypeDataPropCountAddr(TypeData: PTypeData): PWord;

View File

@ -253,11 +253,12 @@ begin
FLAGS := ILC_COLOR or ILC_MASK;
end;
end;
{$PUSH}
{$WARNINGS OFF}
Result._Init(ImageList_Create(AWidth, AHeight, Flags, ACount, AGrow));
if Result.Allocated and (ACount > 0) then
AddData(Result._Handle, ACount, -1, AWidth, AHeight, AData);
{$WARNINGS ON}
{$POP}
end;
class procedure TWin32WSCustomImageListResolution.Delete(

View File

@ -643,12 +643,13 @@ var
i: Integer;
begin
Result:=Filename;
{$push}
{$warnings off}
if PathDelim<>'/' then
for i:=1 to length(Result) do
if Result[i]=PathDelim then
Result[i]:='/';
{$warnings on}
{$pop}
end;
function URLPathToFilename(const URLPath: string): string;
@ -656,12 +657,13 @@ var
i: Integer;
begin
Result:=URLPath;
{$push}
{$warnings off}
if PathDelim<>'/' then
for i:=1 to length(Result) do
if Result[i]='/' then
Result[i]:=PathDelim;
{$warnings on}
{$pop}
end;
procedure SplitURL(const URL: string; out URLScheme, URLPath, URLParams: string);