Make -E to imply -xc

This commit is contained in:
Rui Ueyama 2020-09-28 22:59:52 +09:00
parent ee0a951b30
commit 4064871212
2 changed files with 8 additions and 0 deletions

4
main.c
View File

@ -203,6 +203,10 @@ static void parse_args(int argc, char **argv) {
if (input_paths.len == 0)
error("no input files");
// -E implies that the input is the C macro language.
if (opt_E)
opt_x = FILE_C;
}
static FILE *open_file(char *path) {

View File

@ -198,4 +198,8 @@ echo 'int x;' > $tmp/foo.c
$chibicc -c -x assembler -x none -o $tmp/foo.o $tmp/foo.c
check '-x none'
# -E
echo foo | $chibicc -E - | grep -q foo
check -E
echo OK