Commit Graph

25 Commits

Author SHA1 Message Date
Giuseppe D'Angelo
8780fbb2eb Build Qt (and client apps using it) with /permissive-
*Not* using /permissive- exposes Qt and client apps to interesting
bugs and/or build failures, (e.g. QTBUG-87225, or
19b5520abf). We demand strict
conformance by any other compiler, it's time to demand it from
MSVC too.

The Windows headers themselves are clean starting from the
Windows Fall Creators SDK (10.0.16299.0), and moreover Qt 6 will
drop WinRT; therefore, the comment in the mkspecs does not apply
any more.

Since /permissive- implies /Zc:referenceBinding, drop that
option. The other implied options are set on MSVC < 2017,
but I leave them in to avoid tinkering with the fragile lists
of C/C++ flags.

Rename the CMake internal helper function to better describe
what it does.

Fixes: QTBUG-85633
Fixes: QTBUG-85637
Fixes: QTBUG-85635
Fixes: QTBUG-88244
Change-Id: Ie03fddb61aa066fdc14b7231c22e7108b4a02fbb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-10 20:01:49 +01:00
Ulf Hermann
4e10abb4c1 Add externConstexpr to MSVC compile options
We want this in order to be able to export constexpr members.

Change-Id: I33ba7964ebee54fe656df983985d8d6fa0b99358
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-10-13 08:38:25 +02:00
Oliver Wolff
45b0f1be68 Remove winrt
Macros and the await helper function from qfunctions_winrt(_p).h are
needed in other Qt modules which use UWP APIs on desktop windows.

Task-number: QTBUG-84434
Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-06-06 20:25:49 +02:00
Thiago Macieira
780137d585 QRandom: add support for RDSEED
The Intel whitepaer[1] recommends using the RDSEED over RDRAND whenever
present. libstdc++ from GCC 10 will also use it in std::random_device.

[ChangeLog][QtCore][QRandomGenerator] The system() random generator will
now use the RDSEED instruction on x86 processors whenever available as
the first source of random data. It will fall back to RDRAND and then to
the system functions, in that order.

[1] https://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide

Change-Id: I907a43cd9a714da288a2fffd15bab176e54e1975
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-10-09 07:31:28 -07:00
Allan Sandfeld Jensen
51bae0331c Add qmake support for c++2a
Makes it possible to build user projects and Qt with C++2a. It is not
automatically upgraded to yet though.

Change-Id: I949ce94871ddc53f21b7265a52b9c0e1370456c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-04-19 08:14:25 +00:00
Oliver Wolff
896b307679 Add support for Visual Studio 2019
Change-Id: I963fc1c159edc644f081675c3dee248c25d7c9dc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Andre de la Rocha <andre.rocha@qt.io>
2019-02-13 14:04:54 +00:00
Friedemann Kleint
a8cb177d31 Fix build with win32-clang-msvc and win32-icc
fbbe8aba9d introduced a check for
MSVC_VER to qmake, which is not set in win32-clang-msvc,
causing the build to fail:

Mkspec does not specify MSVC_VER. Cannot continue.
Unable to generate output for: .../config.tests/verifyspec/Makefile

Extract a minimal msvc-based-version.conf which determines
MSVC_VER from QMAKE_MSC_VER for win32-clang-msvc and win32-icc.

Task-number: QTBUG-63512
Change-Id: Ia6de8c4b1aae2ae1962cf4e60e3e6d51fdbbbabe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-12-14 18:20:26 +00:00
Friedemann Kleint
39cb9ac873 Fix qtbase build for clang-cl with MSVC 2017 15.8
Move the definition of _ENABLE_EXTENDED_ALIGNED_STORAGE
to msvc-desktop.conf so that it becomes effective
for all compilers using MSVC (icc, clang-cl).

Task-number: QTBUG-50804
Change-Id: I5ff612cc0f5a712b855925f9bcf645e578e80504
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-08-24 12:00:43 +00:00
Thomas Miller
0ef66e98cc Fix qtbase build for MSVC 2017 15.8
Fixed breaks caused by MSVC 2017 15.8 fixing std::aligned_storage.

