<?xml version="1.0"?>
<!DOCTYPE webpage
  PUBLIC "-//NetBSD//DTD Website-based NetBSD Extension//EN"
    "http://www.NetBSD.org/XML/htdocs/lang/share/xml/website-netbsd.dtd">

<webpage id="developers-de-lint">
<config param="desc" value="How to de-lint files"/>
<config param="cvstag" value="$NetBSD: de-lint.xml,v 1.5 2007/04/15 14:45:52 kano Exp $"/>
<config param="rcsdate" value="$Date: 2007/04/15 14:45:52 $"/>
<head>
<title>How to de-lint files</title>
</head>


<sect1 id="top">
Before we get to the actual information, a warning:
<emphasis>Please don't change anything if you're not sure it's okay.</emphasis>
You could hide bugs that way.

<sect2 id="what-to-do">
<title>What do I do when I get the following error from lint?</title>

<itemizedlist>
<listitem>
<emphasis>bitwise operand on signed value possibly non-portable [117]</emphasis>
<para>
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.
</para>
</listitem>

<listitem>
<emphasis>argument foo unused in function bar [231]</emphasis>
<para>
If it's not a real error, use <code>/* ARGSUSED<emphasis>n</emphasis>
*/</code> to tell lint how many arguments to check (<emphasis>n</emphasis>
being that number).
</para>
</listitem>

<listitem>
<emphasis>possible pointer alignment problem [135]</emphasis>
<para>
If lint is overzealous, you can avoid the warning by a void cast:
<code>p = (foo *)(void *)q</code>.
You should do that only if you are certain that the pointer is
aligned, otherwise you will be masking real bugs.
</para>
</listitem>

<listitem>
<emphasis>pointer casts may be troublesome [247]</emphasis>
<para>
If lint is overzealous, you can avoid the warning by a void cast:
<code>p = (foo *)(void *)q</code>.
</para>
</listitem>

<listitem>
<emphasis>conversion from '[unsigned ][long ]long'
may lose accuracy [132]</emphasis>
<para>
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.
</para>
</listitem>

<listitem>
<emphasis>cast discards 'const' from pointer target type [275]</emphasis>
<para>
If you're sure it's okay, add a
<code>/* LINTED const cast-away */</code> above the line producing the
warning.
</para>
</listitem>

<listitem>
<emphasis>extra bits set to 0 in
conversion of 'unsigned int' to 'unsigned long long', op &amp; [309]</emphasis>
<para>
One case where this happens is when you logically combine (in this case
with &amp;) 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:
<code>long &amp; 0xffffffff -> long &amp; 0x00000000ffffffffULL</code>
</para>
</listitem>

<listitem>
<emphasis>macro `<emphasis>macroname</emphasis>' used with too
many (<emphasis>N</emphasis>) args</emphasis>

<para>
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.
</para>
</listitem>

</itemizedlist>
</sect2>

<parentsec url="./" text="NetBSD Developer Documentation" />

</sect1>
</webpage>
