[hackers] [scc] Replace sizes.h with cstd.h || Quentin Rameau

From: <git_AT_suckless.org>
Date: Sat, 10 Dec 2016 16:06:20 +0100 (CET)

commit 48f5c933ab39f441a2d488e74769fd318be12c73
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Sat Dec 10 12:56:39 2016 +0100
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Sat Dec 10 16:05:59 2016 +0100

    Replace sizes.h with cstd.h
    
    And get rid of the file copy of the header, use include path instead.

diff --git a/Makefile b/Makefile
index 588d808..a755a69 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -60,4 +60,3 @@ clean:
 
 distclean: clean
         rm -rf bin
- rm inc/sizes.h
diff --git a/cc1/Makefile b/cc1/Makefile
index 8b36fb1..1aca22d 100644
--- a/cc1/Makefile
+++ b/cc1/Makefile
_AT_@ -1,6 +1,8 @@
 # See LICENSE file for copyright and license details.
 .POSIX:
 
+CSTDINC = -I../inc/$(STD)
+
 include ../config.mk
 
 OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \
_AT_@ -9,10 +11,7 @@ OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \
 all: cc1-$(ARCH)
 
 cpp.o: stallman.msg
-$(OBJS): cc1.h ../inc/cc.h ../inc/sizes.h
-
-../inc/sizes.h:
- cp ../inc/sizes_$(STD).h $_AT_
+$(OBJS): cc1.h ../inc/cc.h ../inc/$(STD)/cstd.h
 
 ../lib/libcc.a:
         cd ../lib && $(MAKE) -e
diff --git a/cc1/cpp.c b/cc1/cpp.c
index 12b6aa5..5942cf1 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -7,7 +7,7 @@ static char sccsid[] = "@(#) ./cc1/cpp.c";
 #include <string.h>
 #include <time.h>
 
-#include "../inc/sizes.h"
+#include <cstd.h>
 #include "../inc/cc.h"
 #include "cc1.h"
 
diff --git a/cc1/decl.c b/cc1/decl.c
index c37b6ca..78ef0cf 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -6,7 +6,7 @@ static char sccsid[] = "@(#) ./cc1/decl.c";
 #include <stdlib.h>
 #include <string.h>
 
-#include "../inc/sizes.h"
+#include <cstd.h>
 #include "../inc/cc.h"
 #include "cc1.h"
 
diff --git a/cc1/expr.c b/cc1/expr.c
index a759cc9..f412618 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -5,8 +5,8 @@ static char sccsid[] = "@(#) ./cc1/expr.c";
 #include <stdlib.h>
 #include <string.h>
 
+#include <cstd.h>
 #include "../inc/cc.h"
-#include "../inc/sizes.h"
 #include "cc1.h"
 
 #define XCHG(lp, rp, np) (np = lp, lp = rp, rp = np)
diff --git a/cc1/init.c b/cc1/init.c
index 935a856..1f55e01 100644
--- a/cc1/init.c
+++ b/cc1/init.c
_AT_@ -5,8 +5,8 @@ static char sccsid[] = "@(#) ./cc1/init.c";
 #include <stdlib.h>
 #include <string.h>
 
+#include <cstd.h>
 #include "../inc/cc.h"
-#include "../inc/sizes.h"
 #include "cc1.h"
 
 
diff --git a/cc1/lex.c b/cc1/lex.c
index d03b031..9b31721 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
_AT_@ -7,7 +7,7 @@ static char sccsid[] = "@(#) ./cc1/lex.c";
 #include <stdlib.h>
 #include <string.h>
 
-#include "../inc/sizes.h"
+#include <cstd.h>
 #include "../inc/cc.h"
 #include "cc1.h"
 
diff --git a/cc1/stmt.c b/cc1/stmt.c
index a5dfae6..a3ee25e 100644
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
_AT_@ -4,8 +4,8 @@ static char sccsid[] = "@(#) ./cc1/stmt.c";
 #include <setjmp.h>
 #include <stdio.h>
 
+#include <cstd.h>
 #include "../inc/cc.h"
-#include "../inc/sizes.h"
 #include "cc1.h"
 
 Symbol *curfun;
diff --git a/cc1/symbol.c b/cc1/symbol.c
index a331ef5..cef063a 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -5,8 +5,8 @@ static char sccsid[] = "@(#) ./cc1/symbol.c";
 #include <stdlib.h>
 #include <string.h>
 