Change-Id: I5adea18c184e34bbdc3bd294d034b97383ef08a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-07-30 18:29:10 +00:00
Thiago Macieira
3e201d645e MSVC: Enable the detection of C++14 and 17 in MSVC 2017 15.7
We need -Zc:__cplusplus in order to enable the __cplusplus macro having
the correct value. This causes configure to now print:

 Checking for C++14 support... yes
 Checking for C++1z support... yes

and

  Using C++ standard ..................... C++1z

Change-Id: I5d0ee9389a794d80983efffd152c95a4d9d8adbc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-06-11 07:43:57 +00:00
Liang Qi
305dd1b61f Merge remote-tracking branch 'origin/5.9' into 5.11
Conflicts:
	.qmake.conf
	src/corelib/animation/qvariantanimation.cpp
	src/corelib/global/qglobal.cpp
	src/corelib/global/qlogging.cpp
	src/corelib/io/qprocess_win.cpp
	src/corelib/json/qjsonarray.cpp
	src/corelib/tools/qsimd_p.h
	src/corelib/tools/qtimezoneprivate_p.h
	src/corelib/xml/qxmlstream_p.h
	src/gui/kernel/qsimpledrag.cpp
	src/gui/kernel/qsimpledrag_p.h
	src/plugins/generic/generic.pro
	src/plugins/platforms/cocoa/qcocoamenu.mm
	src/widgets/styles/qmacstyle_mac.mm
	tests/auto/concurrent/qtconcurrentmap/BLACKLIST
	tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
	tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
	tests/auto/gui/kernel/qwindow/BLACKLIST
	tests/auto/widgets/dialogs/qmessagebox/BLACKLIST

Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e
2018-02-14 12:51:24 +01:00
Alexander Shevchenko
40e8749188 unify windows mkspecs: update definitions
mingw-w64 toolchain:
- add missing compiler definitions, similar to
  'msvc-desktop.conf' toolchain,
- describe the reasons of missing compiler definitions, available in
  'msvc-desktop.conf' toolchain,
- add missing 'QMAKE_CXXFLAGS' and 'QMAKE_CXXFLAGS_WARN_ON' variables,
  similar to 'msvc-desktop.conf' toolchain.

ICC on Windows toolchain:
- add 'QMAKE_CFLAGS_OPTIMIZE_FULL' variable, similar to 'gcc-base.conf'
  toolchain, though left it unused for now,
- add missing flags to 'QMAKE_CFLAGS' variable, similar to
  'msvc-desktop.conf' toolchain,
- update deprecated 'Qwd' flag with 'Qdiag-disable',
- use 'QMAKE_CFLAGS_OPTIMIZE_DEBUG' variable instead of '-Od' flag,
  similar to 'gcc-base.conf' toolchain (ICC implies '-O2' optimization
  level by default, while MSVC implies '-Od'),
- add 'QMAKE_CFLAGS_UTF8_SOURCE' variable, similar to
  'msvc-version.conf' toolchain; use a workaround to initialize it,
  until '-utf-8' flag would be supported by ICC on Windows,
- update deprecated '-Qstd=c++1z' flag with '-Qstd=c++17',

MSVC toolchain:
- remove 'incremental' from MSVC 'CONFIG' variable, since it has
  relevance only for the Unix generator,
- add 'QMAKE_CFLAGS_OPTIMIZE_DEBUG' variable, used in ICC for Windows
  toolchain,
- add empty 'QMAKE_LIBS' variable, similar to 'win32-g++' toolchain,
- add 'uuid.lib' library to 'QMAKE_LIBS_GUI' variable, similar to
  'win32-g++' toolchain,
- add C++14 and C++17 language support flags, though left them disabled
  for now, similar to 'win32-icc' toolchain.

Change-Id: Ideef62d0422674184836faa655bfc5d09a5f612f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-01-17 03:30:36 +00:00
Thiago Macieira
ff1ffa7577 Add support for AVX-512 intrinsics found in MSVC 2017 15.3
It seems the compiler supports /arch:AVX512 and /arch:AVX512F but none
of the other switches (and neither are documented). And when you pass
those, you also get Conflict Detection (CD), Double & Quad (DQ), Byte &
Word (BW) and Vector Length (VL), which matches the ICC switch
"-xCORE-AVX512". Unlike ICC, there doesn't seem to be an option to
enable only the common part of AVX-512.

