- make clang accept unportable code in libtcc1.c
authorUrs Janssen <urs@hq.tin.org>
Thu, 14 Feb 2013 07:24:51 +0000 (14 08:24 +0100)
committerUrs Janssen <urs@hq.tin.org>
Thu, 14 Feb 2013 07:24:51 +0000 (14 08:24 +0100)
- add -dumpversion cmd.line opt

Makefile
libtcc.c
tcc.c

index 426fbb9..21632fc 100644 (file)
--- 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
index 6ec7a83..3bcc5d5 100644 (file)
--- 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 f4ff3f8..7c1b133 100644 (file)
--- 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"