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

Codechange: "set but not used" warning when disabling assert() #9613

Merged
merged 1 commit into from Oct 16, 2021

Conversation

TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Oct 16, 2021

Motivation / Problem

During preparing for 12.0, the PR that disables assert() notice one new warning. Let's make a clean release, and address that warning.

Description

DebugCheckSanity() is unused when asserts are disabled.

Owh, and we should be using WITH_ASSERT, not NDEBUG for these cases.

Limitations

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@glx22
Copy link
Contributor

glx22 commented Oct 16, 2021

The sanity check is actually disabled for any release build even with asserts, but maybe it should be enabled in this case.
If we go that way, #ifndef NDEBUG in this change and on line 1787 must be replaced with #ifdef WITH_ASSERT like everywhere in the code.

DebugCheckSanity() is unused when asserts are disabled. While at it,
use WITH_ASSERT over NDEBUG, as that means we also run this code
during beta/RC.
@TrueBrain TrueBrain merged commit 78eece7 into OpenTTD:master Oct 16, 2021
@TrueBrain TrueBrain deleted the fix-emscripten-warning branch October 16, 2021 20:06
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.

None yet

2 participants