Update name of c++2a to c++20

Keep the c++2a feature, but make it an alias for compatibility
purposes.

Pick-to: 6.1
Change-Id: I6f153109be84659806f1b7a57a88a187875166d8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Kai Köhne 2021-02-09 13:12:09 +01:00
parent ab907053bd
commit 3c412c93c2
9 changed files with 57 additions and 41 deletions

View File

@ -67,12 +67,12 @@ std::visit([](const auto &) { return 1; }, v);
CXX_STANDARD 17 CXX_STANDARD 17
) )
# cxx2a # cxx20
qt_config_compile_test(cxx2a qt_config_compile_test(cxx20
LABEL "C++2a support" LABEL "C++20 support"
CODE CODE
"#if __cplusplus > 201703L "#if __cplusplus > 201703L
// Compiler claims to support experimental C++2a, trust it // Compiler claims to support C++20, trust it
#else #else
# error __cplusplus must be > 201703L (the value for C++17) # error __cplusplus must be > 201703L (the value for C++17)
#endif #endif
@ -594,10 +594,15 @@ qt_feature("c++1z" PUBLIC
CONDITION QT_FEATURE_cxx17 CONDITION QT_FEATURE_cxx17
) )
qt_feature_config("c++1z" QMAKE_PUBLIC_QT_CONFIG) qt_feature_config("c++1z" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c++2a" PUBLIC qt_feature("c++20" PUBLIC
LABEL "C++2a" LABEL "C++20"
AUTODETECT OFF AUTODETECT OFF
CONDITION QT_FEATURE_cxx17 AND TEST_cxx2a CONDITION QT_FEATURE_cxx17 AND TEST_cxx20
)
qt_feature_config("c++20" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c++2a" PUBLIC
LABEL "C++20"
CONDITION QT_FEATURE_cxx20
) )
qt_feature_config("c++2a" QMAKE_PUBLIC_QT_CONFIG) qt_feature_config("c++2a" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c89" qt_feature("c89"
@ -958,7 +963,7 @@ qt_configure_add_summary_entry(
) )
qt_configure_add_summary_entry( qt_configure_add_summary_entry(
TYPE "firstAvailableFeature" TYPE "firstAvailableFeature"
ARGS "c++2a c++17 c++14 c++11" ARGS "c++20 c++17 c++14 c++11"
MESSAGE "Using C++ standard" MESSAGE "Using C++ standard"
) )
qt_configure_add_summary_entry( qt_configure_add_summary_entry(

View File

@ -216,7 +216,7 @@ endfunction()
function(qt_set_language_standards) function(qt_set_language_standards)
## Use the latest standard the compiler supports (same as qt_common.prf) ## Use the latest standard the compiler supports (same as qt_common.prf)
if (QT_FEATURE_cxx2a) if (QT_FEATURE_cxx20)
set(CMAKE_CXX_STANDARD 20 PARENT_SCOPE) set(CMAKE_CXX_STANDARD 20 PARENT_SCOPE)
else() else()
set(CMAKE_CXX_STANDARD 17 PARENT_SCOPE) set(CMAKE_CXX_STANDARD 17 PARENT_SCOPE)

View File

@ -56,7 +56,7 @@ The effort of this is tracked in QTBUG-85373 and QTBUG-85349.
| | or -DFEATURE_<backend> | | | | or -DFEATURE_<backend> | |
| -sanitize address -sanitize undefined | -DECM_ENABLE_SANITIZERS=address;undefined | | | -sanitize address -sanitize undefined | -DECM_ENABLE_SANITIZERS=address;undefined | |
| -coverage <arg> | | | | -coverage <arg> | | |
| -c++std c++2a | -DFEATURE_cxx2a=ON | | | -c++std c++20 | -DFEATURE_cxx20=ON | |
| -sse2/-sse3/-ssse3/-sse4.1 | -DFEATURE_sse4=ON | | | -sse2/-sse3/-ssse3/-sse4.1 | -DFEATURE_sse4=ON | |
| -mips_dsp/-mips_dspr2 | -DFEATURE_mips_dsp=ON | | | -mips_dsp/-mips_dspr2 | -DFEATURE_mips_dsp=ON | |
| -qreal <type> | -DQT_COORD_TYPE=<type> | | | -qreal <type> | -DQT_COORD_TYPE=<type> | |

View File

@ -111,7 +111,7 @@ Build options:
sanitizers or generate instrumented code to collect execution sanitizers or generate instrumented code to collect execution
counts and enable code coverage analysis, respectively. (Clang only) counts and enable code coverage analysis, respectively. (Clang only)
-c++std <edition> .... Select C++ standard <edition> [c++2a/c++17/c++14/c++11] -c++std <edition> .... Select C++ standard <edition> [c++20/c++17/c++14/c++11]
-sse2 ................ Use SSE2 instructions [auto] -sse2 ................ Use SSE2 instructions [auto]
-sse3/-ssse3/-sse4.1/-sse4.2/-avx/-avx2/-avx512 -sse3/-ssse3/-sse4.1/-sse4.2/-avx/-avx2/-avx512

View File

@ -67,12 +67,12 @@ std::visit([](const auto &) { return 1; }, v);
CXX_STANDARD 17 CXX_STANDARD 17
) )
# cxx2a # cxx20
qt_config_compile_test(cxx2a qt_config_compile_test(cxx20
LABEL "C++2a support" LABEL "C++20 support"
CODE CODE
"#if __cplusplus > 201703L "#if __cplusplus > 201703L
// Compiler claims to support experimental C++2a, trust it // Compiler claims to support C++20, trust it
#else #else
# error __cplusplus must be > 201703L (the value for C++17) # error __cplusplus must be > 201703L (the value for C++17)
#endif #endif
@ -607,10 +607,15 @@ qt_feature("c++1z" PUBLIC
CONDITION QT_FEATURE_cxx17 CONDITION QT_FEATURE_cxx17
) )
qt_feature_config("c++1z" QMAKE_PUBLIC_QT_CONFIG) qt_feature_config("c++1z" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c++2a" PUBLIC qt_feature("c++20" PUBLIC
LABEL "C++2a" LABEL "C++20"
AUTODETECT OFF AUTODETECT OFF
CONDITION QT_FEATURE_cxx17 AND TEST_cxx2a CONDITION QT_FEATURE_cxx17 AND TEST_cxx20
)
qt_feature_config("c++20" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c++2a" PUBLIC
LABEL "C++20"
CONDITION QT_FEATURE_cxx20
) )
qt_feature_config("c++2a" QMAKE_PUBLIC_QT_CONFIG) qt_feature_config("c++2a" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("c89" qt_feature("c89"
@ -974,7 +979,7 @@ qt_configure_add_summary_entry(
) )
qt_configure_add_summary_entry( qt_configure_add_summary_entry(
TYPE "firstAvailableFeature" TYPE "firstAvailableFeature"
ARGS "c++2a c++17 c++14 c++11" ARGS "c++20 c++17 c++14 c++11"
MESSAGE "Using C++ standard" MESSAGE "Using C++ standard"
) )
qt_configure_add_summary_entry( qt_configure_add_summary_entry(

View File

@ -363,18 +363,18 @@
"qmake": "CONFIG += c++11 c++14 c++17" "qmake": "CONFIG += c++11 c++14 c++17"
} }
}, },
"cxx2a": { "cxx20": {
"label": "C++2a support", "label": "C++20 support",
"type": "compile", "type": "compile",
"test": { "test": {
"head": [ "head": [
"#if __cplusplus > 201703L", "#if __cplusplus > 201703L",
"// Compiler claims to support experimental C++2a, trust it", "// Compiler claims to support C++20, trust it",
"#else", "#else",
"# error __cplusplus must be > 201703L (the value for C++17)", "# error __cplusplus must be > 201703L (the value for C++17)",
"#endif" "#endif"
], ],
"qmake": "CONFIG += c++11 c++14 c++17 c++2a" "qmake": "CONFIG += c++11 c++14 c++17 c++20"
} }
}, },
"precompile_header": { "precompile_header": {
@ -983,10 +983,15 @@
"condition": "features.c++17", "condition": "features.c++17",
"output": [ "publicFeature", "publicQtConfig" ] "output": [ "publicFeature", "publicQtConfig" ]
}, },
"c++2a": { "c++20": {
"label": "C++2a", "label": "C++20",
"autoDetect": false, "autoDetect": false,
"condition": "features.c++17 && tests.cxx2a", "condition": "features.c++17 && tests.cxx20",
"output": [ "publicFeature", "publicQtConfig" ]
},
"c++2a": {
"label": "C++20",
"condition": "features.c++20",
"output": [ "publicFeature", "publicQtConfig" ] "output": [ "publicFeature", "publicQtConfig" ]
}, },
"c89": { "c89": {
@ -1525,7 +1530,7 @@
{ {
"message": "Using C++ standard", "message": "Using C++ standard",
"type": "firstAvailableFeature", "type": "firstAvailableFeature",
"args": "c++2a c++17 c++14 c++11" "args": "c++20 c++17 c++14 c++11"
}, },
{ {
"type": "feature", "type": "feature",

View File

@ -1210,13 +1210,14 @@
\row \li c++14 \li C++14 support is enabled. This option has no effect if \row \li c++14 \li C++14 support is enabled. This option has no effect if
the compiler does not support C++14, or can't select the C++ standard. the compiler does not support C++14, or can't select the C++ standard.
By default, the compiler default is used. By default, the compiler default is used.
\row \li c++1z \li C++17 support is enabled. This option has no effect if \row \li c++17 \li C++17 support is enabled. This option has no effect if
the compiler does not support C++17, or can't select the C++ standard. the compiler does not support C++17, or can't select the C++ standard.
By default, support is disabled. By default, support is disabled.
\row \li c++17 \li Same as c++1z. \row \li c++1z \li Obsolete alias for c++17.
\row \li c++2a \li C++2a support is enabled. This option has no effect if \row \li c++20 \li C++20 support is enabled. This option has no effect if
the compiler does not support C++2a, or can't select the C++ standard. the compiler does not support C++20, or can't select the C++ standard.
By default, support is disabled. By default, support is disabled.
\row \li c++2a \li Obsolete alias for c++20.
\row \li c++latest \li Support for the latest C++ language standard is \row \li c++latest \li Support for the latest C++ language standard is
enabled that is supported by the compiler. By default, this option is enabled that is supported by the compiler. By default, this option is
disabled. disabled.

View File

@ -152,20 +152,20 @@ function(qt_commandline_cxxstd arg val nextok)
endif() endif()
if(val MATCHES "(c\\+\\+)?11") if(val MATCHES "(c\\+\\+)?11")
qtConfCommandlineSetInput(c++14 no) qtConfCommandlineSetInput(c++14 no)
qtConfCommandlineSetInput(c++1z no) qtConfCommandlineSetInput(c++17 no)
qtConfCommandlineSetInput(c++2a no) qtConfCommandlineSetInput(c++20 no)
elseif(val MATCHES "(c\\+\\+)?(14|1y)") elseif(val MATCHES "(c\\+\\+)?(14|1y)")
qtConfCommandlineSetInput(c++14 yes) qtConfCommandlineSetInput(c++14 yes)
qtConfCommandlineSetInput(c++1z no) qtConfCommandlineSetInput(c++17 no)
qtConfCommandlineSetInput(c++2a no) qtConfCommandlineSetInput(c++20 no)
elseif(val MATCHES "(c\\+\\+)?(17|1z)") elseif(val MATCHES "(c\\+\\+)?(17|1z)")
qtConfCommandlineSetInput(c++14 yes) qtConfCommandlineSetInput(c++14 yes)
qtConfCommandlineSetInput(c++1z yes) qtConfCommandlineSetInput(c++17 yes)
qtConfCommandlineSetInput(c++2a no) qtConfCommandlineSetInput(c++20 no)
elseif(val MATCHES "(c\\+\\+)?2a") elseif(val MATCHES "(c\\+\\+)?(20|2a)")
qtConfCommandlineSetInput(c++14 yes) qtConfCommandlineSetInput(c++14 yes)
qtConfCommandlineSetInput(c++1z yes) qtConfCommandlineSetInput(c++17 yes)
qtConfCommandlineSetInput(c++2a yes) qtConfCommandlineSetInput(c++20 yes)
else() else()
qtConfAddError("Invalid argument '${val}' to command line parameter '${arg}'") qtConfAddError("Invalid argument '${val}' to command line parameter '${arg}'")
endif() endif()

View File

@ -709,7 +709,7 @@ def write_compile_test(
languageStandard = "CXX_STANDARD 14" languageStandard = "CXX_STANDARD 14"
elif details["qmake"] == "CONFIG += c++11 c++14 c++17": elif details["qmake"] == "CONFIG += c++11 c++14 c++17":
languageStandard = "CXX_STANDARD 17" languageStandard = "CXX_STANDARD 17"
elif details["qmake"] == "CONFIG += c++11 c++14 c++17 c++2a": elif details["qmake"] == "CONFIG += c++11 c++14 c++17 c++20":
languageStandard = "CXX_STANDARD 20" languageStandard = "CXX_STANDARD 20"
elif details["qmake"] == "QMAKE_CXXFLAGS += -fstack-protector-strong": elif details["qmake"] == "QMAKE_CXXFLAGS += -fstack-protector-strong":
compileOptions = details["qmake"][18:] compileOptions = details["qmake"][18:]