EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Suppressing "Parameter not used" Warning

Started by Dave Hansen October 3, 2005
In article <3r81b3Fi346kU1@individual.net>,
S.Tobias <siXtY@FamOuS.BedBuG.pAlS.INVALID> wrote:
> > This idea has been wandering around me for some time, too. > It could work like this: programmer puts #pramas in the code, > which contain verbatim quotes (or regexes, or identifires) of warnings > that are to be suppressed for the next line. The utility program (or > a script) calculates line numbers and produces a list of warnings > (with the line numbers) to cut out from the compiler output. > Like this: > #pragma nowarn t.c:%n: warning: comparison between signed and unsigned > if (u>s)
Lately, I've been fixing this with: if (s < 0 || u > (unsigned) s) but only after careful examination of what s really represents. If s just contained a sloppy assignment from what was previously an unsigned value, then no need for the extra mathematical rigor. Also, a lot these warnings arise from people using int when they should have used size_t.

Memfault Beyond the Launch