Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wolfseifert opened this issue Jan 5, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@wolfseifert
Copy link

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 9aefcee.

@wolfseifert wolfseifert added the bug Something isn't working label Jan 5, 2024
@hsutter hsutter closed this as completed in fc5a354 Jan 5, 2024
@hsutter
Copy link
Owner

hsutter commented Jan 5, 2024

Thanks!

@DyXel
Copy link
Contributor

DyXel commented Jan 5, 2024

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
Copy link
Owner

hsutter commented Jan 5, 2024

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 added a commit that referenced this issue Jan 5, 2024
The YAML uses a single `CXXFLAGS` for GCC and Clang flags, which is mostly okay because they tend to support the same flags... but sometimes GCC and Clang differ

So added `-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 either meta or a sweet irony)

HT: @DyXel thanks for #916 (comment)
@hsutter
Copy link
Owner

hsutter commented Jan 5, 2024

Pushed: 5a032d7

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants