-
-
Notifications
You must be signed in to change notification settings - Fork 23.3k
Description
Godot version
4.0.beta (14e1f36)
System information
Windows 10 64-bit, VS 2019, MSVC 14.29.30133
Issue description
I made some fixes and Godot's master
branch should now build without warnings when using /W3
with VS 2019 (at least tools=yes target=debug
build, optimized builds might find other unfixed warnings with /W3
).
It's worth noting that our warnings=all
preset which sets /W3
also disables /wd4267 /wd4244 /wd4305 /wd4018 /wd4800
as non-essential warnings.
I gave a try at using /W4
without disable the above non-essential warnings, here are the results:
369,102 warnings raised.
Oh boy.
Let's categorize them and see which ones are worth investigating/fixing and which ones should be ignored (or if we should outright give up on /W4
if it doesn't catch any useful warning compared to /W3
).
Here's the list of unique warning codes raised and the number of occurrences for each:
Code | Occurrences | Warning Level | Message | Comment |
---|---|---|---|---|
C4100 | 220,816 | 4 | 'identifier': unreferenced formal parameter | Doesn't play nice with polymorphism, should be ignored. Silenced by #66595 |
C4127 | 966 | 4 | conditional expression is constant | Fixed partially by #66583 |
C4201 | 8,487 | 4 | nonstandard extension used: nameless struct/union | Only relevant for C89 compat, we should ignore it. Silenced by #66595 |
C4244 | 51,640 | 2 and 3/4 | 'conversion' conversion from 'type1' to 'type2', possible loss of data | Ignored in warnings={all,moderate} |
C4245 | 352 | 4 | 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch | Silenced by #66595 |
C4267 | 1203 | 3 | 'var' : conversion from 'size_t' to 'type', possible loss of data | Ignored in warnings={all,moderate} |
C4305 | 18,164 | 1 | 'context' : truncation from 'type1' to 'type2' | Ignored in warnings={all,moderate} |
C4324 | 12 | 4 | 'struct_name' : structure was padded due to __declspec(align()) | Silenced in #66545 |
C4389 | 2 | 4 | 'equality-operator' : signed/unsigned mismatch | Fixed by #66545 |
C4456 | 3 | 4 | declaration of 'identifier' hides previous local declaration | Fixed by #66545 |
C4458 | 67,374 | 4 | declaration of 'identifier' hides class member | 66,047 occurrences fixed by #66539, 1,330 remain |
C4459 | 1 | 4 | declaration of 'identifier' hides global declaration | Fixed by #66545 |
C4701 | 17 | 4 | Potentially uninitialized local variable 'name' used | Fixed by #66544 and #66548 |
C4702 | 26 | 4 | unreachable code | Fixed by #66543 and #66568 |
C4703 | 2 | 4 | Potentially uninitialized local pointer variable 'name' used | Fixed by #66548 |
C4706 | 37 | 4 | assignment within conditional expression | Fixed by #66542 and #66545 |
For each of the above, we should assess some of the situations in which the warnings are raised and see if they're worth fixing. The warnings emitted tens of thousands of time typically come from core templates and get re-emitted everytime the template is used.
I'll post some details on each warning in follow-up comments.
Here's the full build log (7z compressed and then zipped so it can be attached, unzipped it's 59MB):
Edit: Edited log with Unix line endings, attempting to fix some of the scrambled lines where multiple warnings would be listed on the same line, or paths would get truncated:
Some remarks:
- Looks like C4018 which we ignore with
warnings=all
is not emitted with a plain/W4
run. Might be that we fixed it and we can stop ignoring it. - Similarly, C4800 which we ignore is not emitted. According to the docs it has a different meaning in VS <= 2015 and VS >= 2019 and is not emitted in VS 2017. We only support VS >= 2017 so we could un-ignore it too.
Steps to reproduce
- VS 2019, MSVC 14.29.30133
scons p=windows CCFLAGS="/W4"
Minimal reproduction project
No response