View Issue Details

IDProjectCategoryView StatusLast Update
0027378FPCCompilerpublic2019-01-03 21:32
ReporterCraig PetersonAssigned ToSven Barth 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.1.1Product Build 
Target VersionFixed in Version3.3.1 
Summary0027378: {$WARNINGS/HINTS/NOTES OFF} does not reset at end of unit
DescriptionThe {$WARNINGS OFF}, {$HINTS OFF}, and {$NOTES OFF}
directives affect all subsequently compiled units as well, rather than resetting to the global state at the end of the current file.
Steps To ReproduceCompile this sample code with "fpc Test.dpr". As is there are two notes:

Unit1.pas(10,3) Note: Local variable "Var1" not used
Unit2.pas(8,3) Note: Local variable "Var2" not used

If you add "{$NOTES OFF}" to the Unit1 implementation section, both notes disappear. Adding it to the Unit2 implementation section instead makes it only disappear for that unit, so the compilation order matters. Affects all of $WARNINGS/HINTS/NOTES.


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.
TagsNo tags attached.
Fixed in Revision40750
FPCOldBugId
FPCTarget
Attached Files

Relationships

has duplicate 0035063 resolvedSven Barth FPC $HINTS OFF/ON, $WARNINGS OFF/ON are global scoped but the document says it is unit scope based (just like Delphi) 

Activities

Sven Barth

2019-01-03 21:32

manager   ~0113137

Please test and close if okay.

Issue History

Date Modified Username Field Change
2015-01-29 20:42 Craig Peterson New Issue
2019-01-03 21:32 Sven Barth Fixed in Revision => 40750
2019-01-03 21:32 Sven Barth Note Added: 0113137
2019-01-03 21:32 Sven Barth Status new => resolved
2019-01-03 21:32 Sven Barth Fixed in Version => 3.3.1
2019-01-03 21:32 Sven Barth Resolution open => fixed
2019-01-03 21:32 Sven Barth Assigned To => Sven Barth
2019-02-15 14:58 Sven Barth Relationship added has duplicate 0035063