Toolchain: Fix -std=gnu++XX gcc/clang option parsing

Now -std=gnu++XX is handled like -std=c++XX
In particular, gnu++1y is correctly mapped to StandardCxx14 instead
of StandardCxx11, and gnu++14, gnu++17 and gnu++1z are recognized.
This makes clang static analyzer plugin for for C++14/17 code bases.

Task-number: QTCREATORBUG-16290
Change-Id: I2018b9a365bb0a9cae7573b4e4f74deb830a7758
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Antoine Poliakov
2016-05-27 14:38:22 +02:00
parent fad1f14d64
commit ab3e5d0ed1
+7 -1
View File
@@ -431,9 +431,15 @@ ToolChain::CompilerFlags GccToolChain::compilerFlags(const QStringList &cxxflags
} else if (std == "c++17" || std == "c++1z") {
flags |= StandardCxx17;
flags &= ~CompilerFlags(StandardCxx11 | StandardCxx14 | GnuExtensions);
} else if (std == "gnu++0x" || std == "gnu++11" || std== "gnu++1y") {
} else if (std == "gnu++0x" || std == "gnu++11") {
flags |= CompilerFlags(StandardCxx11 | GnuExtensions);
flags &= ~CompilerFlags(StandardCxx14 | StandardCxx17);
} else if (std== "gnu++14" || std == "gnu++1y") {
flags |= CompilerFlags(StandardCxx14 | GnuExtensions);
flags &= ~CompilerFlags(StandardCxx11 | StandardCxx17);
} else if (std== "gnu++17" || std == "gnu++1z") {
flags |= CompilerFlags(StandardCxx17 | GnuExtensions);
flags &= ~CompilerFlags(StandardCxx11 | StandardCxx14);
} else if (std == "c89" || std == "c90"
|| std == "iso9899:1990" || std == "iso9899:199409") {
flags &= ~CompilerFlags(StandardC99 | StandardC11);