Skip to content

Fix RelWithDebInfo build #6901

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ayshuha
Copy link

@ayshuha ayshuha commented May 21, 2025

This change adds the [[maybe_unused]] type alias to the variables defined and used in assertIsRecognized in GetEnv.hpp. This fixes -Wunused-variable errors raised when building with REL_WITH_DEB_INFO enabled, as we build our backend with -Wunused.

New contributor declaration

  • I am not making a trivial change, such as fixing a typo in a comment.

  • I have written a PR description following these
    rules.

  • I have run pre-commit run --from-ref origin/main --to-ref HEAD.

  • Select one of the following.

    • I have added tests.
      • /test for lit tests
      • /unittest for C++ tests
      • /python/test for end-to-end tests
    • This PR does not need a test because this just fixes a build issue.
  • Select one of the following.

    • I have not added any lit tests.
    • The lit tests I have added follow these best practices,
      including the "tests should be minimal" section. (Usually running Python code
      and using the instructions it generates is not minimal.)

@ayshuha ayshuha requested a review from ptillet as a code owner May 21, 2025 15:27
@ThomasRaoux
Copy link
Collaborator

I'm guessing that won't be the only case. I'm not a big fan of the solution, feels very verbose. -Wunused-variable is not enabled right now, why are you running into those errors?

@ayshuha
Copy link
Author

ayshuha commented May 21, 2025

-Wunused-variable is not enabled right now, why are you running into those errors?

@ThomasRaoux We build our backend with -Wunused and we'd like to be able to build with RelWithDebInfo, and this is the only error that shows up in that mode.

I'm guessing that won't be the only case. I'm not a big fan of the solution, feels very verbose.

Alternatively I could change this to have the function assertIsRecognized and its uses wrapped with #ifndef NDEBUG macros

Copy link
Contributor

@lezcano lezcano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! It'd be quite nice to build with -Wunused-variable even in the main build. Would you want to send a PR?

Edit. I see that Thomas has second thoughts, but on my side I'd vote to build always with -Wunused-variable. I find it quite useful.

@lezcano lezcano enabled auto-merge (squash) May 21, 2025 23:07
@lezcano lezcano disabled auto-merge May 21, 2025 23:07
@ThomasRaoux
Copy link
Collaborator

Thank you! It'd be quite nice to build with -Wunused-variable even in the main build. Would you want to send a PR?

Edit. I see that Thomas has second thoughts, but on my side I'd vote to build always with -Wunused-variable. I find it quite useful.

I'd be curious to see what it takes to enable -Wunused-variable. I doubt this is the only change needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants