Skip to content

@lukexi /gist:e11668ced04524564a8b secret
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Clang wrapper script to pass "-x assembler-with-cpp" to clang in preprocessor mode
import System.Environment
import System.Process
flags =
[ "-Wno-invalid-pp-token"
, "-Wno-unicode"
, "-Wno-trigraphs"
]
-- See if we're in preprocessor mode
check args@("-E":"-undef":"-traditional":_) = replace args
check other = other
-- make sure we use assembler-with-cpp
replace ("-x":"c":xs) = "-x":"assembler-with-cpp":replace xs
replace (x:xs) = x:replace xs
replace [] = []
main = do
args <- getArgs
rawSystem clang $ flags ++ (check args)
clang = "/usr/bin/clang" -- system clang
--clang = "/usr/local/bin/clang" -- clang 3.4/HEAD
--clang = "/usr/local/clang-3.0/bin/clang"
--clang = "/Users/lukexi/bin/clang-3.2/bin/clang"
--clang = "/Users/lukexi/bin/clang-3.3/bin/clang"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.