Bug 1281968 - Include the flags passed through CC/CXX in ./mach compileflags; r=gps
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 26 Jul 2016 13:06:52 -0400
changeset 307163 0a1c5b06f3da3ef1e72ea5e82d6724521868fedb
parent 307162 ec1fa4b01b12b1dc30455057dba7d089df133954
child 307164 7cf25e2c60bebe17506582b213aa382c1cdeaa37
push id30506
push usercbook@mozilla.com
push dateFri, 29 Jul 2016 09:56:58 +0000
treeherdermozilla-central@2ea3d51ba1bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1281968
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1281968 - Include the flags passed through CC/CXX in ./mach compileflags; r=gps
python/mozbuild/mozbuild/compilation/codecomplete.py
--- a/python/mozbuild/mozbuild/compilation/codecomplete.py
+++ b/python/mozbuild/mozbuild/compilation/codecomplete.py
@@ -42,17 +42,22 @@ class Introspection(MachCommandBase):
             path_arg.relpath())
 
         if make_dir is None and make_target is None:
             return 1
 
         build_vars = util.get_build_vars(make_dir, self)
 
         if what.endswith('.c'):
+            cc = 'CC'
             name = 'COMPILE_CFLAGS'
         else:
+            cc = 'CXX'
             name = 'COMPILE_CXXFLAGS'
 
         if name not in build_vars:
             return
 
+        # Drop the first flag since that is the pathname of the compiler.
+        flags = (shell_split(build_vars[cc]) + shell_split(build_vars[name]))[1:]
+
         print(' '.join(shell_quote(arg)
-                       for arg in util.sanitize_cflags(shell_split(build_vars[name]))))
+                       for arg in util.sanitize_cflags(flags)))