MSVC warnings need to be fixed
Reported version
3.0
Type
Functional
Severity
S3 - Major
Status
closed
Regression
No
Workaround
No
Project
There is a list of warnings we have (with /W4 level) in MSVC environment:
- Warning C4065 switch statement contains 'default' but no 'case' label
- Warning C4121 'Operator': alignment of a member was sensitive to packing
- Warning C4127 conditional expression is constant
- Warning C4245 '=': conversion from '' to '', signed/unsigned mismatch
- Warning C4456 declaration of '' hides previous local declaration
- Warning C4458 declaration of '' hides class member
- Warning C4702 unreachable code
- Warning C4706 assignment within conditional expression
- Warning C4996 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name
Comments
Some warnings fixed in https://github.com/musescore/MuseScore/pull/3858:
Left to do:
mscore/importgtp-gp4.cpp
(lines 1023 and 1082 (both understood now, but no idea how to fix)).Haven't see any of Warnings C4121, C4127, C4245, C4706 or C4996 though yet?
Edit:
Warning С4127 and C4706 have been already fixed.
Warning C4245, C4121 and C4996 relate to the thirparty component poppler and have been disabled meanwhile.
Warning C4121 and C4996 had been seen once but now don't show anymore.
(see above)
Fixed in branch master, commit 632f830f5f
Fix #275218: fix MSVC compiler warnings
* Warnings C4304, C4804 and C4838.
* Warnings C4065 and most C4702 (all but two).
* Warnings C4701.
* Warnings C4244.
* Warnings C4457.
* Warnings C4459.
* Some warnings C4456, due to nested `foreach` loops.
Fixed in branch master, commit 2b5b85f1b3
Merge pull request #3858 from Jojo-Schmitz/MSVC-warnings
Fix #275218: fix MSVC warnings
To fix remaining warnings.
Which is:
mscore/importgtp-gp4.cpp
(lines 1023 and 1082 (both understood now, but no idea how to fix)).#if 0 ... #endif
) and bww/writer.obj (where the corresponding cpp file doesn't contain any code at all)When building "relwithdebinfo" rather than "debug", those 2 C4702 are gone, as are those 2 Linker warning LNK4221, but 1 new warnings C4703 shows in thirdparty/poppler, 7 new warnings C4189 show in thirdparty/portmidi, the latter probably because using
assert()
rather thanQ_ASSERT()
. That warning should probably just get disabled for portmidi.https://github.com/musescore/MuseScore/pull/3869
Fixed in branch master, commit 5d0f1eed5e
Merge pull request #3869 from Jojo-Schmitz/MSVC-warnings
Fix #275218: Fix more MSVC warnings
Still a bunch left:
And with the switch to 64bit builds or the change from MSVC 2015 to 2017, quite a bunch of new warnings like e.g. about int vs. size_t.
Current status, 64bit RelWithDebInfo build:
In reply to Current status, 64bit builds… by Jojo-Schmitz
Good news is that C4267 appears a lot of times, but most of the time they relate to the same string in cross linked files. So, they all will probably disappear after fixing 30-40 places.
See https://github.com/musescore/MuseScore/pull/3913
And indeed for C4267 fixing just 2 places and disable that for thirdparty, brings that number from 545 down to 107
Fixed in branch master, commit 9a4a819291
Merge pull request #3913 from Jojo-Schmitz/MSVC-warnings
Fix #275218: MSVC warnings
Reopening for the remaining warnings.
Current status (with 4b5b557 in RelWithDebInfo mode) is
See https://github.com/musescore/MuseScore/pull/3958
Now all but that 1 linker warning LNK4098, LIBCMTD conflicting with other libs
Fixed in branch master, commit 098ee4d46a
fix #275218: fix MSVC LNK4221 warnings
about empty objects
Fixed in branch master, commit 474e8152cd
fix #275218: fix MSVC C4456 warnings
reg. a declaration shadowing a previously declared local
variable,
"Warning C4456: declaration of 'XXX' hides previous local
declaration"
Fixed in branch master, commit 7d7f7e74e5
fix #275218: fix MSVC C4457 warnings
reg. local variables shadowing function parameters
"Warning C4457: declaration of 'XXX' hides function parameter"
Fixed in branch master, commit fe50c85097
fix #275218: fix MSVC C4458 warnings
reg. a declaration shadowing a class member,
"Warning C4458: declaration of 'XXX' hides class member"
Fixed in branch master, commit b8810ed9e5
fix #275218: fix MSVC C4065 and C4701 warnings
ref. a `switch` without any `case` and the use of a
possibly uninitialized variable.
Also fix yet another few C4456.
Also disable one warning less for portmidi as it doesn't happen anyway
(anymore?)
Fixed in branch master, commit 5eaf97da89
Merge pull request #3958 from Jojo-Schmitz/MSVC-warnings
fix #275218: fix MSVC warnings
Seems I missed to disable a warning in portmidi
See https://github.com/musescore/MuseScore/pull/4025
But also see #276627: Development version / 3.0alpha crashes after splashscreen (potentially an issue portaudio)
Not fixed (yet?) is a linker warning:
LINK : warning LNK4098: Standardlibrary "LIBCMT" conflicts with other libraries; use /NODEFAULTLIB:Library.
0ce2438
Automatically closed -- issue fixed for 2 weeks with no activity.