BSD daemon

NetBSD Developer Documentation:

How to de-lint files

Before we get to the actual information, a warning: Please don't change anything if you're not sure it's okay. You could hide bugs that way.

What do I do when I get the following error from lint?

 « bitwise operand on signed value possibly non-portable [117]

Try to do the same with an unsigned variable. ANSI C does not guarantee the results of any shifts where the left hand side operand is not an unsigned int.

 « argument foo unused in function bar [231]

If it's not a real error, use /* ARGSUSEDn */ to tell lint how many arguments to check (n being that number).

 « possible pointer alignment problem [135]

If lint is overzealous, you can avoid the warning by a void cast: p = (foo *)(void *)q - You should do that only if you are certain that the pointer is aligned, otherwise you will be masking real bugs.

 « pointer casts may be troublesome [247]

If lint is overzealous, you can avoid the warning by a void cast: p = (foo *)(void *)q

 « conversion from '[unsigned ][long ]long' may lose accuracy [132]

If you're sure the accuracy loss is acceptable, cast the variable to the new type. Another tactic is to use an additional [unsigned] [long] long variable for intermediate calculations and only cast the result at the end.

 « cast discards 'const' from pointer target type [275]

If you're sure it's okay, add a /* LINTED const cast-away */ above the line producing the warning.

 « extra bits set to 0 in conversion of 'unsigned int' to 'unsigned long long', op & [309]

One case where this happens is when you logically combine (in this case with &) some long value with a constant, which is int by default. In this case, you can fix it by making the constant a long, too: long & 0xffffffff -> long & 0x00000000ffffffffULL

 « macro `macroname' used with too many (N) args

The macro is invoked with an argument (such as a #define) which has a comment with a comma (`,') in it. Ensure that the macro arguments are appropriately wrapped with parenthesis in the macro body.


NetBSD Home Page
NetBSD Developer Documentation

(Contact us) $NetBSD: index.html,v 1.8 2003/07/23 16:35:16 keihan Exp $
Copyright © 1994-2003 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.