From 39d586d7fc7e576373ae85770bea5839b6b9b8cb Mon Sep 17 00:00:00 2001 From: Christian Jullien Date: Mon, 28 Jun 2021 13:07:29 +0200 Subject: [PATCH] gcc compiles .h files as .c source code, tcc now does the same and no longer complains with "unrecognized file type". It is however adviced to use "-x c" option which exists for this purpose in gcc and was supported by tcc. --- libtcc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libtcc.c b/libtcc.c index ec33591a..e209a19e 100644 --- a/libtcc.c +++ b/libtcc.c @@ -1082,7 +1082,9 @@ LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename) filetype = AFF_TYPE_ASMPP; else if (!strcmp(ext, "s")) filetype = AFF_TYPE_ASM; - else if (!PATHCMP(ext, "c") || !PATHCMP(ext, "i")) + else if (!PATHCMP(ext, "c") + || !PATHCMP(ext, "h") + || !PATHCMP(ext, "i")) filetype = AFF_TYPE_C; else filetype |= AFF_TYPE_BIN;