Friday, June 20, 2014

PC-Lint: -e??? and -elib(???) have not the effect you might expect

Sometimes I see -elib(???) in my clients' PC-Lint configuration. The intention is to suppress all but syntax errors from library headers. This doesn't work for two reasons. The first one: most syntax errors have a two digit error code, but not all. The reserved range for syntax errors is 1 - 199. This is documented in the PC-Lint manual.

The second reason really took me by surprise as I found out that -elib(???) also suppresses error code 10. I tested this with PC-Lint 9.00k and also the current beta version 9.00k2 and also with -e???. I was informed by the Gimpel support that for historical reasons, a pattern consisting entirely of question marks is treated as a star (*). This is something we recently reviewed and intend to change in the near future as the current behavior is not documented and, as you demonstrate, not intuitive.

So -e??? and -elib(???) have the same effect as -e* and -elib(*) but won't give you the very deserved warning 686: Option '-e*' is suspicious because of 'the likelihood of causing meaningless output'; receiving a syntax error inside a library file most likely means something is wrong with your Lint confinguration. This warning also explains why you should never suppress syntax errors even from library headers. Except for the very rare causes where library headers raise syntax error even with a perfect PC-Lint configuration. You can find a few examples in the co-... files supplied by Gimpel. And then you should only suppress that single syntax error, not all.

Instead of -elib(???) you should use -wlib(1). This actually suppresses all library messages except syntactic errors.