mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-24 07:40:52 +00:00
Use the constants from <limits.h> for the sizes of integral C types
rather than defining them ourselves.
This commit is contained in:
parent
7a9378e7f5
commit
ddd16e87d0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98116
@ -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)
|
||||
|
@ -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++;
|
||||
|
@ -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];
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user