I'm compiling C++ code and I'd like to enable the -pedantic option.
I'm using GCC 4.0, running Xcode on Mac OS X Leopard.
It is for example possible to allow variadic macros and the long long
type that are normally forbidden when using -pedantic (with -Wno-variadic-macros and -Wno-long-long).
But I could not find anything to disable the "comma at end of enumerator list" warning.
Is it possible?
Thanks.
A comma at the end of an enumerator is valid in C99 but not in C89, so the following will work providing your code is valid C99
gcc -std=c99 -pedantic foo.c
I'm fairly sure that it's not valid in C++ (according to g++) at all
Edit: tested this with GCC 4.2.1 on HP-UX and it works with no errors / warnings foo.c
int main(int argc, char** argv) {
enum { A, B, };
return 0;
}
gcc -std=c99 -pedantic foo.c
In C++ it is not yet possible to disable it, even though it legal in C++11. So in the future, when GCC is corrected, -std=c++11 should disable it.
-std=c99 only works in C, not C++ (as in the question).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With