Commit 52ab55fb authored by Milian Wolff's avatar Milian Wolff
Browse files

Always parse code with -Wno-gnu-zero-variadic-macro-arguments

This silences a ton of warnings in Qt code when it uses qCDebug.
The warning from clang isn't really useful for our purpose here,
as it just tells the user that clang behaves like GCC, which is
exactly what we want.
parent 0ff09889
......@@ -72,6 +72,10 @@ void sanitizeArguments(QVector<QByteArray>& arguments)
// Warning as error may cause problem to the clang parser.
const auto asError = QByteArrayLiteral("-Werror=");
const auto documentation = QByteArrayLiteral("-Wdocumentation");
// Silence common warning that arises when we parse as a GCC-lookalike.
// Note how clang warns us about emulating GCC, which is exactly what we want here.
const auto noGnuZeroVaridicMacroArguments = QByteArrayLiteral("-Wno-gnu-zero-variadic-macro-arguments");
bool noGnuZeroVaridicMacroArgumentsFound = false;
for (auto& argument : arguments) {
if (argument == "-Werror") {
argument.clear();
......@@ -80,12 +84,18 @@ void sanitizeArguments(QVector<QByteArray>& arguments)
argument.remove(2, asError.length() - 2);
}
#if CINDEX_VERSION_MINOR < 100 // FIXME https://bugs.llvm.org/show_bug.cgi?id=35333
if (argument == documentation) {
else if (argument == documentation) {
argument.clear();
}
#endif
else if (!noGnuZeroVaridicMacroArgumentsFound && argument == noGnuZeroVaridicMacroArguments) {
noGnuZeroVaridicMacroArgumentsFound = true;
}
}
if (!noGnuZeroVaridicMacroArgumentsFound) {
arguments.append(noGnuZeroVaridicMacroArguments);
}
}
QVector<QByteArray> argsForSession(const QString& path, ParseSessionData::Options options, const ParserSettings& parserSettings)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment