LIJI32 / SameBoy

Game Boy and Game Boy Color emulator written in C
https://sameboy.github.io/
Other
1.58k stars 206 forks source link

Fix -Wmissing-braces warnings #597

Closed orbea closed 3 months ago

orbea commented 3 months ago

I noticed these new warnings when backporting the strict-aliasing fix and they seem trivial to fix , with this I don't see any warnings with gcc or clang on my system.

orbea commented 3 months ago

@LIJI32 I would really appreciate if you could review this PR.

LIJI32 commented 3 months ago

Sorry, I haven't been available for work on SameBoy for a few weeks. I'm actually generally against keeping -Wmissing-braces enabled, as it's one of those warnings that don't ever detect actual bugs, and having to keep track of which structs require which amount of opening braces gets annoying.

Is there any particular reason you need/want these warnings fixed?

orbea commented 3 months ago

@LIJI32 No worries, thanks for the reply.

I believe this basically boils down to correctness and being pedantic. I noticed these warnings because they were not present until recently and downstream projects didn't copy -Wno-missing-braces until now. My preference would be to use as few -Wno- flags as possible, but I will defer to your judgement.

LIJI32 commented 3 months ago

Fair. There are a few warnings that are normally enabled by -Wall that I tend to disable as they warn about "valid" C features I use a lot, such as -Wint-in-bool-context (handy shorthand, -Wmissing-braces) or -Wmultichar (Commonly used when handling file formats).