clang supports -Weverything which simply enables all warnings. gcc should introduce an equivalent option.
(In reply to Sverd Johnsen from comment #0)
> clang supports -Weverything which simply enables all warnings. gcc should
> introduce an equivalent option.
No it shouldn't.
This is a dup of an existing bug, but basically most clang devs I've spoken to say -Weverything is a bad idea, it exists only for testing/debugging clang itself and for an IDE to query all the available warning flags programmatically, and is not a feature we should copy.
Do not want.
It's PR31573 and its duplicate.
*** This bug has been marked as a duplicate of bug 31573 ***
As a Clang user, -Weverything allowed me to remove terrible bugs that would not crop up with -Wall -Wextra -Wfew-other-common-warnings.
For instance GCC 6 brings in many new warnings it seems. Well, it is a pity to have to go through the manual to find the new warnings and enable them by hand (very few people will actually do this, while it could certainly make some bugs appear. Maybe it could prevent the next Heartbleed ?).
In my experience, options like -Weverything tend to be too noisy to be generally useful for projects of non-trivial size.
At the same time, I would find an option like -Weverything quite useful when debugging GCC's support for diagnostics. I use -Wall -Wextra -Wpedantic but there are some warnings that aren't enabled even with these three. That said, if -Weverything were to be provided, it wouldn't be able to enable every single diagnostic because some are mutually exclusive (for example, the -Wabi=version warnings for distinct ABI versions). It also wouldn't be guaranteed to enable diagnostics controlled by non-warning options. But I wouldn't view these limitations as reasons not to provide such a feature. Many other popular compilers besides Clang provide it. Below are examples of a few other implementations that do:
EDG eccp has --remarks to enable informational diagnostics that are normally disabled.
HP aCC has +w that if memory serves enables all warnings (including EDG remarks, since aCC uses the EDG front end).
IBM XLC/C++ has -qinfo=all.
Intel ICC has a -diag-enable= option similar to XLC/C++ -qinfo= (ICC also uses the EDG front end but has many more diagnostics).
Oracle CC has the -erroff=%none option that (IIRC) enables all warnings.
Microsoft Visual C++ has /Wall that's documented to enable all diagnostic.
> In my experience, options like -Weverything tend to be too noisy to be generally useful for projects of non-trivial size.
It's always possible to run -Weverything -Wno-foo -Wno-bar to remove unwanted warnings. It's a bit more work upfront, but will bring benefits at each compiler update. Generally speaking, I'd say that there are more "useful" than "useless" warnings, hence it's less work to disable the useless ones, than to enable the useful ones.
One idea I had for allowing while discouraging use of -Weverything would be for it to always print at least 1 warning from itself ("Warning: Don't use -Weverything [-Weverything]") in addition to all the other warnings that it enables. That way people would be less tempted to try to use it with -Werror.
(In reply to Jean-Michaël Celerier from comment #3)
> As a Clang user, -Weverything allowed me to remove terrible bugs that would
> not crop up with -Wall -Wextra -Wfew-other-common-warnings.
> For instance GCC 6 brings in many new warnings it seems. Well, it is a pity
> to have to go through the manual to find the new warnings and enable them by
> hand (very few people will actually do this, while it could certainly make
> some bugs appear. Maybe it could prevent the next Heartbleed ?).
We should just move these new warnings under -Wall or -Wextra instead. See bug 87656