aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-01-17 14:19:43 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2019-01-17 14:45:52 +0000
commit8c1a6dd96234c0a4bb0b4905341f6faeaa232108 (patch)
tree259a83a98fa1d9f9bfd2d0c302f4a2cd30683dad
parent5f15a0ba4102c4f2ada3d78d47bbff0c5f8c2233 (diff)
C++ scanner: Register for rc files
Windows resource files can have #include statements. This was either overlooked from the beginning or we broke it at some point. Change-Id: I3483e8caf352f557768429cf3c4f9b3293fec38d Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/plugins/scanner/cpp/cppscanner.cpp2
-rw-r--r--tests/auto/api/testdata/rc/rc.qbs2
-rw-r--r--tests/auto/api/testdata/rc/subdir/rc-include.h0
-rw-r--r--tests/auto/api/testdata/rc/test.rc2
-rw-r--r--tests/auto/api/tst_api.cpp30
5 files changed, 29 insertions, 7 deletions
diff --git a/src/plugins/scanner/cpp/cppscanner.cpp b/src/plugins/scanner/cpp/cppscanner.cpp
index 1d7fb7c84..067127d00 100644
--- a/src/plugins/scanner/cpp/cppscanner.cpp
+++ b/src/plugins/scanner/cpp/cppscanner.cpp
@@ -311,7 +311,7 @@ static const char **additionalFileTags(void *opaq, int *size)
ScannerPlugin includeScanner =
{
"include_scanner",
- "cpp,cpp_pch_src,c,c_pch_src,objcpp,objcpp_pch_src,objc,objc_pch_src",
+ "cpp,cpp_pch_src,c,c_pch_src,objcpp,objcpp_pch_src,objc,objc_pch_src,rc",
openScanner,
closeScanner,
next,
diff --git a/tests/auto/api/testdata/rc/rc.qbs b/tests/auto/api/testdata/rc/rc.qbs
index 5b49c5de9..212adc4af 100644
--- a/tests/auto/api/testdata/rc/rc.qbs
+++ b/tests/auto/api/testdata/rc/rc.qbs
@@ -5,6 +5,8 @@ Application {
Depends { name: 'cpp' }
+ cpp.includePaths: "subdir"
+
files: [
"main.cpp",
"test.rc"
diff --git a/tests/auto/api/testdata/rc/subdir/rc-include.h b/tests/auto/api/testdata/rc/subdir/rc-include.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/auto/api/testdata/rc/subdir/rc-include.h
diff --git a/tests/auto/api/testdata/rc/test.rc b/tests/auto/api/testdata/rc/test.rc
index a8e5fd39b..ff7a72003 100644
--- a/tests/auto/api/testdata/rc/test.rc
+++ b/tests/auto/api/testdata/rc/test.rc
@@ -1,5 +1,7 @@
#define IDR_VERSION1 1
+#include <rc-include.h>
+
IDR_VERSION1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp
index bec33d1dd..228b0e078 100644
--- a/tests/auto/api/tst_api.cpp
+++ b/tests/auto/api/tst_api.cpp
@@ -2380,12 +2380,30 @@ void TestApi::rc()
{
BuildDescriptionReceiver bdr;
ProcessResultReceiver prr;
- const qbs::ErrorInfo errorInfo = doBuildProject("rc", &bdr, &prr);
- if (errorInfo.hasError())
- qDebug() << prr.output;
- VERIFY_NO_ERROR(errorInfo);
- const bool rcFileWasCompiled = bdr.descriptions.contains("compiling test.rc");
- QCOMPARE(rcFileWasCompiled, qbs::Internal::HostOsInfo::isWindowsHost());
+ const auto buildRc = [this, &bdr, &prr]() {
+ bdr.descriptions.clear();
+ bdr.descriptionLines.clear();
+ prr.output.clear();
+ prr.results.clear();
+ const qbs::ErrorInfo errorInfo = doBuildProject("rc", &bdr, &prr);
+ if (errorInfo.hasError())
+ qDebug() << prr.output;
+ return errorInfo;
+ };
+ const auto rcFileWasCompiled = [&bdr]() {
+ return bdr.descriptions.contains("compiling test.rc");
+ };
+ qbs::ErrorInfo error = buildRc();
+ VERIFY_NO_ERROR(error);
+ QCOMPARE(rcFileWasCompiled(), qbs::Internal::HostOsInfo::isWindowsHost());
+ WAIT_FOR_NEW_TIMESTAMP();
+ error = buildRc();
+ VERIFY_NO_ERROR(error);
+ QVERIFY(!rcFileWasCompiled());
+ touch("subdir/rc-include.h");
+ error = buildRc();
+ VERIFY_NO_ERROR(error);
+ QCOMPARE(rcFileWasCompiled(), qbs::Internal::HostOsInfo::isWindowsHost());
}
void TestApi::referencedFileErrors()