cc-wrapper: Don't treat "-" alone as a flag

It means stdin, and is morally equivalent to passing a file. e.g.

  $ echo 'int main(void) { return 0; }' | gcc -x c -

will compile and link a binary.
This commit is contained in:
John Ericson 2017-11-22 16:29:57 -05:00
parent bdd6c037c0
commit 4f869bccc1

View File

@ -59,7 +59,8 @@ while (( "$n" < "$nParams" )); do
cppInclude=0
elif [ "$p" = -nostdinc++ ]; then
cppInclude=0
elif [ "${p:0:1}" != - ]; then
elif [[ "$p" != -?* ]]; then
# A dash alone signifies standard input; it is not a flag
nonFlagArgs=1
fi
n+=1