Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-01

{$WARNINGS OFF} isn't local

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Craig Peterson

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

Reply by email

Sven Barth
to Craig Peterson
"Craig Peterson" wrote 5 lines
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?

No. Please test whether this happens with 3.0.0 or 3.1.1 as well and if so report a bug (though I remember having seen something about this...).

Regards,
Sven

Reply by email