Skip to content
Browse files

Improve cc_args by supporting warning and std options

* cc_args now save -W* and -std=* arguments
* Minor code cleaning
  • Loading branch information...
1 parent 16e5cef commit a9eb9b4086acaf56c986fdd805dcc5d229a51923 @daedric daedric committed Apr 7, 2013
Showing with 10 additions and 7 deletions.
  1. +10 −7 bin/cc_args.py
View
17 bin/cc_args.py
@@ -1,7 +1,6 @@
#!/usr/bin/env python
#-*- coding: utf-8 -*-
-import os
import sys
CONFIG_NAME = ".clang_complete"
@@ -15,8 +14,8 @@ def readConfiguration():
result = []
for line in f.readlines():
strippedLine = line.strip()
- if len(strippedLine) > 0:
- result += [strippedLine]
+ if strippedLine:
+ result.append(strippedLine)
f.close()
return result
@@ -33,6 +32,7 @@ def parseArguments(arguments):
includes = []
defines = []
include_file = []
+ options = []
for arg in arguments:
if nextIsInclude:
@@ -54,20 +54,23 @@ def parseArguments(arguments):
defines += [arg[2:]]
elif arg == "-include":
nextIsIncludeFile = True
+ elif arg.startswith('-std='):
+ options.append(arg)
+ elif arg.startswith('-W'):
+ options.append(arg)
result = list(map(lambda x: "-I" + x, includes))
result.extend(map(lambda x: "-D" + x, defines))
result.extend(map(lambda x: "-include " + x, include_file))
+ result.extend(options)
return result
def mergeLists(base, new):
result = list(base)
for newLine in new:
- try:
- result.index(newLine)
- except ValueError:
- result += [newLine]
+ if newLine not in result:
+ result.append(newLine)
return result
configuration = readConfiguration()

0 comments on commit a9eb9b4

Please sign in to comment.
Something went wrong with that request. Please try again.