hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.27k stars 225 forks source link

[BUG] Ignored -Wno-error-dangling-reference in common.h should be -Werror-dangling-reference #916

Closed wolfseifert closed 6 months ago

wolfseifert commented 6 months ago

Describe the bug The ignored "-Wno-error-dangling-reference" in common.h should be "-Werror-dangling-reference", otherwise it produces a warning by itself.

Additional context See 9aefcee5929d7710982bebb6293d8a7365ba42e5.

hsutter commented 6 months ago

Thanks!

DyXel commented 6 months ago

By the way, using -Wno-unknown-warning might help handling these:

When an unrecognized warning option is requested (e.g., -Wunknown-warning), GCC emits a diagnostic stating that the option is not recognized. However, if the -Wno- form is used, the behavior is slightly different: no diagnostic is produced for -Wno-unknown-warning unless other diagnostics are being produced. This allows the use of new -Wno- options with old compilers, but if something goes wrong, the compiler warns that an unrecognized option is present.

and I believe Clang has a similar thing.

hsutter commented 6 months ago

Thanks! Interesting... it looks like for a command line that works for both GCC and Clang I need to add -Wno-unknown-warning -Wno-unknown-warning-option -- the first is GCC's spelling and seems to ignore only -Wno-xxx negative flags, the second is Clang's spelling and seems to also ignore -Wxxx flags, and using them both seems to work to make GCC and Clang ignore also each other's no-warning options (which is getting slightly meta).

hsutter commented 6 months ago

Pushed: 5a032d7255cbb078aabe31195ac47ec8e8254c34

And it passed 10/10, so looks good. Thanks again.