Skip to content

GUI: Enable more warnings#97

Merged
AndyFilter merged 23 commits into
AndyFilter:masterfrom
delet-this:gui-enable-warnings
Apr 21, 2026
Merged

GUI: Enable more warnings#97
AndyFilter merged 23 commits into
AndyFilter:masterfrom
delet-this:gui-enable-warnings

Conversation

@delet-this
Copy link
Copy Markdown

@delet-this delet-this commented Apr 18, 2026

Enable warnings that seemed useful from here: https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md#gcc--clang. Fix any compilation warnings.

This is quite many, but my thinking is that it's easier to enable warnings when the code is still clean of them, they can just be disabled in the future if they become annoying. Discarding some of them here is also fine to me if any of them seem overzealous / uninteresting for us.

I chose to suppress -Wunused-parameter. Do we care about this one? Enabling it would mean that we'd have to remove any unused params, or do this: void a(int /*x*/, int /*y*/).

One imo interesting warning that I didn't enable was -Wnull-dereference because I ran into a peculiar problem with it: when using LTO, it's only effective during linking. However we cant really have it enabled for linking, because ImGui produces warnings regarding it. So this remains disabled for now.

Note regarding CI: should we promote warnings to errors using -Werror exclusively in the pipeline, so the code would remain warning free? Or would that be too annoying?

SynchronousData is non-trivially copyable due to std::vector, so memcpy
can't be used. Therefore copying any uninitialized value is ub here.
No new warnings generated this time (on g++)!
Strings longer than 65536 is a non-standard feature, let's allow it so
fonts.h compiles.
Warn the user if a class with virtual functions has a non-virtual
destructor. This helps catch hard to track down memory errors.
Warn if you overload (not override) a virtual function.
Warn if indentation implies blocks where blocks do not exist.
warn if if / else branches have duplicated code
...and remove the single useless cast it found
Warn on security issues around functions that format output (i.e.,
`printf`)
Comment thread gui/FunctionHelper.h
@delet-this
Copy link
Copy Markdown
Author

I noticed we get bunch of warnings with -Wfloat-equal, that's something that should probably be looked at

Warn about extraneous semicolons.
Warn when a literal '0' is used as null pointer constant.
Warn if an undefined variable is used to initialize itself.
Warn if string literal is implicitly converted to a bool
Suggest adding the override specifier to member functions that override
...and fix the warnings it produced.
Warn about all deprecated features
Warn about suspicious uses of logical operators
Warn if casting removes const or volatile
Warn if casting increases the required alignment of the data
Warn if a class seems unusable due to everything being private
@AndyFilter
Copy link
Copy Markdown
Owner

Note regarding CI: should we promote warnings to errors using -Werror exclusively in the pipeline, so the code would remain warning free? Or would that be too annoying?

Not a bad idea. But I'd say let's try to go without it for now, and see how things evolve.

it's easier to enable warnings when the code is still clean of them (...)

I'll take that as a compliment, haha.

I noticed we get bunch of warnings with -Wfloat-equal, that's something that should probably be looked at

Yea, I looked at them, most of them look easy enough, but it's also something that will not take 5 minutes, and I feel like it provides very little actual benefit im most cases.
Might get around to it at some point. But it's a perfect job for some clanker. So once I'm forced by the society to outsource my thinking to the cloud and buy the Claude subscription I'll do it.


All looks good to me, still compiles, still no warnings (on g++).

I gotta admit tho, I'm impressed with the number-of-commits to lines-changed ratio. I feel like we're quite the opposites on this front, as I'm - as you might already know - more of a "30K lines changed - *Minor Changes*"-type of guy.
Obviously, that's not a problem to me, as I'm gonna squash and merge this, but just wanted to point out the mindset difference.

@delet-this
Copy link
Copy Markdown
Author

I was anticipating having to fix more issues, in that case the individual commits would have helped reviewing. But as they stand they don't really add that much yeah

@AndyFilter AndyFilter merged commit 528747c into AndyFilter:master Apr 21, 2026
1 check passed
@delet-this delet-this deleted the gui-enable-warnings branch April 21, 2026 08:04
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.

2 participants