commit b392aeafa794ca5b5aecdf93475c3869af3a9747
parent 0b09e68a1bc71be5eaa5754c98365cf677992aed
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 27 Jan 2026 09:55:06 +0100
cc1: Remove NR_MAXSTRUCTS
This limit is not defined by any standard, and it was creating an
artificial limit that does not help at all to discover non portable
programs because it checked for something useless.
Diffstat:
3 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/include/scc/bits/scc/cstd-c89.h b/include/scc/bits/scc/cstd-c89.h
@@ -97,7 +97,3 @@
* struct-declaration-list
*/
#define NR_STRUCT_LEVEL 15
-/*
- * number of defined structs/unions in one translation unit
- */
-#define NR_MAXSTRUCTS 127
diff --git a/include/scc/bits/scc/cstd-c99.h b/include/scc/bits/scc/cstd-c99.h
@@ -105,7 +105,3 @@
* struct-declaration-list
*/
#define NR_STRUCT_LEVEL 63
-/*
- * number of defined structs/unions in one translation unit
- */
-#define NR_MAXSTRUCTS 127
diff --git a/src/cmd/scc-cc/cc1/decl.c b/src/cmd/scc-cc/cc1/decl.c
@@ -1,4 +1,5 @@
#include <assert.h>
+#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
@@ -772,7 +773,7 @@ newtag(void)
if (!sym->type) {
Type *tp;
- if (tpns == NS_STRUCTS + NR_MAXSTRUCTS)
+ if (tpns == INT_MAX)
error("too many tags declared");
tp = mktype(NULL, tag, 0, NULL);
tp->ns = tpns++;