[BUG] Support for -W[no-]unused-but-set-{variable, parameter}

Hi,

These warnings are included by default with -Wall in GCC 4.6 [1], and
LLVM should support them instead of throwing -Wunknown-warning-option.

[1]: http://gcc.gnu.org/gcc-4.6/porting_to.html

Thanks.

Please file bug reports at llvm.org/bugs/

-Eli

FWIW I'd sort of prefer just to have a generalized dead store warning
(special casing for parameters doesn't seem all that important -
though I could be wrong).

Eli Friedman wrote:

Please file bug reports at llvm.org/bugs/

Filed bugs for all three. I was hoping to fix these now, with some help.

David Blaikie wrote:

FWIW I'd sort of prefer just to have a generalized dead store warning
(special casing for parameters doesn't seem all that important -
though I could be wrong).

Does LLVM have some existing code to detect a dead store that I can
just hook into to fix the bug? I agree that the {variable,parameter}
might not be important in practice, but we need to be compatible with
GCC.

Not at the moment - I've had half a mind to implement a generalized
dead store warning at some point. (& when I go to do so I'll start by
looking at the -Wsometimes-uninitialized implementation to get a feel
for how to visit loads/stores in the CFG, etc)

Oh... I can give you some quick pointers, then:

For the unused-but-set warnings, not sure how you'd want to go about
implementing them... I'm not convinced those specific warnings are
particularly useful, as opposed to a more general dead-store warning,
but you could start digging around near Sema::DiagnoseUnusedParameters
in clang/lib/Sema/SemaDecl.cpp . You probably want to send an email
to cfe-dev, though; discussions about clang-specific stuff generally
goes there.

For the bts issue, take a look at LLVM r126047.

For CFI parsing, look at llvm/lib/MC/MCParser/AsmParser.cpp.

If you're interested in contributing patches, you might also want to
skim http://llvm.org/docs/DeveloperPolicy.html .

-Eli