aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIvan Komissarov <ABBAPOH@gmail.com>2019-05-10 14:22:58 +0200
committerIvan Komissarov <ABBAPOH@gmail.com>2019-05-11 22:30:45 +0000
commitca4987ae21f3cb30fde699448abc213b37b90214 (patch)
treeaefc4ef529055a028b2efc4af207bf2f34ca1b0b /tests
parent3598640bbdcd9e6447c3c54c0fc1b5b789f3eaa7 (diff)
Add test for precompiled header and redefined macro
This illustrates the warning emitted by clang-cl when macro definition differs in a file and pch. Warning is emitted because of -Wclang-cl-pch flag which is enabled by default Change-Id: I48f39bd77db5be85b9cd2e0226c0b4e7931a9d5b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/blackbox/testdata/precompiled-headers-and-redefine/file.cpp1
-rw-r--r--tests/auto/blackbox/testdata/precompiled-headers-and-redefine/main.cpp33
-rw-r--r--tests/auto/blackbox/testdata/precompiled-headers-and-redefine/pch.h30
-rw-r--r--tests/auto/blackbox/testdata/precompiled-headers-and-redefine/precompiled-headers-and-redefine.qbs16
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp6
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
6 files changed, 87 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/file.cpp b/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/file.cpp
new file mode 100644
index 000000000..1d9f38c57
--- /dev/null
+++ b/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/file.cpp
@@ -0,0 +1 @@
+#include "pch.h"
diff --git a/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/main.cpp b/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/main.cpp
new file mode 100644
index 000000000..e20edd490
--- /dev/null
+++ b/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/main.cpp
@@ -0,0 +1,33 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qbs.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "pch.h"
+
+int main()
+{
+}
diff --git a/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/pch.h b/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/pch.h
new file mode 100644
index 000000000..59d72018e
--- /dev/null
+++ b/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/pch.h
@@ -0,0 +1,30 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qbs.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <algorithm>
+#include <memory>
diff --git a/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/precompiled-headers-and-redefine.qbs b/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/precompiled-headers-and-redefine.qbs
new file mode 100644
index 000000000..55b53a7af
--- /dev/null
+++ b/tests/auto/blackbox/testdata/precompiled-headers-and-redefine/precompiled-headers-and-redefine.qbs
@@ -0,0 +1,16 @@
+CppApplication {
+ name: "MyApp"
+ consoleApplication: true
+ Group {
+ files: ["pch.h"]
+ fileTags: ["cpp_pch_src"]
+ }
+ Group {
+ files: ["file.cpp"]
+ cpp.defines: ["MYDEF=1"]
+ cpp.cxxFlags: base.concat(qbs.toolchain.contains("clang-cl") ? ["-Wno-clang-cl-pch"] : [])
+ }
+ cpp.treatWarningsAsErrors: true
+
+ files: ["main.cpp"]
+}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 5747b52b1..99e1142f8 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -2865,6 +2865,12 @@ void TestBlackbox::precompiledAndPrefixHeaders()
QCOMPARE(runQbs(), 0);
}
+void TestBlackbox::precompiledHeaderAndRedefine()
+{
+ QDir::setCurrent(testDataDir + "/precompiled-headers-and-redefine");
+ QCOMPARE(runQbs(), 0);
+}
+
void TestBlackbox::preventFloatingPointValues()
{
QDir::setCurrent(testDataDir + "/prevent-floating-point-values");
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index f7f1c9a29..5b3adcbe2 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -212,6 +212,7 @@ private slots:
void pkgConfigProbeSysroot();
void pluginDependency();
void precompiledAndPrefixHeaders();
+ void precompiledHeaderAndRedefine();
void preventFloatingPointValues();
void probeChangeTracking();
void probeProperties();