Hiding notes/warnings/hints in a unit lazarus / 62-General ---------------------------------------------------------------------- simone · 2018-12-30 15:05 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  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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 · 2018-12-30 15:39 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 · 2018-12-30 15:58 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. So it must be a bug. Now, whether it's a source or documentation bug ... is debatable ---------------------------------------------------------------------- Bart · 2018-12-30 15:59 An old bug: https://bugs.freepascal.org/view.php?id=27378. Bart ---------------------------------------------------------------------- simone · 2018-12-30 16:15 So you can not hide these messages when compiling a third-party unit? ---------------------------------------------------------------------- lucamar · 2018-12-30 16:18 Quote from: simone on December 30, 2018, 05:15:02 pmSo you can not hide these messages when compiling a third-party unit? Yes you can; simply make sure a unit of yours containing {$notes off} gets compiled first. That's the bug: the order shouldn't matter. ---------------------------------------------------------------------- simone · 2018-12-30 19:31 I do some experiments changing the position in uses clause of unit with switches set to off. It seems that in all cases they act as were globals. However since it's a reported bug, I will wait the fix. Thanks for the help. ---------------------------------------------------------------------- jamie · 2018-12-30 21:42 its possible that UNIT has {$notes ON} in its source... in which case, it isn't going to work. ---------------------------------------------------------------------- PascalDragon · 2019-01-03 20:29 I've fixed bug #27378 now in revision 40750.