diff mbox series

[2/7] allow to test the standard version outside of lib.c

Message ID 20191128204225.7002-3-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series add support for '-std=c17' | expand

Commit Message

Luc Van Oostenryck Nov. 28, 2019, 8:42 p.m. UTC
Since semantics and supported features can differ between
standard version we may need the supported version.

Allow this by moving the variable 'standard' and the corresponding
enum definition to lib.h

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 lib.c |  8 +-------
 lib.h | 11 +++++++++++
 2 files changed, 12 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/lib.c b/lib.c
index 7866800bf..97d8af390 100644
--- a/lib.c
+++ b/lib.c
@@ -318,13 +318,7 @@  int funsigned_char = -1;
 
 int preprocess_only;
 
-static enum { STANDARD_C89,
-              STANDARD_C94,
-              STANDARD_C99,
-              STANDARD_C11,
-              STANDARD_GNU11,
-              STANDARD_GNU89,
-              STANDARD_GNU99, } standard = STANDARD_GNU89;
+enum standard standard = STANDARD_GNU89;
 
 static int arch_msize_long = 0;
 int arch_m64 = ARCH_M64_DEFAULT;
diff --git a/lib.h b/lib.h
index 684a4955d..1eb455618 100644
--- a/lib.h
+++ b/lib.h
@@ -224,6 +224,17 @@  enum {
 };
 extern int arch_cmodel;
 
+enum standard {
+	STANDARD_C89,
+	STANDARD_C94,
+	STANDARD_C99,
+	STANDARD_C11,
+	STANDARD_GNU11,
+	STANDARD_GNU89,
+	STANDARD_GNU99,
+};
+extern enum standard standard;
+
 extern void dump_macro_definitions(void);
 extern struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list **files);
 extern struct symbol_list *__sparse(char *filename);