Skip to content

Conversation

@jschmidt-icinga
Copy link
Contributor

@jschmidt-icinga jschmidt-icinga commented Oct 17, 2025

Together with #9411, #9728, #9729 and #9730 this fixes most of the remaining compiler warnings, except the following:

  • A few -Wdangling-reference in scheduleddowntime-apply.cpp, which I'm pretty sure are false positives.
  • The OpenSSL 3.0 -Wdeprecated-declarations warnings.
  • The '-Wdeprecated' warnings about %pure-parser being deprecated in the .yy parser files. At first I wanted to include them here, but despite things seemingly building fine it seems there's some additional implications with replacing %pure-parser with %define api.pure and %error-verbose with %define parse.error verbose that I can't judge because I'm not a bison expert.
  • Possibly lots of platform specific stuff I've missed (didn't test with clang and we don't enable many warnings on Windows to begin with)

Copy link
Member

@Al2Klimov Al2Klimov left a comment

Choose a reason for hiding this comment

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

Note: This currently duplicates some of the efforts in #9411 until that is merged.

Suggestion:

  1. Rebase #10609 on top of #9411
  2. Change your base branch from master to compiler-warnings

@Al2Klimov Al2Klimov self-requested a review October 20, 2025 08:28
MSVC gave a warning here due to differences between the type
of the argument to emplace_back() and the type of the pair component.
@jschmidt-icinga jschmidt-icinga force-pushed the fix-misc-compiler-warnings branch 2 times, most recently from a25c3f1 to 289607b Compare October 21, 2025 13:44
@Al2Klimov Al2Klimov removed their request for review October 21, 2025 14:05
Comment on lines 556 to 558
else
VERIFY(!"Invalid scope.");

VERIFY(!"Invalid scope.");
return Empty;
Copy link
Member

Choose a reason for hiding this comment

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

Which compiler did complain about this? I'm not able to find this kind of warning in the GHAs logs or locally on my machine. The previous version was pretty obvious that it will never return since it's negating a statically provided string, and I'm a bit surprised that the compiler isn't able to figure this out as the icinga_assert_fail function is annotated with a noreturn attribute.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I compiled several times with multiple sets of flags and both GCC and clang because I didn't realize where I got the warning: It's MSVC.

I think __declspec(noreturn) is supposed to fix this here, but it doesn't. I'll look into what's missing.

}

allFiles.emplace_back(Utility::GetTime() + 1, GetApiDir() + "log/current");
allFiles.emplace_back(static_cast<int>(Utility::GetTime()) + 1, GetApiDir() + "log/current");
Copy link
Member

Choose a reason for hiding this comment

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

Uhmm, casting double to int? I know that this was implicitly done previously but this is just totally wrong. I would just change the type of the first pair in allFiles to double and adjust LogGlobHandler accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While I agree that using double everywhere would make more sense here, I wanted to change as little as possible and only fix the warnings here.

Also it's not "totally wrong". static_casting double to int is perfectly valid, especially since it's done explicitly. It's just truncating the double value to whole seconds.

@yhabteab
Copy link
Member

  • The '-Wdeprecated' warnings about %pure-parser being deprecated in the .yy parser files. At first I wanted to include them here, but despite things seemingly building fine it seems there's some additional implications with replacing %pure-parser with %define api.pure and %error-verbose with %define parse.error verbose that I can't judge because I'm not a bison expert.

Oh, forgot to send my reply to this. These warning don't exist on my machine and replacing %pure-parser with %define api.pure {,true,full} results in a bison syntax error. I use the following bison version:

$ bison --version
bison (GNU Bison) 2.3
Written by Robert Corbett and Richard Stallman
---

And after going through the Bison docs, there's quite no difference between %pure-parser and %define api.pure true. There seems to be a difference between full and true using as a value though, but I guess that's irrelevant now, since we won't change this anytime soon.

@jschmidt-icinga jschmidt-icinga force-pushed the fix-misc-compiler-warnings branch from 289607b to 4389abf Compare November 17, 2025 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants