[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-sparse
Subject: [PATCH 7/7] teach sparse about C17
From: Luc Van Oostenryck <luc.vanoostenryck () gmail ! com>
Date: 2019-11-28 20:42:25
Message-ID: 20191128204225.7002-8-luc.vanoostenryck () gmail ! com
[Download RAW message or body]
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>
---
lib.c | 13 +++++++++++++
lib.h | 2 ++
2 files changed, 15 insertions(+)
diff --git a/lib.c b/lib.c
index 7f7ca846b..8fddae450 100644
--- a/lib.c
+++ b/lib.c
@@ -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");
diff --git a/lib.h b/lib.h
index 7958359c1..3e565c6fd 100644
--- a/lib.h
+++ b/lib.h
@@ -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;
--
2.24.0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic