From b668b72b0660fd803829e9876302222411b0fa1a Mon Sep 17 00:00:00 2001
From: Petr Skocik <pskocik@gmail.com>
Date: Wed, 9 Oct 2024 08:22:53 +0200
Subject: [PATCH] recognize -std=gnu11 and treat it the same as -std=c11

---
 libtcc.c | 2 +-
 tcc.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libtcc.c b/libtcc.c
index 77a116c2..5f58f40c 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1977,7 +1977,7 @@ dorun:
             s->static_link = 1;
             break;
         case TCC_OPTION_std:
-            if (strcmp(optarg, "=c11") == 0)
+            if (strcmp(optarg, "=c11") == 0 || strcmp(optarg, "=gnu11") == 0)
                 s->cversion = 201112;
             break;
         case TCC_OPTION_shared:
diff --git a/tcc.c b/tcc.c
index 263beba9..6fe0cc0d 100644
--- a/tcc.c
+++ b/tcc.c
@@ -33,8 +33,8 @@ static const char help[] =
     "  -o outfile   set output filename\n"
     "  -run         run compiled source\n"
     "  -fflag       set or reset (with 'no-' prefix) 'flag' (see tcc -hh)\n"
-    "  -std=c99     Conform to the ISO 1999 C standard (default).\n"
-    "  -std=c11     Conform to the ISO 2011 C standard.\n"
+    "  -std=(c99|gnu99)     Conform to the ISO 1999 C standard (default).\n"
+    "  -std=(c11|gnu11)    Conform to the ISO 2011 C standard.\n"
     "  -Wwarning    set or reset (with 'no-' prefix) 'warning' (see tcc -hh)\n"
     "  -w           disable all warnings\n"
     "  -v --version show version\n"