From 062efe6ab851c1a926dae5c9202558e885e89f31 Mon Sep 17 00:00:00 2001 From: Urs Janssen Date: Thu, 14 Feb 2013 08:24:51 +0100 Subject: [PATCH] - make clang accept unportable code in libtcc1.c - add -dumpversion cmd.line opt --- Makefile | 5 +++++ libtcc.c | 5 +++++ tcc.c | 1 + 3 files changed, 11 insertions(+) diff --git a/Makefile b/Makefile index 426fbb97..21632fc1 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,11 @@ endif endif endif +# make clang accept gnuisms in libtcc1.c +ifeq ($(CC),clang) +CFLAGS+=-fheinous-gnu-extensions +endif + ifdef CONFIG_WIN64 CONFIG_WIN32=yes endif diff --git a/libtcc.c b/libtcc.c index 6ec7a835..3bcc5d52 100644 --- a/libtcc.c +++ b/libtcc.c @@ -1643,6 +1643,7 @@ enum { TCC_OPTION_MD, TCC_OPTION_MF, TCC_OPTION_x, + TCC_OPTION_dumpversion }; #define TCC_OPTION_HAS_ARG 0x0001 @@ -1693,6 +1694,7 @@ static const TCCOption tcc_options[] = { { "MD", TCC_OPTION_MD, 0}, { "MF", TCC_OPTION_MF, TCC_OPTION_HAS_ARG }, { "x", TCC_OPTION_x, TCC_OPTION_HAS_ARG }, + { "dumpversion", TCC_OPTION_dumpversion, 0}, { NULL, 0, 0 }, }; @@ -1870,6 +1872,9 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) case TCC_OPTION_MF: s->deps_outfile = tcc_strdup(optarg); break; + case TCC_OPTION_dumpversion: + printf ("%s\n", TCC_VERSION); + exit(0); case TCC_OPTION_O: case TCC_OPTION_pedantic: case TCC_OPTION_pipe: diff --git a/tcc.c b/tcc.c index f4ff3f84..7c1b133a 100644 --- a/tcc.c +++ b/tcc.c @@ -38,6 +38,7 @@ static void help(void) " -w disable all warnings\n" " -v show version\n" " -vv show included files (as sole argument: show search paths)\n" + " -dumpversion\n" " -bench show compilation statistics\n" "Preprocessor options:\n" " -E preprocess only\n" -- 2.11.4.GIT