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 332227 0a1c5b06f3da3ef1e72ea5e82d6724521868fedb
parent 332226 ec1fa4b01b12b1dc30455057dba7d089df133954
child 332228 7cf25e2c60bebe17506582b213aa382c1cdeaa37
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1281968
milestone50.0a1
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)))