qmake: Add support for C17/C18

Make it possible to select the C17/C18 standard with
  CONFIG += c17
or
  CONFIG += c18

Pick-to: 6.2 5.15
Fixes: QTBUG-96026
Change-Id: I719d22366c3efda009118d58ead173a25ed285c0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2021-08-26 12:00:50 +02:00
parent a6a216e310
commit 9004575f4b
4 changed files with 9 additions and 1 deletions

View File

@ -86,6 +86,7 @@ QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG -fuse-linker-plugin
QMAKE_CFLAGS_C99 = -std=c99
QMAKE_CFLAGS_C11 = -std=c11
QMAKE_CFLAGS_C17 = -std=c17
QMAKE_CFLAGS_SSE2 += -msse2
QMAKE_CFLAGS_SSE3 += -msse3

View File

@ -121,6 +121,7 @@ greaterThan(QMAKE_MSC_VER, 1927) {
# Visual Studio 2019 (16.8 or 16.9) / Visual C++ 19.28 and up
MSVC_VER = 16.8
QMAKE_CFLAGS_C11 = /std:c11
QMAKE_CFLAGS_C17 = /std:c17
}
!isEmpty(COMPAT_MKSPEC):!$$COMPAT_MKSPEC: CONFIG += $$COMPAT_MKSPEC

View File

@ -153,7 +153,8 @@ c++1z|c++2a {
unset(cxxstd)
}
c99|c11 {
c99|c11|c17|c18 {
c17|c18: cstd = C17
c11: cstd = C11
else: cstd = C99

View File

@ -1208,6 +1208,11 @@
\row \li c11 \li C11 support is enabled. This option has no effect if
the compiler does not support C11, or can't select the C standard.
By default, the compiler default is used.
\row \li c17 \li C17, also known as C18, support is enabled.
This option has no effect if the compiler does not support C17, or
can't select the C standard.
By default, the compiler default is used.
\row \li c18 \li This is an alias for the \c{c17} value.
\row \li strict_c \li Disables support for C compiler extensions.
By default, they are enabled.
\row \li c++11 \li C++11 support is enabled. This option has no effect if