[fpc-pascal] {$WARNINGS OFF} isn't local
Craig Peterson
craig at scootersoftware.com
Wed Jan 28 22:13:11 CET 2015
Using FPC v2.6.3 the {$WARNINGS OFF}, {$HINTS OFF}, and {$NOTES OFF}
directives affect all subsequently compiled units as well. That seems
wrong. Delphi limits the effects of those to the current compilation
unit, which is what I'd expect. Is this intentional?
Sample code:
---- Test.dpr ------
program Test;
uses
Unit1 in 'Unit1.pas',
Unit2 in 'Unit2.pas';
begin
end.
---- Unit1.pas -----
unit Unit1;
interface
implementation
var
Var1: Boolean;
end.
---- Unit2.pas -----
unit Unit2;
interface
implementation
var
Var2: Boolean;
end.
-------------------
Compiled with
fpc Test.dpr
Produces this output:
Free Pascal Compiler version 2.6.3 [2014/11/12] for i386
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Darwin for i386
Compiling Test.dpr
Compiling Unit1.pas
Unit1.pas(10,3) Note: Local variable "Var1" not used
Assembling (pipe) Unit1.s
Compiling Unit2.pas
Unit2.pas(8,3) Note: Local variable "Var2" not used
Assembling (pipe) Unit2.s
Assembling (pipe) Test.s
Linking Test
27 lines compiled, 0.1 sec
2 note(s) issued
--------------------
But if I add a "{$NOTES OFF}" declaration just before the "var" block in
Unit1.pas, the output is instead:
Free Pascal Compiler version 2.6.3 [2014/11/12] for i386
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Darwin for i386
Compiling Test.dpr
Compiling Unit1.pas
Assembling (pipe) Unit1.s
Compiling Unit2.pas
Assembling (pipe) Unit2.s
Assembling (pipe) Test.s
Linking Test
27 lines compiled, 0.1 sec
--
Craig Peterson
Scooter Software
More information about the fpc-pascal
mailing list