diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-05-09 17:06:18 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-08-11 16:07:45 +0000 |
commit | d0404591b1d0c6ef4e040f578d8c56b3001abb3e (patch) | |
tree | 0051337c66eca0fe152e3f1e76e9da0247f2a861 /share/qbs/modules/cpp/gcc.js | |
parent | ed99a39fd9bb38163d81cef5011f7bb4401a9eef (diff) | |
download | qbs-d0404591b1d0c6ef4e040f578d8c56b3001abb3e.tar.gz |
Automatically determine built-in compiler defines
This provides users with access to the full list of macros defined by
the MSVC, GCC, Clang, or MinGW compiler in use.
Change-Id: I6e7f6841bbc18aed13958724b268283d97b17320
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'share/qbs/modules/cpp/gcc.js')
-rw-r--r-- | share/qbs/modules/cpp/gcc.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index 8214373ab..d86f814e7 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -1259,7 +1259,7 @@ function isNumericProductVersion(version) { return version && version.match(/^([0-9]+\.){0,3}[0-9]+$/); } -function dumpMacros(env, compilerFilePath, args, nullDevice) { +function dumpMacros(env, compilerFilePath, args, nullDevice, tag) { var p = new Process(); try { p.setEnv("LC_ALL", "C"); @@ -1267,7 +1267,8 @@ function dumpMacros(env, compilerFilePath, args, nullDevice) { p.setEnv(key, env[key]); // qcc NEEDS the explicit -Wp, prefix to -dM; clang and gcc do not but all three accept it p.exec(compilerFilePath, - (args || []).concat(["-Wp,-dM", "-E", "-x", "c", nullDevice]), true); + (args || []).concat(["-Wp,-dM", "-E", "-x", languageName(tag || "c") , nullDevice]), + true); var map = {}; p.readStdOut().trim().split("\n").map(function (line) { var parts = line.split(" ", 3); |