diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-08 23:05:59 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-12-01 21:34:32 +0100 |
commit | 8d87c56817a360888af78c4a5c1dd23134feac12 (patch) | |
tree | 17439d401fd6f27a6ba171521f57a3c9b4cb491a | |
parent | 9307a65efd1945b9023dcb201b9b0609e8ea5f14 (diff) | |
download | sparse-8d87c56817a360888af78c4a5c1dd23134feac12.tar.gz |
teach sparse about C17
No real support is done here (or is needed) but the __STDC_VERSION__
will return the correct value.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | lib.c | 13 | ||||
-rw-r--r-- | lib.h | 2 |
2 files changed, 15 insertions, 0 deletions
@@ -1079,6 +1079,15 @@ static char **handle_switch_s(const char *arg, char **next) else if (!strcmp(arg, "gnu11")) standard = STANDARD_GNU11; + else if (!strcmp(arg, "c17") || + !strcmp(arg, "c18") || + !strcmp(arg, "iso9899:2017") || + !strcmp(arg, "iso9899:2018")) + standard = STANDARD_C17; + else if (!strcmp(arg, "gnu17") || + !strcmp(arg, "gnu18")) + standard = STANDARD_GNU17; + else die ("Unsupported C dialect"); } @@ -1421,6 +1430,10 @@ static void predefined_macros(void) case STANDARD_GNU11: predefine("__STDC_VERSION__", 1, "201112L"); break; + case STANDARD_C17: + case STANDARD_GNU17: + predefine("__STDC_VERSION__", 1, "201710L"); + break; } if (!(standard & STANDARD_GNU) && (standard != STANDARD_NONE)) predefine("__STRICT_ANSI__", 1, "1"); @@ -235,6 +235,8 @@ enum standard { STANDARD_GNU99 = STANDARD_C99 | STANDARD_GNU, STANDARD_C11, STANDARD_GNU11 = STANDARD_C11 | STANDARD_GNU, + STANDARD_C17, + STANDARD_GNU17 = STANDARD_C17 | STANDARD_GNU, }; extern enum standard standard; |