+#include <cstd.h>
 #include "../inc/cc.h"
-#include "../inc/sizes.h"
 #include "cc1.h"
 
 #define NR_SYM_HASH 64
diff --git a/cc1/types.c b/cc1/types.c
index 7f8ba72..783b5a5 100644
--- a/cc1/types.c
+++ b/cc1/types.c
_AT_@ -5,7 +5,7 @@ static char sccsid[] = "@(#) ./cc1/types.c";
 #include <stdlib.h>
 #include <string.h>
 
-#include "../inc/sizes.h"
+#include <cstd.h>
 #include "../inc/cc.h"
 #include "cc1.h"
 
diff --git a/cc2/Makefile b/cc2/Makefile
index 244b137..ca1d6a4 100644
--- a/cc2/Makefile
+++ b/cc2/Makefile
_AT_@ -1,6 +1,8 @@
 # See LICENSE file for copyright and license details.
 .POSIX:
 
+CSTDINC = -I../inc/$(STD)
+
 include ../config.mk
 
 OBJS = main.o parser.o peep.o symbol.o node.o code.o optm.o\
_AT_@ -10,7 +12,7 @@ OBJS = main.o parser.o peep.o symbol.o node.o code.o optm.o\
 all: cc2-$(ARCH)
 
 main.o: error.h
-$(OBJS): cc2.h ../inc/sizes.h ../inc/cc.h
+$(OBJS): cc2.h ../inc/$(STD)/cstd.h ../inc/cc.h
 arch/$(ARCH)/code.o: arch/$(ARCH)/arch.h
 arch/$(ARCH)/cgen.o: arch/$(ARCH)/arch.h
 
_AT_@ -21,9 +23,6 @@ error.h: cc2.h
 ../lib/libcc.a:
         cd ../lib && $(MAKE) -e
 
