[gnome-code-assistance] Do not override -x if already given
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-code-assistance] Do not override -x if already given
- Date: Wed, 4 Dec 2013 11:13:53 +0000 (UTC)
commit 58bae9a2824eb4ec4f3a6ea796a46ccd78f82947
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Wed Dec 4 12:13:30 2013 +0100
Do not override -x if already given
backends/c/makefileintegration.py | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/backends/c/makefileintegration.py b/backends/c/makefileintegration.py
index 0d7cdbd..38e416d 100644
--- a/backends/c/makefileintegration.py
+++ b/backends/c/makefileintegration.py
@@ -351,19 +351,27 @@ class MakefileIntegration:
flags = self._filter_flags(makefile, shlex.split(m.group(2)))
if m.group(1) == fakecxx:
- # Force C++ mode
- flags.append('-xc++')
+ flags = self._force_cxx_if_needed(flags)
return flags
return []
+ def _force_cxx_if_needed(self, flags):
+ for f in flags:
+ if f.startswith('-x'):
+ return flags
+
+ flags.append('-xc++')
+ return flags
+
def _filter_flags(self, makefile, flags):
# Keep only interesting flags:
# -I: include paths
# -D: defines
# -W: warnings
# -f: compiler flags
+ # -x: language
i = 0
inexpand = False
@@ -400,12 +408,12 @@ class MakefileIntegration:
ret.append('-I')
ret.append(ipath)
- elif v == 'D' or v == 'f' or v == 'W':
+ elif v == 'D' or v == 'f' or v == 'W' or v == 'x':
# pass defines, compiler flags and warnings
ret.append(flag)
# Also add the argument if its not embedded
- if v == 'D' and len(flag) == 2 and i < len(flags):
+ if (v == 'D' or v == 'x') and len(flag) == 2 and i < len(flags):
ret.append(flags[i])
i += 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]