Support for Intel Xeon Phi's current features (Exponential &
Reciprocation and Prefetch) and future ones (IFMA, VBMI, 4FMAPS, 4VNNI
and VPOPCNTDQ) seems to be missing altogether.

See https://blogs.msdn.microsoft.com/vcblog/2017/07/11/microsoft-visual-studio-2017-supports-intel-avx-512/

Change-Id: I98105cd9616b8097957db680d73eb1f86e487e6d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-11-30 08:30:37 +00:00
Liang Qi
bc5f45052f Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
	src/corelib/global/qconfig-bootstrapped.h
	src/corelib/global/qglobal.h
	src/corelib/tools/qcryptographichash.cpp
	src/corelib/tools/qcryptographichash.h
	src/corelib/tools/qmessageauthenticationcode.cpp
	src/plugins/platforms/windows/qwindowswindow.h
	tests/auto/gui/kernel/qwindow/BLACKLIST
	tests/auto/widgets/itemviews/qitemdelegate/BLACKLIST

Change-Id: Ib68112de985a3d714c2071f47c10e907e4f0229a
2017-10-04 13:41:04 +02:00
Joerg Bornemann
16f144db29 Do not define _HAS_EXCEPTIONS=0 in MSVC builds
This definition causes a build error if concrt.h is included.

According to Microsoft [1], this macro is unsupported. It was added in
f5908363 to silence compiler warnings that are generated when exceptions
are turned off and certain STL headers are included.

We specifically disable the warnings in question now.

[1] https://blogs.msdn.microsoft.com/vcblog/2015/07/14/stl-fixes-in-vs-2015-part-2/

Task-number: QTBUG-63409
Change-Id: I567d5d46292fbd7898394e217bb0987fbcdca9de
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-09-27 13:13:41 +00:00
Thiago Macieira
dfdc466dc1 Add proper detection of x86 RDRAND instruction
The instruction is "RDRAND", but the feature name, according to GCC, is
RDRND, so I had to change some macros in qsimd_p.h.

Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5166779137e63
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-06-12 06:14:48 +00:00
Oliver Wolff
5f0ce2333f Remove -permissive- flag from MSVC 2017 build
The flag makes the build fail for UWP as well as desktop Windows . It
will trigger a compile error as soon as UWP API is used, which happens
in qtbase for desktop in the direct2d backend, but it is also used for
other Qt modules, so we decided to disable the flag for now.

This patch partly reverts b7d76e533c

Task-number: QTBUG-61239
Change-Id: I0cc630f4c09c52f0c116f4a7b95a44c3a55e0be3
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
2017-06-06 14:05:44 +00:00
Thiago Macieira
b7d76e533c MSVC: Enable standard-conformance mode by default
That's not the same as -Za.

Change-Id: Ica9894dc9b5e48278fd4fffd14bb316b687abffe
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-06-03 03:35:57 +00:00
Thiago Macieira
255d291efd MSVC: Enable standards-conforming mode
Let's not allow any new code that uses non-conforming syntaxes. With
GCC and like, we already use -std=c++11 instead of -std=gnu++11 for that
very reason.

Change-Id: I4a7dc1fe14154695b968fffd14aba9f8cea69c47
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2017-04-20 05:39:27 +00:00
Thiago Macieira
280e321e52 Fix detection of F16C for the Intel compiler (again) and Visual Studio
Neither the Intel compiler nor Visual C++ have a dedicated switch to
enable F16C support, like GCC and Clang do. So we used the AVX switch
for that in commit 8241d51f70, as it was
the closest, lowest denominator. That was incorrect and insufficient.

The Intel compiler silently miscompiles the intrinsics with -xAVX,
making calls to out-of-line functions like _mm_cvtps_ph, which don't
exist. So we actually have to use AVX2 support to generate correct code.
That might be a problem later, since Ivy Bridge supports F16C but not
AVX2.

Visual C++ is able to generate F16C code with just -arch:AVX.

