I wonder if there's some clever, automatic way of knowing if a particular compiler warning (e.g. -Wunused-parameter) comes from the group -Wall, -Wextra, or another group, for both GCC and Clang.
Use case: we want to enable:
-Wall -Wextra -pedantic
However, some of the pedantic warnings are unapplicable to us and we want to disable them, example:
-Wall -Wextra -pedantic -Wno-c++20-designator
Now, we want to be 100% sure that we are not disabling anything from -Wall nor -Wextra. How do we ensure that -Wc++20-designator is not part of either? Of course one can go and check the documentation, but this is a tedious process when you have many such warnings or when you upgrade the compiler and get new warnings.
Our use case to ensure that all -Wall, -Wextra warnings will always be active, regardless of the disabled warnings from -pedantic.
Automatically know if a GCC/Clang warning comes from Wall or Wextra?is not an alternative tois there a way to ensure that all -Wall, -Wextra warnings will always be active, regardless of the disabled warnings?. I also do not understand the second question, yes, there is a way, do not disable any warnings.pedanticis not the minimum. Which warning is enabled in which state is listed in the gcc docs. But I believe it will change from time to time and maybe the doc will not change always. I personally like to see every warning and fix as soon as possible. Which warning is switched on by the flags can be seen here: gcc.gnu.org/onlinedocs/gcc/Warning-Options.html. We compile our unit test targets with ALL warnings and count them. >0 is fault!gcc -Q -Wall --help=warnings | grep enabled. Would that help you?