diff options
author | sdefresne@chromium.org <sdefresne@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af> | 2013-12-10 17:45:22 +0000 |
---|---|---|
committer | sdefresne@chromium.org <sdefresne@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af> | 2013-12-10 17:45:22 +0000 |
commit | f910905678d33deefc97f4f23f97773ccbbdd826 (patch) | |
tree | 39fc2ca90eb0b9e7360c5ab82bb83b0f01310307 | |
parent | ebde26be3915c0c7baf9029b8b2e667b0ce3675d (diff) | |
download | gyp-f910905678d33deefc97f4f23f97773ccbbdd826.tar.gz |
Fix gyptest-xcode-gcc.py when using Xcode 5.0.2
With Xcode 5.0.2, gcc is now a special version of clang and it no
longer supports the -Wno-invalid-offsetof. Skip the test then.
BUG=381
R=mark@chromium.org
Review URL: https://codereview.chromium.org/83113002
git-svn-id: http://gyp.googlecode.com/svn/trunk@1809 78cadc50-ecff-11dd-a971-7dbc132099af
-rw-r--r-- | test/mac/gyptest-xcode-gcc.py | 18 | ||||
-rw-r--r-- | test/mac/xcode-gcc/test.gyp | 5 |
2 files changed, 13 insertions, 10 deletions
diff --git a/test/mac/gyptest-xcode-gcc.py b/test/mac/gyptest-xcode-gcc.py index abd88489..e45d0b5e 100644 --- a/test/mac/gyptest-xcode-gcc.py +++ b/test/mac/gyptest-xcode-gcc.py @@ -11,11 +11,23 @@ Verifies that xcode-style GCC_... settings are handled properly. import TestGyp import os +import subprocess import sys def IgnoreOutput(string, expected_string): return True +def CompilerVersion(compiler): + stdout = subprocess.check_output([compiler, '-v'], stderr=subprocess.STDOUT) + return stdout.rstrip('\n') + +def CompilerSupportsWarnAboutInvalidOffsetOfMacro(test): + # "clang" does not support the "-Winvalid-offsetof" flag, and silently + # ignore it. Starting with Xcode 5.0.0, "gcc" is just a "clang" binary with + # some hard-coded include path hack, so use the output of "-v" to detect if + # the compiler supports the flag or not. + return 'clang' not in CompilerVersion('/usr/bin/cc') + if sys.platform == 'darwin': test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode']) @@ -30,11 +42,7 @@ if sys.platform == 'darwin': # clang doesn't warn on invalid offsetofs, it silently ignores # -Wno-invalid-offsetof. - # TODO(thakis): This isn't really the right way to detect the compiler, - # Xcode has some embedded compiler, but it's a reliable proxy at least on - # the bots. The compiler is forced to gcc/g++ in the gyp file in a - # make_global_settings section for ninja and make. - if test.format != 'xcode' or os.readlink('/usr/bin/cc') != 'clang': + if CompilerSupportsWarnAboutInvalidOffsetOfMacro(test): targets.append('warn_about_invalid_offsetof_macro') for target in targets: diff --git a/test/mac/xcode-gcc/test.gyp b/test/mac/xcode-gcc/test.gyp index c0fcb504..1ca8b215 100644 --- a/test/mac/xcode-gcc/test.gyp +++ b/test/mac/xcode-gcc/test.gyp @@ -2,11 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { - 'make_global_settings': [ - ['CC', '/usr/bin/gcc'], - ['CXX', '/usr/bin/g++'], - ], - 'target_defaults': { 'xcode_settings': { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', |