Permalink
Browse files

Use clang for preprocessor

  • Loading branch information...
1 parent 4779fc7 commit 2e9b611eb15be186735f3d61d392df559bee2d06 @dlee committed Feb 27, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/cast/preprocessor.rb
View
@@ -33,6 +33,9 @@ def preprocess(text)
file.puts text
end
output = `#{full_command(filename)} 2>&1`
+ # workaround clang anomalies
+ output.gsub!(/;\r?\n\s+struct <anonymous struct at.*>/, '')
+ output.gsub!(/\} union/, '}')
if $? == 0
return output
else
@@ -67,7 +70,7 @@ def full_command(filename)
shellquote("-D#{key}" + (val ? "=#{val}" : ''))
end.join(' ')
filename = shellquote(filename)
- "#{Preprocessor.command} -P -std=c99 -imacros stdarg.h #{include_args} #{macro_args} #{filename}"
+ "clang -cc1 -ast-print #{include_args} #{macro_args} #{filename}"
end
end
end

0 comments on commit 2e9b611

Please sign in to comment.