Forum > General

Hiding notes/warnings/hints in a unit

(1/2) > >>

simone:
Dear all,

I need to hide noisy warnings/hints/notes of compiler coming from a third party
unit used in my project.

As far I know {$notes on/off} {$warnings on/off} {$hints on/off} are local switches.
Nevertheless it seems to me that uses clause propagates their effects to other units.

Let us consider the following example:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program Project1; //main program in file project1.lpruses unit1; var  y : integer; beginend. unit Unit1; //used unit in file unit1.pasinterface implementation end.
The compiler show the expected message:
"project1.lpr(5,3) Note: Local variable "y" not used"

Differently, above message is not shown in the following case:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program Project1; //main program in file project1.lpruses unit1; var  y : integer; beginend. unit Unit1; //used unit in file unit1.pas{$notes off}interface implementation end.
Is this behavior an error or a feature?

jamie:
its a feature to let you know you have unused resources you specified. it helps in making your
code look neater later on and possibly helping the compiler not to generate code or space
that does not get used.
 
 

lucamar:
The Programmer's Guide clearly says:

--- Quote ---{$NOTES ON} switches the generation of notes on. {$NOTES OFF} switches the generation of notes off. Contrary to the command line option -vn this is a local switch, this is useful for checking parts of the code.
--- End quote ---

So it must be a bug. Now, whether it's a source or documentation bug ... is debatable :)

Bart:
An old bug: https://bugs.freepascal.org/view.php?id=27378.

Bart

simone:
So you can not hide these messages when compiling a third-party unit?

Navigation

[0] Message Index

[#] Next page

Go to full version