-../inc/sizes.h:
- cp ../inc/sizes_$(STD).h $_AT_
-
 cc2-$(ARCH): $(OBJS) ../lib/libcc.a
         $(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $_AT_
 
diff --git a/cc2/arch/amd64-sysv/code.c b/cc2/arch/amd64-sysv/code.c
index 3a16ede..ba26bf7 100644
--- a/cc2/arch/amd64-sysv/code.c
+++ b/cc2/arch/amd64-sysv/code.c
_AT_@ -4,10 +4,10 @@ static char sccsid[] = "@(#) ./cc2/arch/amd64-sysv/code.c";
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <cstd.h>
 #include "arch.h"
 #include "../../../inc/cc.h"
 #include "../../cc2.h"
-#include "../../../inc/sizes.h"
 
 enum segment {
         CODESEG,
diff --git a/cc2/arch/i386-sysv/code.c b/cc2/arch/i386-sysv/code.c
index 8d1a8ff..e8d1548 100644
--- a/cc2/arch/i386-sysv/code.c
+++ b/cc2/arch/i386-sysv/code.c
_AT_@ -3,10 +3,10 @@ static char sccsid[] = "@(#) ./cc2/arch/i386-sysv/code.c";
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <cstd.h>
 #include "arch.h"
 #include "../../../inc/cc.h"
 #include "../../cc2.h"
-#include "../../../inc/sizes.h"
 
 enum segment {
         CODESEG,
diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index 95cceb4..b476973 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -4,10 +4,10 @@ static char sccsid[] = "@(#) ./cc2/arch/qbe/cgen.c";
 #include <assert.h>
 #include <stdlib.h>
 
+#include <cstd.h>
 #include "arch.h"
 #include "../../../inc/cc.h"
 #include "../../cc2.h"
-#include "../../../inc/sizes.h"
 
 enum sflags {
         ISTMP = 1,
diff --git a/cc2/arch/qbe/code.c b/cc2/arch/qbe/code.c
index 885dfae..b05e3d3 100644
--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
_AT_@ -5,10 +5,10 @@ static char sccsid[] = "@(#) ./cc2/arch/qbe/code.c";
 #include <stdlib.h>
 #include <string.h>
 
+#include <cstd.h>
 #include "arch.h"
 #include "../../../inc/cc.h"
 #include "../../cc2.h"
-#include "../../../inc/sizes.h"
 
 #define ADDR_LEN (INTIDENTSIZ+64)
 
diff --git a/cc2/arch/z80/code.c b/cc2/arch/z80/code.c
index 97603d1..16da876 100644
--- a/cc2/arch/z80/code.c
+++ b/cc2/arch/z80/code.c
_AT_@ -4,10 +4,10 @@ static char sccsid[] = "@(#) ./cc2/arch/z80/code.c";
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <cstd.h>
 #include "arch.h"
 #include "../../../inc/cc.h"
 #include "../../cc2.h"
-#include "../../../inc/sizes.h"
 
 enum segment {
         CODESEG,
diff --git a/cc2/parser.c b/cc2/parser.c
index 6377ec9..2b8b8e3 100644
--- a/cc2/parser.c
+++ b/cc2/parser.c
_AT_@ -5,8 +5,8 @@ static char sccsid[] = "@(#) ./cc2/parser.c";
 #include <stdlib.h>
 #include <string.h>
 
+#include <cstd.h>
 #include "../inc/cc.h"
-#include "../inc/sizes.h"
 
 #include "cc2.h"
 
diff --git a/config.mk b/config.mk
index 03038e8..5b5f653 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -7,8 +7,7 @@ ARCHS = z80 i386-sysv amd64-sysv qbe
 ARCH = qbe
 DRIVER = posix
 
-# Remove inc/sizes.h if STD is changed
-# can be c89 or c99
+# Can be c89 or c99
 STD = c99
 
 # paths
_AT_@ -21,6 +20,7 @@ MANPREFIX = $(PREFIX)/share/man
 
 # for Plan9 add -D_SUSV2_SOURCE
 SCC_CFLAGS = -DARCH=\"$(ARCH)\" \
+ $(CSTDINC) \
              -DPREFIX=\"$(PREFIX)\" \
              -DNDEBUG \
              $(CFLAGS)
diff --git a/inc/c89/cstd.h b/inc/c89/cstd.h
new file mode 100644
index 0000000..0dee257
--- /dev/null
+++ b/inc/c89/cstd.h
_AT_@ -0,0 +1,102 @@
+/* See LICENSE file for copyright and license details. */
+
+/*
+ * 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/c99/cstd.h b/inc/c99/cstd.h
new file mode 100644
index 0000000..ff6376a
--- /dev/null
+++ b/inc/c99/cstd.h
_AT_@ -0,0 +1,110 @@
+/* See LICENSE file for copyright and license details. */
+
+/*
+ * 127 nesting levels of blocks
+ */
+#define NR_BLOCK 127
+/*
+ * 63 nesting levels of conditional inclusion
+ */
+#define NR_COND 63
+/*
+ * 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
+/*
+ * 63 nesting levels of parenthesized declarators within a full
+ * declarator
+ */
+#define NR_SUBTYPE 63
+/*
+ * 63 nesting levels of parenthesized expressions within a full
+ * expression
+ */
+#define NR_SUBEXPR 63
+/*
+ * 63 significant initial characters in an internal identifier or a
+ * macro name (each universal character name or extended source
+ * character is considered a single character)
+ */
+#define INTIDENTSIZ 63
+/*
+ * 31 significant initial characters in an external identifier (each
+ * universal character name specifying a short identifier of 0000FFFF
+ * or less is considered 6 characters, each universal character name
+ * specifying a short identifier of 00010000 or more is considered 10
+ * characters, and each extended source character is considered the
+ * same number of characters as the corresponding universal character
+ * name, if any)
+ */
+#define EXTIDENTSIZ 31
+/*
+ * 4095 external identifiers in one translation unit
+ */
+#define NR_EXT_IDENT 4095
+/*
+ * 511 identifiers with block scope declared in one block
+ */
+#define NR_INT_IDENT 511
+/*
+ * 4096 macro identifiers simultaneously defined in one preprocessing
+ * translation unit
+ */
+#define NR_MACROIDENT 4096
+/*
+ * 127 parameters in one function definition
+ */
+#define NR_FUNPARAM 127
+/*
+ * 127 arguments in one function call
+ */
+#define NR_FUNARG 127
+/*
+ * 127 parameters in one macro definition
+ */
+#define NR_MACROPARAM 127
+/*
+ * 127 arguments in one macro invocation
+ */
+#define NR_MACROARG 127
+/*
+ * 4095 characters in a logical source line
+ */
+#define LINESIZ 4095
+/*
+ * 4095 characters in a character string literal or wide string literal
+ * (after concatenation)
+ */
+#define STRINGSIZ 4095
+/*
+ * 65535 bytes in an object (in a hosted environment only)
+ */
+#define OBJECTSIZ 65535
+/*
+ * 15 nesting levels for #include'd files
+ */
+#define NR_INCLUDE 15
+/*
+ * 1023 case labels for a switch statement (excluding those for any
+ * nested switch statements)
+ */
+#define NR_SWITCH 1023
+/*
+ * 1023 members in a single structure or union
+ */
+#define NR_FIELDS 1023
+/*
+ * 1023 enumeration constants in a single enumeration
+ */
+#define NR_ENUM_CTES 1023
+/*
+ * 63 levels of nested structure or union definitions in a single
+ * struct-declaration-list
+ */
+#define NR_STRUCT_LEVEL 63
+/*
+ * 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
deleted file mode 100644
index 0dee257..0000000
--- a/inc/sizes_c89.h
+++ /dev/null
_AT_@ -1,102 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-
-/*
- * 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_c99.h b/inc/sizes_c99.h
deleted file mode 100644
index ff6376a..0000000
--- a/inc/sizes_c99.h
+++ /dev/null
_AT_@ -1,110 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-
-/*
- * 127 nesting levels of blocks
- */
-#define NR_BLOCK 127
-/*
- * 63 nesting levels of conditional inclusion
- */
-#define NR_COND 63
-/*
- * 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
-/*
- * 63 nesting levels of parenthesized declarators within a full
- * declarator
- */
-#define NR_SUBTYPE 63
-/*
- * 63 nesting levels of parenthesized expressions within a full
- * expression
- */
-#define NR_SUBEXPR 63
-/*
- * 63 significant initial characters in an internal identifier or a
- * macro name (each universal character name or extended source
- * character is considered a single character)
- */
-#define INTIDENTSIZ 63
-/*
- * 31 significant initial characters in an external identifier (each
- * universal character name specifying a short identifier of 0000FFFF
- * or less is considered 6 characters, each universal character name
- * specifying a short identifier of 00010000 or more is considered 10
- * characters, and each extended source character is considered the
- * same number of characters as the corresponding universal character
- * name, if any)
- */
-#define EXTIDENTSIZ 31
-/*
- * 4095 external identifiers in one translation unit
- */
-#define NR_EXT_IDENT 4095
-/*
- * 511 identifiers with block scope declared in one block
- */
-#define NR_INT_IDENT 511
-/*
- * 4096 macro identifiers simultaneously defined in one preprocessing
- * translation unit
- */
-#define NR_MACROIDENT 4096
-/*
- * 127 parameters in one function definition
- */
-#define NR_FUNPARAM 127
-/*
- * 127 arguments in one function call
- */
-#define NR_FUNARG 127
-/*
- * 127 parameters in one macro definition
- */
-#define NR_MACROPARAM 127
-/*
- * 127 arguments in one macro invocation
- */
-#define NR_MACROARG 127
-/*
- * 4095 characters in a logical source line
- */
-#define LINESIZ 4095
-/*
- * 4095 characters in a character string literal or wide string literal
- * (after concatenation)
- */
-#define STRINGSIZ 4095
-/*
- * 65535 bytes in an object (in a hosted environment only)
- */
-#define OBJECTSIZ 65535
-/*
- * 15 nesting levels for #include'd files
- */
-#define NR_INCLUDE 15
-/*
- * 1023 case labels for a switch statement (excluding those for any
- * nested switch statements)
- */
-#define NR_SWITCH 1023
-/*
- * 1023 members in a single structure or union
- */
-#define NR_FIELDS 1023
-/*
- * 1023 enumeration constants in a single enumeration
- */
-#define NR_ENUM_CTES 1023
-/*
- * 63 levels of nested structure or union definitions in a single
- * struct-declaration-list
- */
-#define NR_STRUCT_LEVEL 63
-/*
- * number of defined structs/unions in one translation unit
- */
-#define NR_MAXSTRUCTS 127
Received on Sat Dec 10 2016 - 16:06:20 CET

This archive was generated by hypermail 2.3.0 : Sat Dec 10 2016 - 16:12:19 CET