Skip to content

Instantly share code, notes, and snippets.

@kaityo256
Created November 10, 2015 07:34
Show Gist options
  • Save kaityo256/c981099cb644bd39c692 to your computer and use it in GitHub Desktop.
Save kaityo256/c981099cb644bd39c692 to your computer and use it in GitHub Desktop.
clangの警告オプション一覧表示スクリプト ref: http://qiita.com/kaityo256/items/a2ea1474973cd938c50c
list = Array.new
str = ""
while line=gets
next if line=~/^\s*\/\//
next if line.chomp.strip == ""
str = str + line.chomp.strip
if line=~/\;/
list.push str
str = ""
end
end
class Diag
def initialize(name, value, array)
@name = name
@value = value
@array = array
end
def isLeaf
return @array == []
end
def show(aliasHash, diagHash, l=0)
if @array == []
l.times{print " "}
puts @name
else
l.times{print " "}
puts @name
@array.each{|v|
name = aliasHash[v.strip]
d = diagHash[name]
d.show(aliasHash,diagHash,l+1)
}
end
end
end
diagHash = Hash.new
aliasHash = Hash.new
list.each{|line|
if line=~/def(.*): DiagGroup<\"(.*)\".*,.*\[(.*)\]>/
a = $1.strip
name = $2.strip
array = $3.split(/,/)
d = Diag.new(name,a, array)
diagHash[name] = d
aliasHash[a] = name if a != ""
elsif line=~/def (.*)\s*:\s*DiagGroup<\"(.*)\">/
a = $1.strip
name = $2.strip
d = Diag.new(name, a, [])
diagHash[name] = d
aliasHash[a] = name if a != ""
end
}
diagHash["all"].show(aliasHash, diagHash)
$ ruby diag.rb DiagnosticGroups.td
all
most
char-subscripts
comment
delete-non-virtual-dtor
format
format-extra-args
format-zero-length
nonnull
format-security
format-y2k
format-invalid-specifier
implicit
implicit-function-declaration
implicit-int
infinite-recursion
mismatched-tags
missing-braces
move
pessimizing-move
redundant-move
self-move
multichar
reorder
return-type
return-type-c-linkage
self-assign
self-assign-field
self-move
sizeof-array-argument
sizeof-array-decay
string-plus-int
trigraphs
uninitialized
sometimes-uninitialized
static-self-init
unknown-pragmas
unused
unused-argument
unused-function
unneeded-internal-declaration
unused-label
unused-private-field
unused-local-typedef
unused-value
unused-comparison
unused-result
unevaluated-expression
potentially-evaluated-expression
unused-variable
unused-const-variable
unused-property-ivar
volatile-register-var
objc-missing-super-calls
objc-designated-initializers
overloaded-virtual
private-extern
cast-of-sel-type
extern-c-compat
parentheses
logical-op-parentheses
logical-not-parentheses
bitwise-op-parentheses
shift-op-parentheses
overloaded-shift-op-parentheses
parentheses-equality
dangling-else
switch
switch-bool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment