summaryrefslogtreecommitdiffstats
path: root/usr.bin/yacc
diff options
context:
space:
mode:
authorrobert <robert@FreeBSD.org>2002-06-11 11:27:20 +0000
committerrobert <robert@FreeBSD.org>2002-06-11 11:27:20 +0000
commitf85d0f00609e74ecc0af9af261884345400f1483 (patch)
tree3e227f828f3f84e93dd59aead391ec303d60f0a5 /usr.bin/yacc
parentd1834ccc3b4dd30a064ae97391d65f6154086970 (diff)
downloadFreeBSD-src-f85d0f00609e74ecc0af9af261884345400f1483.zip
FreeBSD-src-f85d0f00609e74ecc0af9af261884345400f1483.tar.gz
Use the constants from <limits.h> for the sizes of integral C types
rather than defining them ourselves.
Diffstat (limited to 'usr.bin/yacc')
-rw-r--r--usr.bin/yacc/defs.h6
-rw-r--r--usr.bin/yacc/lalr.c3
-rw-r--r--usr.bin/yacc/lr0.c3
-rw-r--r--usr.bin/yacc/output.c5
-rw-r--r--usr.bin/yacc/reader.c5
5 files changed, 10 insertions, 12 deletions
diff --git a/usr.bin/yacc/defs.h b/usr.bin/yacc/defs.h
index 4efc8a3..cb8b083 100644
--- a/usr.bin/yacc/defs.h
+++ b/usr.bin/yacc/defs.h
@@ -47,9 +47,6 @@
/* the following definitions are for the Tahoe */
/* they might have to be changed for other machines */
-/* MAXCHAR is the largest unsigned character value */
-/* MAXSHORT is the largest value of a C short */
-/* MINSHORT is the most negative value of a C short */
/* MAXTABLE is the maximum table size */
/* BITS_PER_WORD is the number of bits in a C unsigned */
/* WORDSIZE computes the number of words needed to */
@@ -58,9 +55,6 @@
/* from r (0-indexed) */
/* SETBIT sets the n-th bit starting from r */
-#define MAXCHAR 255
-#define MAXSHORT 32767
-#define MINSHORT -32768
#define MAXTABLE 32500
#define BITS_PER_WORD 32
#define WORDSIZE(n) (((n)+(BITS_PER_WORD-1))/BITS_PER_WORD)
diff --git a/usr.bin/yacc/lalr.c b/usr.bin/yacc/lalr.c
index 3fe94fb..95d87de 100644
--- a/usr.bin/yacc/lalr.c
+++ b/usr.bin/yacc/lalr.c
@@ -43,6 +43,7 @@ static char sccsid[] = "@(#)lalr.c 5.3 (Berkeley) 6/1/90";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <limits.h>
#include <stdlib.h>
#include "defs.h"
@@ -252,7 +253,7 @@ set_goto_map()
if (ISTOKEN(symbol)) break;
- if (ngotos == MAXSHORT)
+ if (ngotos == SHRT_MAX)
fatal("too many gotos");
ngotos++;
diff --git a/usr.bin/yacc/lr0.c b/usr.bin/yacc/lr0.c
index efeaed2..cd8d1a1 100644
--- a/usr.bin/yacc/lr0.c
+++ b/usr.bin/yacc/lr0.c
@@ -43,6 +43,7 @@ static char sccsid[] = "@(#)lr0.c 5.3 (Berkeley) 1/20/91";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <limits.h>
#include <stdlib.h>
#include "defs.h"
@@ -358,7 +359,7 @@ int symbol;
fprintf(stderr, "Entering new_state(%d)\n", symbol);
#endif
- if (nstates >= MAXSHORT)
+ if (nstates >= SHRT_MAX)
fatal("too many states");
isp1 = kernel_base[symbol];
diff --git a/usr.bin/yacc/output.c b/usr.bin/yacc/output.c
index 835f21e..b0b520a 100644
--- a/usr.bin/yacc/output.c
+++ b/usr.bin/yacc/output.c
@@ -43,6 +43,7 @@ static char sccsid[] = "@(#)output.c 5.7 (Berkeley) 5/24/93";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include "defs.h"
@@ -331,7 +332,7 @@ token_actions()
{
froms[i] = r = NEW2(shiftcount, short);
tos[i] = s = NEW2(shiftcount, short);
- min = MAXSHORT;
+ min = SHRT_MAX;
max = 0;
for (j = 0; j < ntokens; ++j)
{
@@ -351,7 +352,7 @@ token_actions()
{
froms[nstates+i] = r = NEW2(reducecount, short);
tos[nstates+i] = s = NEW2(reducecount, short);
- min = MAXSHORT;
+ min = SHRT_MAX;
max = 0;
for (j = 0; j < ntokens; ++j)
{
diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c
index 5beb199..3e01e8f 100644
--- a/usr.bin/yacc/reader.c
+++ b/usr.bin/yacc/reader.c
@@ -43,6 +43,7 @@ static char sccsid[] = "@(#)reader.c 5.7 (Berkeley) 1/20/91";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include "defs.h"
@@ -720,7 +721,7 @@ get_literal()
++cptr;
}
}
- if (n > MAXCHAR) illegal_character(c_cptr);
+ if (n > UCHAR_MAX) illegal_character(c_cptr);
c = n;
break;
@@ -736,7 +737,7 @@ get_literal()
if (i < 0 || i >= 16) break;
++cptr;
n = (n << 4) + i;
- if (n > MAXCHAR) illegal_character(c_cptr);
+ if (n > UCHAR_MAX) illegal_character(c_cptr);
}
c = n;
break;
OpenPOWER on IntegriCloud