shithub: scc

Download patch

ref: 15c6246c5e7ed55c580713095ff1fc6e5de20538
parent: 867607689050314f1cd07f567ec06ceff1a1aa49
parent: ae3aed4fc972caabd87a2c4993dff0dc1b45f2b3
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed May 11 13:01:57 EDT 2016

Merge remote-tracking branch 'origin/master'

--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -250,7 +250,7 @@
 static void
 tok2str(void)
 {
-	if ((yylen = input->p - input->begin) > IDENTSIZ)
+	if ((yylen = input->p - input->begin) > INTIDENTSIZ)
 		error("token too big");
 	strncpy(yytext, input->begin, yylen);
 	yytext[yylen] = '\0';
--- a/cc2/arch/amd64-sysv/code.c
+++ b/cc2/arch/amd64-sysv/code.c
@@ -33,7 +33,7 @@
 static char *
 symname(Symbol *sym)
 {
-	static char name[IDENTSIZ+1];
+	static char name[INTIDENTSIZ+1];
 
 	if (sym->name) {
 		switch (sym->kind) {
--- a/cc2/arch/i386-sysv/code.c
+++ b/cc2/arch/i386-sysv/code.c
@@ -33,7 +33,7 @@
 static char *
 symname(Symbol *sym)
 {
-	static char name[IDENTSIZ+1];
+	static char name[INTIDENTSIZ+1];
 
 	if (sym->name) {
 		switch (sym->kind) {
--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
@@ -7,7 +7,7 @@
 #include "../../cc2.h"
 #include "../../../inc/sizes.h"
 
-#define ADDR_LEN (IDENTSIZ+64)
+#define ADDR_LEN (INTIDENTSIZ+64)
 
 static void binary(void), unary(void), store(void), jmp(void), ret(void),
             branch(void);
--- a/cc2/arch/z80/code.c
+++ b/cc2/arch/z80/code.c
@@ -34,7 +34,7 @@
 static char *
 symname(Symbol *sym)
 {
-	static char name[IDENTSIZ+1];
+	static char name[INTIDENTSIZ+1];
 
 	if (sym->name) {
 		switch (sym->kind) {
--- a/inc/sizes.h
+++ b/inc/sizes.h
@@ -1,85 +1,100 @@
-
 /*
  * 15 nesting levels of compound statements, iteration control
  * structures, and selection control structures
  */
-#define NR_BLOCK       15
+#define NR_BLOCK        15
 /*
  * 8 nesting levels of conditional inclusion
  */
-#define NR_COND   8
+#define NR_COND         8
 /*
- * number of defined structs/unions in one translation unit
- */
-#define NR_MAXSTRUCTS 127
-/*
  * 12 pointer, array, and function declarators (in any combinations)
- *  modifying an arithmetic, a structure, a union, or an incomplete type
- *  in a declaration
+ * 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.
+ * 31 declarators nested by parentheses within a full declarator
  */
-#define NR_SUBTYPE     31
+#define NR_SUBTYPE      31
 /*
  * 32 expressions nested by parentheses within a full expression
  */
-#define NR_SUBEXPR     32
+#define NR_SUBEXPR      32
 /*
  * 31 significant initial characters in an internal identifier or a
  * macro name
  */
-#define IDENTSIZ       31
+#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
+#define NR_EXT_IDENT    511
 /*
  * 127 identifiers with block scope declared in one block
  */
-#define NR_INT_IDENT   127
+#define NR_INT_IDENT    127
 /*
- * 31 parameters in one function definition * 6 significant initial
- * characters in an external identifier.
+ * 1024 macro identifiers simultaneously defined in one translation
+ * unit
  */
-#define NR_FUNPARAM    31
+#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_MACROARG    31
+#define NR_MACROPARAM   31
 /*
- * 509 characters in a logical source line.
+ * 31 arguments in one macro invocation
  */
-#define LINESIZ     509
+#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
+#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   9
+#define NR_INCLUDE      8
 /*
  * 257 case labels for a switch statement (excluding those for any
  * nested switch statements)
  */
-#define NR_SWITCH  257
+#define NR_SWITCH       257
 /*
  * 127 members in a single structure or union
  */
-#define NR_FIELDS  127
+#define NR_FIELDS       127
 /*
  * 127 enumeration constants in a single enumeration
  */
-#define NR_ENUM_CTES 127
+#define NR_ENUM_CTES    127
 /*
  * 15 levels of nested structure or union definitions in a single
- *  struct-declaration-list
+ * struct-declaration-list
  */
 #define NR_STRUCT_LEVEL 15
 /*
- * 32767 bytes in an object (in a hosted environment only)
+ * number of defined structs/unions in one translation unit
  */
-#define OBJECTSIZ  32767
+#define NR_MAXSTRUCTS   127
--- /dev/null
+++ b/inc/sizes_c99.h
@@ -1,0 +1,108 @@
+/*
+ * 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     63
+/*
+ * 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