Skip to content

Commit

Permalink
qmake: Do not disable deprecation warnings for MSVC (C4996)
Browse files Browse the repository at this point in the history
Commit 0a76b6b in Qt 5.5.0 did move C4496 that warns about use of API
marked with  __declspec(deprecated),  [[deprecated]]  to level 4,
effectively disabling the warning for Qt users. This was done to work
around msvc warnings for standard API Microsoft considers insecure,
like std::copy.

Anyhow, this change also meant that users won't see warnings for other
deprecated API - including warnings about deprecated API in Qt, which
is especially crucial for the Qt 6 transition.

The original issue was fixed in Qt headers already in Qt 5.6.1 (see
commit 31c7b24). Also the CMake integration never set C4496,
so it should be safe to remove this now.

[ChangeLog][qmake] qmake does not disable the MSVC compiler warning
about deprecated API by default anymore (C4996). This means the
compiler will now warn about use of deprecated API, be it from Qt
or from other headers. You can manually revert this by adding
   QMAKE_CXX_FLAGS_WARN_ON += -wd4996
to your .pro file.

Fixes: QTBUG-85227
Change-Id: I5a578d34370e0e5e8a91f8a31e96b9c532dde8b5
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
  • Loading branch information
kkoehne committed May 28, 2024
1 parent 54f2229 commit a92f0e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mkspecs/common/msvc-desktop.conf
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ QMAKE_CFLAGS_SHANI = $$QMAKE_CFLAGS_SSE2

QMAKE_CXX = $$QMAKE_CC
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 -w44996
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189
QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
Expand Down

0 comments on commit a92f0e1

Please sign in to comment.