at master 1.0 kB view raw
1#!@shell@ 2 3inPreprocessorMode () { 4 hasE=0 5 hasU=0 6 hasT=0 7 for arg in "$@" 8 do 9 if [ 'x-E' = "x$arg" ]; then hasE=1; fi 10 if [ 'x-undef' = "x$arg" ]; then hasU=1; fi 11 if [ 'x-traditional' = "x$arg" ]; then hasT=1; fi 12 done 13 [ "$hasE$hasU$hasT" = '111' ] 14} 15 16extraClangArgs="-Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs" 17 18adjustPreprocessorLanguage () { 19 newArgs='' 20 while [ $# -gt 0 ] 21 do 22 newArgs="$newArgs $1" 23 if [ "$1" = '-x' ] 24 then 25 shift 26 if [ $# -gt 0 ] 27 then 28 if [ "$1" = 'c' ] 29 then 30 newArgs="$newArgs assembler-with-cpp" 31 else 32 newArgs="$newArgs $1" 33 fi 34 fi 35 fi 36 shift 37 done 38 echo $newArgs 39} 40 41if inPreprocessorMode "$@" 42then 43 exec clang $extraClangArgs `adjustPreprocessorLanguage "$@"` 44else 45 exec clang $extraClangArgs "${@/-nodefaultlibs/}" 46fi