suppressing hints[Re: [fpc-pascal] How to solve "variable does not seem to be initialized" compiler hint.]

Martin fpc at mfriebe.de
Thu Nov 19 23:09:03 CET 2009


Jonas Maebe wrote:
> On 19 Nov 2009, at 22:50, Rainer Stratmann wrote:
>   
>> Yes, but for that is the compiler-switch $PASS_VAR_NO_HINT ON.
>> Then no hint is put out by the compiler.
>>     
>
> When using FPC 2.4.0rc1 or later:
> a) compile your code with -vq
> b) note the message number for the warning/note/hint you want to suppress (e.g., 1234)
> c) use -vm1234 in the future to globally suppress this warning/note/hint
>   
Ideally it would be, if there was a directive or similar, to suppress it 
for given lines (or statements).
one that is easier than {$push} { $HINT OFF} ... {$POP}

As mentioned earlier on this thread: If a hint occurs you have to (or 
may want to) check it's valid => but only *once*

If you found the code ok and the hint to be a false positive, then you 
want to suppress this hint at the checked location.
(if you later edit the code, you either check again before compiling or 
remove the suppress marker)

I know marcros are replaced recursively => do directives in macros work? 
=> if so you could enclose the block with 2 short-named macros.

Then again this doesn't work for 3rd party code, that you don't want to 
modify => but usually you compile that once, and use the ppu (do ppu 
emit hints?)


Martin



More information about the fpc-pascal mailing list