5

Where can I find a list of all available warning and error flags I can set in clang and gcc? I've looked all over both of their respective documentation sites, and I can't find anything.

5 Answers 5

6
gcc --help=warnings,seperate
gcc --help=warnings,joined
gcc --help=warnings,undocumented
gcc --help=warnings

seperate flags are like boolean values; they are either on or off.
-Wflag means on. -Wno-flag means off.

joined flags are flags that require a value.
-Wflag=value

by typing gcc --help=warnings you will recieve all the warning options provided by your compiler.

EDIT:
looking at GNU Documentation, these warnings messages have existed since GCC 4.3.6

Sign up to request clarification or add additional context in comments.

3 Comments

Can you update this with a required gcc version? I'm on OSX 10.8.2, which has llvm-gcc-4.2 by default, and these options don't work for me.
@HeathBorders your version of gcc is just old enough to not have them.
In particular this discusses many of the flags: Gnu Warnings. And I believe they apply very closely to Clang so can be used in Xcode.
3

GCC: http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html#Option-Summary.

Comments

2

If the question is just to find the list of all possible GCC diagnostic (error, warning, ...) messages, you could use the catalog of messages for localization utilities. With the GCC source tar ball, look inside gcc/po/ or libcpp/po/ or libstdc++-v3/po/ etc.

If you just ask about the options used to get these messages, follow the link in the answer by Oli Charlesworth

Comments

2

For Clang, there is -Weverything, which enables all warning flags.

1 Comment

Thanks, but I'm interested in what all my options are, so I can turn things on and off.
1

The classic: man gcc. clang's manpage is not that populated yet, but since it mimics gcc's behavior anyway, many of gcc's -W options also work with clang.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.