-
Notifications
You must be signed in to change notification settings - Fork 597
Fix compiler warnings #9411
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
Fix compiler warnings #9411
Conversation
2cccd7c to
2dad63e
Compare
83d5d60 to
0a416bd
Compare
|
@julianbrost Would you prefer me finish this or have this merged "ASAP" not to have it laying around for too long? |
|
Btw. any idea what's the matter with the unused OpenSSL functions? |
0a416bd to
9da3001
Compare
TODO
|
What are the thing you would or wouldn't do in each case? But I'd rather keep this PR at a reviewable size rather than growing it to some monster nobody got time for to review.
Which ones do you mean? |
I'm done anyway with not Windows-specific stuff.
|
They are used with some functions up-to-date OpenSSL versions no longer use. So figure out if it's still used in any OpenSSL version we have to support and if so, put it in |
|
Oh, that's the point! They are inside |
|
They are inside |
|
To me they seem to be still used. (Just search for them via Ctrl+F in the same file.) And the usages are in identical ifdefs. |
|
Used with this macro that expands to nothing (i.e. no use of the function): Which is inside: So looks like that function was deprecated with 1.1.0, and I think CentOS 7 still uses an older version (: |
|
Cool. /s |
julianbrost
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, if we take the effort to address compiler warnings, we should also do something to ensure that it stays this way, i.e. CI.
I see two options here:
- Add a GH Actions job that compiles with
-Werror. But this has the risk that at some point a new type of warning is added, not immediately addressed and the check will just be ignored. - I don't know if something like this already exists, but I'd be surprised if it doesn't: GH Actions allow to annotate the code in a PR, so it should be possible to annotate it with compiler warnings.
Can you please look if something like this exists and integrate it?
CMakeLists.txt
Outdated
| add_definitions(-DBOOST_ALLOW_DEPRECATED_HEADERS) | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for this change? Basically that just silences a warning, why can't what the warning is actually about be addressed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to support a wide range of Boost versions, with possibly different headers being available/deprecated or not. We already (have to) support [1.66, 1.79], 14 different versions. If we gonna support e.g. CentOS 7 till 2024, that will increase. I consider it more productive not to care about header deprecation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of that warning should be a heads-up notice that if you address it, you won't be surprised by the next Boost version breaking something.
Now I haven't looked at this in detail (would actually addressing these warnings involve adding huge amounts of #ifdef?) and how Boost handles deprecation (do deprecated headers stay there basically forever?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do deprecated headers stay there basically forever?
Unfortunately I forgot my crystal ball. So I opt for hoping for that, but changing this strategy on bad surprise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean: just have a look at the add_definitions immediately nearby.
lib/base/configuration.cpp
Outdated
| } | ||
|
|
||
| void Configuration::SetApiBindHost(const String& val, bool suppress_events, const Value& cookie) | ||
| void Configuration::SetApiBindHost(const String& val, bool, const Value&) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of addressing unused parameters like this. The names also serve a bit of a descriptive purpose. Without them, you have to find the signature that's implemented here or the call site to figure out what these parameters actually are.
Thus, I'd prefer (void) suppress_events; in instances like this. For something like MessageOrigin messageOrigin I'm fine with removing the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For used params, sure. One has to know what's what. But for unused? Who cares what that random bool is if no one uses it? After all in the (rare) case of (rare) cases these two red/green arrows in CLion next to the funcdef are your friends. Btw. we already do it like this.
lib/base/dependencygraph.cpp
Outdated
| typedef std::pair<Object *, int> kv_pair; | ||
| for (const kv_pair& kv : it->second) { | ||
| typedef std::pair<Object *const, int> kv_pair; | ||
| for (kv_pair& kv : it->second) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use auto and get rid of the typedef?
|
Actually this PR has never been about compiler warnings cleanup by itself. I as a dev just don’t want to get spammed with them as that hides everything else. I consider the current amount of warnings just fine. Apropos! Do you remember my TODO list? Its only point is checkboxed because I actually took a look at Windows (compiler warnings). Not more and not less. I decided not to care (for now), primarily to get this done. So no reason to overengineer anything. |
9da3001 to
a0f1cab
Compare
a5adc0f to
3ecc62d
Compare
3e1988e to
abfeba7
Compare
abfeba7 to
12bf837
Compare
12bf837 to
8e96167
Compare
8e96167 to
5484ad2
Compare
|
Oh, seems I forgot about this one, when I made #10609. If you rebase this onto master I could rebase my PR onto this one and deduplicate our efforts. |
5484ad2 to
255db94
Compare
255db94 to
d877e81
Compare
jschmidt-icinga
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @julianbrost's review is resolved/outdated at this point, so I'm going to approve this.
No description provided.