On Wed, Mar 16, 2011 at 11:51:30PM -0700, Benjamin Kosnik wrote:
> + <p>
> + To fix, first see if the unused variable or parameter can be removed
> + without changing the result or logic of the surrounding code. If not,
> + annoate it with <code>__attribute__((__unused__))</code>

annotate

Also, I think we should mention that casting the var to void is another
option.

And I think it is worth mentioning that sometimes the RHS can have important
side-effects, in which case it is desirable to just drop the LHS and =,
while sometimes the RHS is just uselessly computed and can be dropped
altogether with the assignment and unused variable.

> + <h4>Strict overflow warnings</h4>
> + 
> + <p>
> + Using the <code>-Wstrict-overflow</code> flag
> + with <code>-Werror</code> and optmization flags above <code>-O2</code>
> + may result in compile errors when using glibc optimizations
> + for <code>strcmp</code>.
> + </p>
> + 
> + <p>
> + For example,
> + </p>
> + 
> + <pre>
> + #include <string.h>
> + void do_rm_rf (const char *p) { if (strcmp (p, "/") == 0) return; }
> + </pre>

This has been actually fixed, so we shouldn't mention this.

> + <p>
> + Jim Meyering, <a 
> href="http://lists.fedoraproject.org/pipermail/devel/2011-March/149355.html";>gcc-4.6.0-0.12.fc15.x86_64
>  breaks strcmp?</a>

And this reference too.

Thanks for writing this.

        Jakub

Reply via email to