summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2021-11-24 13:41:37 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-25 10:06:55 +0000
commit598a23e2d1be9966f4c888e6166d132e02241500 (patch)
tree8546028d1d3d7ac861216e0a19e98b57b6a33fde
parentc14b812786e6a71a6d94a9e9a67d209d8e3603fd (diff)
lupdate: Work around offsetof problem when using clang parser
Not setting this define will result in errors like "error: constexpr variable '.' must be initialized by a constant expression" when clang is used with Windows SDK includes. Fixes: QTBUG-97380 Change-Id: If3e76065aa7f41ebe2c5fe122c378ef45ecce5bc Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 286ea6d8fccedd7306f1bb602af673a50e7e3d68) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/linguist/lupdate/cpp_clang.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/linguist/lupdate/cpp_clang.cpp b/src/linguist/lupdate/cpp_clang.cpp
index 2284e58ca..c0ce164fb 100644
--- a/src/linguist/lupdate/cpp_clang.cpp
+++ b/src/linguist/lupdate/cpp_clang.cpp
@@ -194,6 +194,8 @@ clang::tooling::ArgumentsAdjuster getClangArgumentAdjuster()
#ifdef Q_OS_WIN
adjustedArgs.push_back("-fms-compatibility-version=19");
adjustedArgs.push_back("-DQ_COMPILER_UNIFORM_INIT"); // qtbase + clang-cl hack
+ // avoid constexpr error connected with offsetof (QTBUG-97380)
+ adjustedArgs.push_back("-D_CRT_USE_BUILTIN_OFFSETOF");
#endif
adjustedArgs.push_back("-Wno-everything");
adjustedArgs.push_back("-std=gnu++17");