[gnome-code-assistance] Force -xc++ flag when compiling with CXX



commit f1afbe50e5fc2c2f573622180efdbf03ede77d97
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Wed Dec 4 12:08:01 2013 +0100

    Force -xc++ flag when compiling with CXX

 backends/c/makefileintegration.py |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/backends/c/makefileintegration.py b/backends/c/makefileintegration.py
index cb52327..0d7cdbd 100644
--- a/backends/c/makefileintegration.py
+++ b/backends/c/makefileintegration.py
@@ -317,6 +317,7 @@ class MakefileIntegration:
             return []
 
         fakecc = '__GCA_C_COMPILE_FLAGS__'
+        fakecxx = '__GCA_CXX_COMPILE_FLAGS__'
 
         wd = os.path.dirname(makefile)
         relsource = os.path.relpath(source, wd)
@@ -330,7 +331,7 @@ class MakefileIntegration:
             relsource,
             'V=1',
             'CC=' + fakecc,
-            'CXX=' + fakecc,
+            'CXX=' + fakecxx,
         ]
 
         args += targets
@@ -344,10 +345,16 @@ class MakefileIntegration:
 
             return []
 
-        regfind = re.compile(fakecc + '([^\n]*)$', re.M)
+        regfind = re.compile('({0}|{1})([^\n]*)$'.format(fakecc, fakecxx), re.M)
 
         for m in regfind.finditer(outstr):
-            return self._filter_flags(makefile, shlex.split(m.group(2)))
+            flags = self._filter_flags(makefile, shlex.split(m.group(2)))
+
+            if m.group(1) == fakecxx:
+                # Force C++ mode
+                flags.append('-xc++')
+
+            return flags
 
         return []
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]