summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2019-08-28 22:46:08 +0200
committerTopi Reinio <topi.reinio@qt.io>2019-09-18 19:31:31 +0200
commit3f7040bb4f47d430921b428f1e2cee43835c2690 (patch)
treead0834674ef88f6790b120641069fadacf1dc07c
parent3403c170ed7a95c6effead6e91aa7d6cb245f9f3 (diff)
qdoc: Fix regression in single-exec mode
A regression was introduced when refactoring QDoc's config system: the processQdocconf() function in main.cpp no longer constructs a new Config object; instead, it sets some config values using Config::setStringList(). However, unlike its name would imply, this function did not (re)set a config variable, it added to it. As a result, when in single-exec mode, the first call (prepare phase) to processQdocconf() worked as expected, as the default boolean variables were set as QStringList("false"), which is correctly evaluated to false. During the second call (generate phase), calling Config::setStringList() again resulted in 'false' boolean variable to be stored as QStringList("false", "false"), which evaluates to true. These boolean variables include REDIRECTOUTPUTTODEVNULL, which unsurprisingly caused problems as it was always set for single- exec builds. To fix this, make Config::setStringList() behave as its name implies, add insertStringList() function to add to an existing variable, and fix the code that tried to combine two string lists to use this new function. Fixes: QTBUG-77897 Change-Id: I62282f31c35e47e4791919688adb4ff49fd2e2df Reviewed-by: Paul Wicking <paul.wicking@qt.io>
-rw-r--r--src/qdoc/config.cpp18
-rw-r--r--src/qdoc/config.h1
-rw-r--r--src/qdoc/main.cpp8
3 files changed, 15 insertions, 12 deletions
diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp
index 0d3a5e945..e41810f7b 100644
--- a/src/qdoc/config.cpp
+++ b/src/qdoc/config.cpp
@@ -309,16 +309,20 @@ void Config::load(const QString &fileName)
}
/*!
- Joins all the strings in \a values into a single string with the
- individual \a values separated by ' '. Then it inserts the result
- into the string list map with \a var as the key.
-
- It also inserts the \a values string list into a separate map,
- also with \a var as the key.
+ Sets the \a values of a configuration variable \a var from a string list.
*/
void Config::setStringList(const QString &var, const QStringList &values)
{
- configVars_.insert(var,ConfigVar(var, values, QDir::currentPath()));
+ configVars_.replace(var, ConfigVar(var, values, QDir::currentPath()));
+}
+
+/*!
+ Adds the \a values from a string list to the configuration variable \a var.
+ Existing value(s) are kept.
+*/
+void Config::insertStringList(const QString &var, const QStringList &values)
+{
+ configVars_.insert(var, ConfigVar(var, values, QDir::currentPath()));
}
/*!
diff --git a/src/qdoc/config.h b/src/qdoc/config.h
index e01e1fa6c..06c1253b1 100644
--- a/src/qdoc/config.h
+++ b/src/qdoc/config.h
@@ -81,6 +81,7 @@ public:
void load(const QString &fileName);
void setStringList(const QString &var, const QStringList &values);
+ void insertStringList(const QString &var, const QStringList &values);
void setOptions(const QDocCommandLineParser &parser);
const QString &programName() const { return prog; }
diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp
index 39ad0c9a2..4f4dcf5c4 100644
--- a/src/qdoc/main.cpp
+++ b/src/qdoc/main.cpp
@@ -234,12 +234,10 @@ static void processQdocconfFile(const QString &fileName, Config &config)
exit(1);
}
/*
- Add the defines to the configuration variables.
+ Add the defines and includepaths to their respective configuration variables.
*/
- QStringList defs = qdocGlobals.defines() + config.getStringList(CONFIG_DEFINES);
- config.setStringList(CONFIG_DEFINES,defs);
- QStringList incs = qdocGlobals.includesPaths() + config.getStringList(CONFIG_INCLUDEPATHS);
- config.setStringList(CONFIG_INCLUDEPATHS, incs);
+ config.insertStringList(CONFIG_DEFINES, qdocGlobals.defines());
+ config.insertStringList(CONFIG_INCLUDEPATHS, qdocGlobals.includesPaths());
Location::terminate();
qdocGlobals.setCurrentDir(QFileInfo(fileName).path());