-
-
Save lukexi/e11668ced04524564a8b to your computer and use it in GitHub Desktop.
Clang wrapper script to pass "-x assembler-with-cpp" to clang in preprocessor mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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