[hackers] [scc] Add a compile option to chose between C89 and C99 || Quentin Rameau

From: <git_AT_suckless.org>
Date: Wed, 11 May 2016 17:47:35 +0200 (CEST)

commit c72e4f86d583352e5ede355a2b1923a7df615669
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Wed May 11 17:40:49 2016 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Wed May 11 17:47:12 2016 +0200

    Add a compile option to chose between C89 and C99

diff --git a/cc1/Makefile b/cc1/Makefile
index 6f97bf8..9dd52e3 100644
--- a/cc1/Makefile
+++ b/cc1/Makefile
_AT_@ -7,7 +7,10 @@ OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \
 
 all: cc1
 
-$(OBJS) : cc1.h ../inc/cc.h ../inc/sizes.h arch/$(ARCH)/arch.h
+../inc/sizes.h:
+ cp ../inc/sizes_$(STD).h $_AT_
+
+$(OBJS): cc1.h ../inc/cc.h ../inc/sizes.h arch/$(ARCH)/arch.h
 
 cc1: $(OBJS) ../lib/libcc.a
         $(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $_AT_
diff --git a/cc2/Makefile b/cc2/Makefile
index 34695b6..6b87ba9 100644
--- a/cc2/Makefile
+++ b/cc2/Makefile
_AT_@ -8,8 +8,11 @@ OBJS = main.o parser.o peep.o symbol.o node.o code.o\
 
 all: cc2
 
+../inc/sizes.h:
+ cp ../inc/sizes_$(STD).h $_AT_
+
+$(OBJS): cc2.h ../inc/sizes.h
 
-$(OBJS): cc2.h
 main.o: error.h
 
 error.h: cc2.h
diff --git a/config.mk b/config.mk
index dc6cd88..e7010d9 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -4,6 +4,9 @@ VERSION = 0.1
 # Customize below to fit your system
 ARCH = z80
 DRIVER = posix
+# Remove inc/sizes.h if STD is changed
+# can be c89 or c99
+STD = c89
 
 # paths
 PREFIX = $(HOME)
diff --git a/inc/sizes.h b/inc/sizes.h
deleted file mode 100644
index d78c51f..0000000
--- a/inc/sizes.h
+++ /dev/null
_AT_@ -1,100 +0,0 @@
-/*
- * 15 nesting levels of compound statements, iteration control
- * structures, and selection control structures
- */
-#define NR_BLOCK 15
-/*
- * 8 nesting levels of conditional inclusion
- */
-#define NR_COND 8
-/*
- * 12 pointer, array, and function declarators (in any combinations)
- * modifying an arithmetic, a structure, a union, or an incomplete type
- * in a declaration
- */
-#define NR_DECLARATORS 12
-/*
- * 31 declarators nested by parentheses within a full declarator
- */
-#define NR_SUBTYPE 31
-/*
- * 32 expressions nested by parentheses within a full expression
- */
-#define NR_SUBEXPR 32
-/*
- * 31 significant initial characters in an internal identifier or a
- * macro name
- */
-#define INTIDENTSIZ 31
-/*
- * 6 significant initial characters in an external identifier
- */
-#define EXTIDENTSIZ 6
-/*
- * 511 external identifiers in one translation unit
- */
-#define NR_EXT_IDENT 511
-/*
- * 127 identifiers with block scope declared in one block
- */
-#define NR_INT_IDENT 127
-/*
- * 1024 macro identifiers simultaneously defined in one translation
- * unit
- */
-#define NR_MACROIDENT 1024
-/*
- * 31 parameters in one function definition
- */
-#define NR_FUNPARAM 31
-/*
- * 31 arguments in one function call
- */
-#define NR_FUNARG 31
-/*
- * 31 parameters in one macro definition
- */
-#define NR_MACROPARAM 31
-/*
- * 31 arguments in one macro invocation
- */
-#define NR_MACROARG 31
-/*
- * 509 characters in a logical source line
- */
-#define LINESIZ 509
-/*
- * 509 characters in a character string literal or wide string literal
- * (after concatenation)
- */
-#define STRINGSIZ 509
-/*
- * 32767 bytes in an object (in a hosted environment only)
- */
-#define OBJECTSIZ 32767
-/*
- * 8 nesting levels for #include'd files
- */
-#define NR_INCLUDE 8
-/*
- * 257 case labels for a switch statement (excluding those for any
- * nested switch statements)
- */
-#define NR_SWITCH 257
-/*
- * 127 members in a single structure or union
- */
-#define NR_FIELDS 127
-/*
- * 127 enumeration constants in a single enumeration
- */
-#define NR_ENUM_CTES 127
-/*
- * 15 levels of nested structure or union definitions in a single
- * struct-declaration-list
- */
-#define NR_STRUCT_LEVEL 15
-/*
- * number of defined structs/unions in one translation unit
- */
-#define NR_MAXSTRUCTS 127
diff --git a/inc/sizes_c89.h b/inc/sizes_c89.h
new file mode 100644
index 0000000..d78c51f
--- /dev/null
+++ b/inc/sizes_c89.h
_AT_@ -0,0 +1,100 @@
+/*
+ * 15 nesting levels of compound statements, iteration control
+ * structures, and selection control structures
+ */
+#define NR_BLOCK 15
+/*
+ * 8 nesting levels of conditional inclusion
+ */
+#define NR_COND 8
+/*
+ * 12 pointer, array, and function declarators (in any combinations)
+ * modifying an arithmetic, a structure, a union, or an incomplete type
+ * in a declaration
+ */
+#define NR_DECLARATORS 12
+/*
+ * 31 declarators nested by parentheses within a full declarator
+ */
+#define NR_SUBTYPE 31
+/*
+ * 32 expressions nested by parentheses within a full expression
+ */
+#define NR_SUBEXPR 32
+/*
+ * 31 significant initial characters in an internal identifier or a
+ * macro name
+ */
+#define INTIDENTSIZ 31
+/*
+ * 6 significant initial characters in an external identifier
+ */
+#define EXTIDENTSIZ 6
+/*
+ * 511 external identifiers in one translation unit
+ */
+#define NR_EXT_IDENT 511
+/*
+ * 127 identifiers with block scope declared in one block
+ */
+#define NR_INT_IDENT 127
+/*
+ * 1024 macro identifiers simultaneously defined in one translation
+ * unit
+ */
+#define NR_MACROIDENT 1024
+/*
+ * 31 parameters in one function definition
+ */
+#define NR_FUNPARAM 31
+/*
+ * 31 arguments in one function call
+ */
+#define NR_FUNARG 31
+/*
+ * 31 parameters in one macro definition
+ */
+#define NR_MACROPARAM 31
+/*
+ * 31 arguments in one macro invocation
+ */
+#define NR_MACROARG 31
+/*
+ * 509 characters in a logical source line
+ */
+#define LINESIZ 509
+/*
+ * 509 characters in a character string literal or wide string literal
+ * (after concatenation)
+ */
+#define STRINGSIZ 509
+/*
+ * 32767 bytes in an object (in a hosted environment only)
+ */
+#define OBJECTSIZ 32767
+/*
+ * 8 nesting levels for #include'd files
+ */
+#define NR_INCLUDE 8
+/*
+ * 257 case labels for a switch statement (excluding those for any
+ * nested switch statements)
+ */
+#define NR_SWITCH 257
+/*
+ * 127 members in a single structure or union
+ */
+#define NR_FIELDS 127
+/*
+ * 127 enumeration constants in a single enumeration
+ */
+#define NR_ENUM_CTES 127
+/*
+ * 15 levels of nested structure or union definitions in a single
+ * struct-declaration-list
+ */
+#define NR_STRUCT_LEVEL 15
+/*
+ * number of defined structs/unions in one translation unit
+ */
+#define NR_MAXSTRUCTS 127
Received on Wed May 11 2016 - 17:47:35 CEST

This archive was generated by hypermail 2.3.0 : Wed May 11 2016 - 17:48:15 CEST