Either way, since there's no dedicated command-line switch, there's also
no dedicated preprocessor macro. We're using __AVX2__ for both
compilers, as that's a sufficient condition to indicate a processor that
supports F16C.

Change-Id: I27b55fdf514247549455fffd14b205b8d8b86da7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2017-04-06 04:15:07 +00:00
Liang Qi
dd756011da Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts:
	configure.json
	mkspecs/win32-icc/qmake.conf

Change-Id: Ibf40546b024d644c7d9ed490bee15b82597f4d3f
2017-02-08 15:49:18 +01:00
Jian Liang
015b53e9b4 Turn on -utf-8 compiler option for msvc2015 update 2 and up
Building qt with msvc would fail with the -developer-build configure
option turned on under simplified chinese locale.
This is because msvc will emit warnings for source files with utf-8
characters which are not representable in CP936, and -developer-build
implies treating warnings as errors.
This patch turn on -utf-8 compiler option for msvc2015 update 2
and up only for building qt.

Task-number: QTBUG-58161
Change-Id: If38ea11eb1f39f8e08efa1cccb92e0eea50daf92
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-01 15:04:02 +00:00
Liang Qi
318b58562a Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	.qmake.conf
	mkspecs/common/msvc-desktop.conf
	mkspecs/common/msvc-version.conf
	mkspecs/common/winrt_winphone/qmake.conf
	mkspecs/features/mac/default_post.prf
	mkspecs/features/mac/sdk.prf
	mkspecs/features/qt.prf
	mkspecs/features/uikit/default_post.prf
	mkspecs/features/winrt/default_pre.prf
	mkspecs/winphone-arm-msvc2013/qmake.conf
	mkspecs/winphone-x86-msvc2013/qmake.conf
	mkspecs/winrt-arm-msvc2013/qmake.conf
	mkspecs/winrt-x64-msvc2013/qmake.conf
	mkspecs/winrt-x86-msvc2013/qmake.conf
	qmake/generators/win32/msvc_vcproj.cpp
	src/gui/kernel/qwindowsysteminterface.cpp
	src/network/kernel/qhostaddress.cpp
	src/plugins/platforms/mirclient/qmirclientplugin.cpp
	src/plugins/platforms/mirclient/qmirclientplugin.h
	src/widgets/util/qsystemtrayicon.cpp
	tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
	tools/configure/Makefile.mingw
	tools/configure/Makefile.win32

Done-with: Jake Petroules <jake.petroules@qt.io>
Done-with: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Change-Id: I4be3262d3994e11929d3b1ded2c3379783797dbe
2017-01-25 20:06:06 +01:00
Thiago Macieira
04403d5b12 Merge all "win32-msvc*" mkspecs into one
Since we can tell the MSVC version from the compiler now, each of the
qmake.conf files is now the same, so let's just have "win32-msvc" and be
future-proof. Likewise for win32-clang-msvc.

qplatformdefs.h was already common.

Since we can't obtain the MSVC version from the unified mkspec name any
more, I dropped the warning level during the qmake bootstrap to reduce
the number of warnings that need to be disabled from compiler version to
version.

There is no point in keeping the old mkspecs, but configure will re-map
the -platform argument to the unified spec as necessary, to keep
existing configure command lines working.

[ChangeLog][Visual Studio] Qt now has a common mkspec for all Visual
Studio versions, called "win32-msvc". The old names which contained the
version number are now gone (but qmake scopes based on the old names
continue to work). The version of the compiler can be obtained from the
MSC_VER and MSVC_VER variables (for example, for Visual Studio 2015,
those contain the values 1900 and 14.0, respectively). Those variables
are also available with the Intel compiler (win32-icc) and with Clang
(win32-clang-msvc).

Done-with: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Change-Id: Ib57b52598e2f452985e9fffd14587c0a77a5c09c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-12-23 13:45:39 +00:00
Thiago Macieira
4d9fbb3345 Remove hard-coded MS compiler versions from the mkspecs
We're asking the compiler anyway, so we can fully use this information
just as well. Note that this actually happens after the spec itself has
been processed, so it was necessary to delay the version-specific flag
handling as well.

Change-Id: Ib57b52598e2f452985e9fffd14587b581d946022
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-12-23 13:45:26 +00:00