A
Anonymous 7843
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.