summaryrefslogtreecommitdiff
path: root/usr/src/cmd/sgs/yacc/common
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/sgs/yacc/common')
-rw-r--r--usr/src/cmd/sgs/yacc/common/dextern.h2
-rw-r--r--usr/src/cmd/sgs/yacc/common/libzer.c10
-rw-r--r--usr/src/cmd/sgs/yacc/common/y1.c84
-rw-r--r--usr/src/cmd/sgs/yacc/common/y2.c140
-rw-r--r--usr/src/cmd/sgs/yacc/common/y3.c28
-rw-r--r--usr/src/cmd/sgs/yacc/common/y4.c19
-rw-r--r--usr/src/cmd/sgs/yacc/common/yaccpar37
7 files changed, 136 insertions, 184 deletions
diff --git a/usr/src/cmd/sgs/yacc/common/dextern.h b/usr/src/cmd/sgs/yacc/common/dextern.h
index e90aa60468..dfabe65748 100644
--- a/usr/src/cmd/sgs/yacc/common/dextern.h
+++ b/usr/src/cmd/sgs/yacc/common/dextern.h
@@ -29,8 +29,6 @@
#ifndef _DEXTERN_H
#define _DEXTERN_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <inttypes.h>
#include <ctype.h>
diff --git a/usr/src/cmd/sgs/yacc/common/libzer.c b/usr/src/cmd/sgs/yacc/common/libzer.c
index 01ba9e29bd..3e187e3058 100644
--- a/usr/src/cmd/sgs/yacc/common/libzer.c
+++ b/usr/src/cmd/sgs/yacc/common/libzer.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/* Copyright (c) 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
@@ -27,18 +27,10 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
-#ifdef __cplusplus
void
yyerror(const char *s)
-#else
-void
-yyerror(s)
-char *s;
-#endif
{
(void) fprintf(stderr, "%s\n", s);
}
diff --git a/usr/src/cmd/sgs/yacc/common/y1.c b/usr/src/cmd/sgs/yacc/common/y1.c
index 845f82d367..09106fbc0d 100644
--- a/usr/src/cmd/sgs/yacc/common/y1.c
+++ b/usr/src/cmd/sgs/yacc/common/y1.c
@@ -26,8 +26,6 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "dextern.h"
#include <sys/param.h>
#include <sys/errno.h>
@@ -58,8 +56,8 @@ static int tbitset; /* size of lookahead sets */
LOOKSETS *lkst;
static int lsetsize;
-static int nlset = 0; /* next lookahead set index */
-int nolook = 0; /* flag to suppress lookahead computations */
+static int nlset = 0; /* next lookahead set index */
+int nolook = 0; /* flag to suppress lookahead computations */
static LOOKSETS clset; /* temporary storage for lookahead computations */
static ITEM *psmem, *zzmemsz;
@@ -94,7 +92,7 @@ int new_actsize = ACTSIZE;
int *temp1; /* temp storate, indexed by terms+ntokens or states */
int lineno = 0; /* current input line number */
int size;
-static int fatfl = 1; /* if on, error is fatal */
+static int fatfl = 1; /* if on, error is fatal */
static int nerrors = 0; /* number of errors */
/* storage for information about the nonterminals */
@@ -116,17 +114,17 @@ main(int argc, char *argv[])
#endif
(void) textdomain(TEXT_DOMAIN);
- setup(argc, argv); /* initialize and read productions */
+ setup(argc, argv); /* initialize and read productions */
TBITSET = NWORDS(ntoksz*LKFACTOR);
tbitset = NWORDS(ntokens*LKFACTOR);
mktbls();
- cpres(); /* make table of which productions yield a */
+ cpres(); /* make table of which productions yield a */
/* given nonterminal */
- cempty(); /* make a table of which nonterminals can match */
+ cempty(); /* make a table of which nonterminals can match */
/* the empty string */
- cpfir(); /* make a table of firsts of nonterminals */
- stagen(); /* generate the states */
- output(); /* write the states and the tables */
+ cpfir(); /* make a table of firsts of nonterminals */
+ stagen(); /* generate the states */
+ output(); /* write the states and the tables */
go2out();
hideprod();
summary();
@@ -137,7 +135,7 @@ main(int argc, char *argv[])
static void
-mktbls()
+mktbls(void)
{
int i;
@@ -167,7 +165,8 @@ mktbls()
/*
* For lkst
*/
-#define INIT_LSIZE nnontersz*LKFACTOR
+#define INIT_LSIZE nnontersz * LKFACTOR
+
tmp_lset = (int *)
calloc((size_t)(TBITSET * (INIT_LSIZE+1)), sizeof (int));
if (tmp_lset == NULL)
@@ -238,7 +237,7 @@ mktbls()
/* put out other arrays, copy the parsers */
static void
-others()
+others(void)
{
extern int gen_lines;
int c, i, j;
@@ -326,10 +325,9 @@ others()
/* copies string q into p, returning next free char ptr */
static wchar_t *
-chcopy(p, q)
-wchar_t *p, *q;
+chcopy(wchar_t *p, wchar_t *q)
{
- while (*p = *q++)
+ while ((*p = *q++) != L'\0')
++p;
return (p);
}
@@ -337,8 +335,7 @@ wchar_t *p, *q;
#define ISIZE 400
/* creates output string for item pointed to by pp */
wchar_t *
-writem(pp)
-int *pp;
+writem(int *pp)
{
int i, *p;
static int isize = ISIZE;
@@ -362,7 +359,8 @@ int *pp;
for (i = 0; i < isize; ++i)
sarr[i] = L' ';
}
- for (p = pp; *p > 0; ++p) /* NULL */;
+ for (p = pp; *p > 0; ++p) /* NULL */
+ ;
p = prdptr[-*p];
q = chcopy(sarr, nontrst[*p-NTBASE].name);
q = chcopy(q, L" : ");
@@ -379,7 +377,7 @@ int *pp;
sarrbase = sarr;
isize += ISIZE;
sarr = (wchar_t *)
- realloc((char *)sarr, sizeof (*sarr) * isize);
+ realloc((char *)sarr, sizeof (*sarr) * isize);
if (sarr == NULL)
/*
* TRANSLATION_NOTE -- This is a message from yacc.
@@ -391,7 +389,7 @@ int *pp;
* 'Could not allocate internally used memory.'
*/
error(gettext(
- "cannot expand sarr arrays"));
+ "cannot expand sarr arrays"));
q = q - sarrbase + sarr;
}
}
@@ -427,7 +425,7 @@ int zzrrconf = 0;
/* output the summary on the tty */
static void
-summary()
+summary(void)
{
if (foutput != NULL) {
(void) fprintf(foutput,
@@ -560,8 +558,7 @@ warning(int flag, char *s, ...)
/* set elements 0 through n-1 to c */
void
-aryfil(v, n, c)
-int *v, n, c;
+aryfil(int *v, int n, int c)
{
int i;
for (i = 0; i < n; ++i)
@@ -571,8 +568,7 @@ int *v, n, c;
/* set a to the union of a and b */
/* return 1 if b is not a subset of a, 0 otherwise */
static int
-setunion(a, b)
-int *a, *b;
+setunion(int *a, int *b)
{
int i, x, sub;
@@ -586,8 +582,7 @@ int *a, *b;
}
static void
-prlook(p)
-LOOKSETS *p;
+prlook(LOOKSETS *p)
{
int j, *pp;
pp = p->lset;
@@ -611,7 +606,7 @@ LOOKSETS *p;
* the array pyield has the lists: the total size is only NPROD+1
*/
static void
-cpres()
+cpres(void)
{
int **ptrpy;
int **pyield;
@@ -647,10 +642,10 @@ cpres()
pres[i] = ptrpy;
fatfl = 0; /* make undefined symbols nonfatal */
PLOOP(0, j) {
- if (*prdptr[j] == c) /* linear search for all c's */
+ if (*prdptr[j] == c) /* linear search for all c's */
*ptrpy++ = prdptr[j] + 1;
}
- if (pres[i] == ptrpy) { /* c not found */
+ if (pres[i] == ptrpy) { /* c not found */
/*
* TRANSLATION_NOTE -- This is a message from yacc.
* This message is passed to error() function.
@@ -686,7 +681,7 @@ cpres()
static int indebug = 0;
/* compute an array with the first of nonterminals */
static void
-cpfir()
+cpfir(void)
{
int *p, **s, i, **t, ch, changes;
@@ -698,7 +693,7 @@ cpfir()
for (s = pres[i]; s < t; ++s) {
/* check if ch is non-terminal */
for (p = *s; (ch = *p) > 0; ++p) {
- if (ch < NTBASE) { /* should be token */
+ if (ch < NTBASE) { /* should be token */
SETBIT(wsets[i].ws.lset, ch);
break;
} else if (!pempty[ch-NTBASE])
@@ -826,15 +821,13 @@ state(int c)
static int pidebug = 0;
void
-putitem(ptr, lptr)
-int *ptr;
-LOOKSETS *lptr;
+putitem(int *ptr, LOOKSETS *lptr)
{
register ITEM *j;
if (pidebug && (foutput != NULL))
(void) fprintf(foutput,
- WSFMT("putitem(%ws), state %d\n"), writem(ptr), nstate);
+ WSFMT("putitem(%ws), state %d\n"), writem(ptr), nstate);
j = pstate[nstate+1];
j->pitem = ptr;
if (!nolook)
@@ -853,7 +846,7 @@ LOOKSETS *lptr;
* also, look for nonterminals which don't derive any token strings
*/
static void
-cempty()
+cempty(void)
{
#define EMPTY 1
#define WHOKNOWS 0
@@ -944,7 +937,7 @@ again:
/* generate the states */
static int gsdebug = 0;
static void
-stagen()
+stagen(void)
{
int i, j;
int c;
@@ -1143,8 +1136,7 @@ closure(int i)
}
static LOOKSETS *
-flset(p)
-LOOKSETS *p;
+flset(LOOKSETS *p)
{
/* decide if the lookahead set pointed to by p is known */
/* return pointer to a perminent location for the set */
@@ -1175,7 +1167,7 @@ LOOKSETS *p;
}
static void
-exp_lkst()
+exp_lkst(void)
{
int i, j;
static LOOKSETS *lookbase;
@@ -1221,7 +1213,7 @@ exp_lkst()
}
static void
-exp_wsets()
+exp_wsets(void)
{
int i, j;
@@ -1258,7 +1250,7 @@ exp_wsets()
}
static void
-exp_states()
+exp_states(void)
{
nstatesz += NSTATES;
@@ -1284,7 +1276,7 @@ exp_states()
}
static void
-exp_psmem()
+exp_psmem(void)
{
int i;
diff --git a/usr/src/cmd/sgs/yacc/common/y2.c b/usr/src/cmd/sgs/yacc/common/y2.c
index c5cfc83eb3..954cee6fa8 100644
--- a/usr/src/cmd/sgs/yacc/common/y2.c
+++ b/usr/src/cmd/sgs/yacc/common/y2.c
@@ -54,11 +54,11 @@
#define d_FLAG 0x02
#define DEFAULT_PREFIX "y"
-char *infile; /* input file name */
-static int numbval; /* value of an input number */
+char *infile; /* input file name */
+static int numbval; /* value of an input number */
static int toksize = NAMESIZE;
static wchar_t *tokname; /* input token name */
-char *parser = PARSER; /* location of common parser */
+char *parser = PARSER; /* location of common parser */
static void finact(void);
static wchar_t *cstash(wchar_t *);
@@ -165,11 +165,12 @@ int nmbchars = 0; /* number of mb literals in mbchars */
MBCLIT *mbchars = (MBCLIT *) 0; /* array of mb literals */
int nmbcharsz = 0; /* allocated space for mbchars */
+#define F_NAME_LENGTH 128
+
void
-setup(argc, argv)
-int argc;
-char *argv[];
-{ int ii, i, j, lev, t, ty;
+setup(int argc, char *argv[])
+{
+ int ii, i, j, lev, t, ty;
/* ty is the sequencial number of token name in tokset */
int c;
int *p;
@@ -178,7 +179,6 @@ char *argv[];
unsigned int options = 0;
char *file_prefix = DEFAULT_PREFIX;
char *sym_prefix = "";
-#define F_NAME_LENGTH 128
char fname[F_NAME_LENGTH+1];
foutput = NULL;
@@ -237,7 +237,7 @@ char *argv[];
break;
case 'Y':
cp = (char *)malloc(strlen(optarg)+
- sizeof ("/yaccpar") + 1);
+ sizeof ("/yaccpar") + 1);
cp = strcpy(cp, optarg);
parser = strcat(cp, "/yaccpar");
break;
@@ -270,9 +270,8 @@ char *argv[];
* Open y.output if -v is specified
*/
if (options & v_FLAG) {
- (void) strncpy(fname,
- file_prefix,
- F_NAME_LENGTH-strlen(".output"));
+ (void) strncpy(fname, file_prefix,
+ F_NAME_LENGTH - strlen(".output"));
(void) strcat(fname, ".output");
foutput = fopen(fname, "w");
if (foutput == NULL)
@@ -284,14 +283,12 @@ char *argv[];
* Open y.tab.h if -d is specified
*/
if (options & d_FLAG) {
- (void) strncpy(fname,
- file_prefix,
- F_NAME_LENGTH-strlen(".tab.h"));
+ (void) strncpy(fname, file_prefix,
+ F_NAME_LENGTH - strlen(".tab.h"));
(void) strcat(fname, ".tab.h");
fdefine = fopen(fname, "w");
if (fdefine == NULL)
- error(gettext(
- "cannot open y.tab.h"));
+ error(gettext("cannot open y.tab.h"));
}
fdebug = fopen(DEBUGNAME, "w");
@@ -306,9 +303,8 @@ char *argv[];
/*
* Open y.tab.c
*/
- (void) strncpy(fname,
- file_prefix,
- F_NAME_LENGTH-strlen(".tab.c"));
+ (void) strncpy(fname, file_prefix,
+ F_NAME_LENGTH - strlen(".tab.c"));
(void) strcat(fname, ".tab.c");
ftable = fopen(fname, "w");
if (ftable == NULL)
@@ -399,8 +395,8 @@ char *argv[];
* This message is passed to error() function.
*/
error(gettext(
- "type redeclaration of token %ws"),
- tokset[t].name);
+ "type redeclaration of token %ws"),
+ tokset[t].name);
}
else
SETTYPE(toklev[t], ty);
@@ -415,7 +411,7 @@ char *argv[];
*/
error(gettext(
"type redeclaration of nonterminal %ws"),
- nontrst[t-NTBASE].name);
+ nontrst[t-NTBASE].name);
}
else
nontrst[t-NTBASE].tvalue = ty;
@@ -491,7 +487,7 @@ char *argv[];
*/
error(gettext(
"%ws is not a token."),
- tokname);
+ tokname);
}
if (lev & ~04) {
if (ASSOC(toklev[j]) & ~04)
@@ -501,14 +497,14 @@ char *argv[];
*/
error(gettext(
"redeclaration of precedence of %ws"),
- tokname);
+ tokname);
SETASC(toklev[j], lev);
SETPLEV(toklev[j], i);
} else {
if (ASSOC(toklev[j]))
(void) warning(1, gettext(
"redeclaration of precedence of %ws."),
- tokname);
+ tokname);
SETASC(toklev[j], lev);
}
if (ty) {
@@ -519,7 +515,7 @@ char *argv[];
* This message is passed to error() function.
*/
"redeclaration of type of %ws"),
- tokname);
+ tokname);
SETTYPE(toklev[j], ty);
}
if ((t = gettok()) == NUMBER) {
@@ -531,7 +527,7 @@ char *argv[];
*/
error(gettext(
"type number of %ws should be defined earlier"),
- tokset[j].name);
+ tokset[j].name);
}
if (numbval >= -YYFLAG1) {
/*
@@ -540,7 +536,7 @@ char *argv[];
*/
error(gettext(
"token numbers must be less than %d"),
- -YYFLAG1);
+ -YYFLAG1);
}
t = gettok();
}
@@ -601,9 +597,9 @@ char *argv[];
put_prefix_define(sym_prefix);
(void) fprintf(ftable,
- "\n#if defined(__cplusplus) || defined(__STDC__)\n");
+ "\n#if defined(__cplusplus) || defined(__STDC__)\n");
(void) fprintf(ftable,
- "\n#if defined(__cplusplus) && defined(__EXTERN_C__)\n");
+ "\n#if defined(__cplusplus) && defined(__EXTERN_C__)\n");
(void) fprintf(ftable, "extern \"C\" {\n");
(void) fprintf(ftable, "#endif\n");
(void) fprintf(ftable, "#ifndef yyerror\n");
@@ -616,7 +612,7 @@ char *argv[];
(void) fprintf(ftable, "#endif\n");
(void) fprintf(ftable, " int yyparse(void);\n");
(void) fprintf(ftable,
- "#if defined(__cplusplus) && defined(__EXTERN_C__)\n");
+ "#if defined(__cplusplus) && defined(__EXTERN_C__)\n");
(void) fprintf(ftable, "}\n");
(void) fprintf(ftable, "#endif\n");
(void) fprintf(ftable, "\n#endif\n\n");
@@ -626,12 +622,12 @@ char *argv[];
(void) fprintf(ftable, "extern int yychar;\nextern int yyerrflag;\n");
if (!(defunion || ntypes))
(void) fprintf(ftable,
- "#ifndef YYSTYPE\n#define YYSTYPE int\n#endif\n");
+ "#ifndef YYSTYPE\n#define YYSTYPE int\n#endif\n");
(void) fprintf(ftable, "YYSTYPE yylval;\n");
(void) fprintf(ftable, "YYSTYPE yyval;\n");
(void) fprintf(ftable, "typedef int yytabelem;\n");
(void) fprintf(ftable,
- "#ifndef YYMAXDEPTH\n#define YYMAXDEPTH 150\n#endif\n");
+ "#ifndef YYMAXDEPTH\n#define YYMAXDEPTH 150\n#endif\n");
(void) fprintf(ftable, "#if YYMAXDEPTH > 0\n");
(void) fprintf(ftable, "int yy_yys[YYMAXDEPTH], *yys = yy_yys;\n");
(void) fprintf(ftable, "YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv;\n");
@@ -713,7 +709,7 @@ char *argv[];
* Do not translate %%prec.
*/
error(gettext(
- "illegal %%prec syntax"));
+ "illegal %%prec syntax"));
j = chfind(2, tokname);
if (j >= NTBASE)
/*
@@ -722,8 +718,8 @@ char *argv[];
* Do not translate %%prec.
*/
error(gettext(
- "nonterminal %ws illegal after %%prec"),
- nontrst[j-NTBASE].name);
+ "nonterminal %ws illegal after %%prec"),
+ nontrst[j-NTBASE].name);
levprd[nprod] = toklev[j] & ~04;
t = gettok();
}
@@ -792,9 +788,10 @@ char *argv[];
/* check that default action is reasonable */
if (ntypes && !(levprd[nprod] & ACTFLAG) &&
- nontrst[*prdptr[nprod]-NTBASE].tvalue) {
+ nontrst[*prdptr[nprod]-NTBASE].tvalue) {
/* no explicit action, LHS has value */
int tempty;
+
tempty = prdptr[nprod][1];
if (tempty < 0)
/*
@@ -831,15 +828,15 @@ char *argv[];
if (t == MARK) {
if (gen_lines)
(void) fprintf(ftable, "\n# line %d \"%s\"\n",
- lineno, infile);
+ lineno, infile);
while ((c = getwc(finput)) != EOF)
(void) putwc(c, ftable);
- }
+ }
(void) fclose(finput);
}
static void
-finact()
+finact(void)
{
/* finish action routine */
(void) fclose(faction);
@@ -847,8 +844,7 @@ finact()
}
static wchar_t *
-cstash(s)
-register wchar_t *s;
+cstash(wchar_t *s)
{
wchar_t *temp;
static int used = 0;
@@ -866,7 +862,7 @@ register wchar_t *s;
if (!used)
free((char *)cnames);
if ((cnames = (wchar_t *)
- malloc(sizeof (wchar_t)*exp_cname)) == NULL)
+ malloc(sizeof (wchar_t)*exp_cname)) == NULL)
/*
* TRANSLATION_NOTE -- This is a message from yacc.
* This message is passed to error() function.
@@ -875,7 +871,7 @@ register wchar_t *s;
* 'Could not allocate internally used memory.'
*/
error(gettext(
- "cannot expand string dump"));
+ "cannot expand string dump"));
cnamp = cnames;
used = 0;
}
@@ -1050,7 +1046,7 @@ defin(int t, wchar_t *s)
}
static void
-defout()
+defout(void)
{
/* write out the defines (at the end of the declaration section) */
@@ -1093,7 +1089,7 @@ defout()
}
static int
-gettok()
+gettok(void)
{
int i, base;
static int peekline; /* number of '\n' seen in lookahead */
@@ -1308,7 +1304,7 @@ chfind(int t, wchar_t *s)
}
static void
-cpyunion()
+cpyunion(void)
{
/*
* copy the union declaration to the output,
@@ -1364,7 +1360,7 @@ cpyunion()
}
static void
-cpycode()
+cpycode(void)
{
/* copies code between \{ and \} */
@@ -1403,7 +1399,7 @@ cpycode()
}
static int
-skipcom()
+skipcom(void)
{
/* skip over comments */
int c, i = 0; /* i is the number of lines skipped */
@@ -1711,15 +1707,14 @@ lcopy:
}
static void
-lhsfill(s) /* new rule, dump old (if exists), restart strings */
-wchar_t *s;
+lhsfill(wchar_t *s) /* new rule, dump old (if exists), restart strings */
{
static int lhs_len = LHS_TEXT_LEN;
int s_lhs = wslen(s);
if (s_lhs >= lhs_len) {
lhs_len = s_lhs + 2;
lhstext = (wchar_t *)
- realloc((char *)lhstext, sizeof (wchar_t)*lhs_len);
+ realloc((char *)lhstext, sizeof (wchar_t)*lhs_len);
if (lhstext == NULL)
/*
* TRANSLATION_NOTE -- This is a message from yacc.
@@ -1727,15 +1722,14 @@ wchar_t *s;
* LHS -- Left Hand Side.
*/
error(gettext(
- "couldn't expanded LHS length"));
+ "couldn't expanded LHS length"));
}
rhsfill((wchar_t *)0);
(void) wscpy(lhstext, s); /* don't worry about too long of a name */
}
static void
-rhsfill(s)
-wchar_t *s; /* either name or 0 */
+rhsfill(wchar_t *s) /* either name or 0 */
{
static wchar_t *loc; /* next free location in rhstext */
static int rhs_len = RHS_TEXT_LEN;
@@ -1759,7 +1753,7 @@ wchar_t *s; /* either name or 0 */
textbase = rhstext;
rhs_len += s_rhs + RHS_TEXT_LEN;
rhstext = (wchar_t *)
- realloc((char *)rhstext, sizeof (wchar_t)*rhs_len);
+ realloc((char *)rhstext, sizeof (wchar_t)*rhs_len);
if (rhstext == NULL)
/*
* TRANSLATION_NOTE -- This is a message from yacc.
@@ -1767,7 +1761,7 @@ wchar_t *s; /* either name or 0 */
* RHS -- Right Hand Side.
*/
error(gettext(
- "couldn't expanded RHS length"));
+ "couldn't expanded RHS length"));
loc = loc - textbase + rhstext;
}
@@ -1777,7 +1771,7 @@ wchar_t *s; /* either name or 0 */
*loc++ = L'\''; /* add first quote */
p++;
}
- while (*loc = *p++)
+ while ((*loc = *p++))
if (loc++ > &rhstext[ RHS_TEXT_LEN ] - 3)
break;
@@ -1787,7 +1781,7 @@ wchar_t *s; /* either name or 0 */
}
static void
-lrprnt() /* print out the left and right hand sides */
+lrprnt(void) /* print out the left and right hand sides */
{
wchar_t *rhs;
wchar_t *m_rhs = NULL;
@@ -1863,7 +1857,7 @@ lrprnt() /* print out the left and right hand sides */
static void
-beg_debug() /* dump initial sequence for fdebug file */
+beg_debug(void) /* dump initial sequence for fdebug file */
{
(void) fprintf(fdebug,
"typedef struct\n");
@@ -1882,7 +1876,7 @@ beg_debug() /* dump initial sequence for fdebug file */
static void
-end_toks() /* finish yytoks array, get ready for yyred's strings */
+end_toks(void) /* finish yytoks array, get ready for yyred's strings */
{
(void) fprintf(fdebug, "\t\"-unknown-\",\t-1\t/* ends search */\n");
(void) fprintf(fdebug, "};\n\n");
@@ -1894,7 +1888,7 @@ end_toks() /* finish yytoks array, get ready for yyred's strings */
static void
-end_debug() /* finish yyred array, close file */
+end_debug(void) /* finish yyred array, close file */
{
lrprnt(); /* dump last lhs, rhs */
(void) fprintf(fdebug, "};\n#endif /* YYDEBUG */\n");
@@ -1908,7 +1902,7 @@ end_debug() /* finish yyred array, close file */
* seen that has a longer length, expand "tokname" by NAMESIZE.
*/
static void
-exp_tokname()
+exp_tokname(void)
{
toksize += NAMESIZE;
tokname = (wchar_t *)
@@ -1921,7 +1915,7 @@ exp_tokname()
*
*/
static void
-exp_prod()
+exp_prod(void)
{
int i;
nprodsz += NPROD;
@@ -1958,7 +1952,7 @@ exp_prod()
* (ntoksz + NNONTERM) >= TEMPSIZE : temp1[]
*/
static void
-exp_ntok()
+exp_ntok(void)
{
ntoksz += NTERMS;
@@ -1980,7 +1974,7 @@ exp_ntok()
static void
-exp_nonterm()
+exp_nonterm(void)
{
nnontersz += NNONTERM;
@@ -2000,8 +1994,7 @@ exp_nonterm()
}
void
-exp_mem(flag)
-int flag;
+exp_mem(int flag)
{
int i;
static int *membase;
@@ -2009,7 +2002,7 @@ int flag;
membase = tracemem;
tracemem = (int *)
- realloc((char *)tracemem, sizeof (int) * new_memsize);
+ realloc((char *)tracemem, sizeof (int) * new_memsize);
if (tracemem == NULL)
/*
* TRANSLATION_NOTE -- This is a message from yacc.
@@ -2019,7 +2012,7 @@ int flag;
* 'Could not allocate internally used memory.'
*/
error(gettext(
- "couldn't expand mem table"));
+ "couldn't expand mem table"));
if (flag) {
for (i = 0; i <= nprod; ++i)
prdptr[i] = prdptr[i] - membase + tracemem;
@@ -2031,15 +2024,14 @@ int flag;
}
}
-static int
-findchtok(chlit)
-int chlit;
/*
* findchtok(chlit) returns the token number for a character literal
* chlit that is "bigger" than 255 -- the max char value that the
* original yacc was build for. This yacc treate them as though
* an ordinary token.
*/
+static int
+findchtok(int chlit)
{
int i;
diff --git a/usr/src/cmd/sgs/yacc/common/y3.c b/usr/src/cmd/sgs/yacc/common/y3.c
index 6cb3016370..b183a2ea4f 100644
--- a/usr/src/cmd/sgs/yacc/common/y3.c
+++ b/usr/src/cmd/sgs/yacc/common/y3.c
@@ -26,8 +26,6 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "dextern.h"
static void go2gen(int);
@@ -44,10 +42,10 @@ extern int cwp;
/* print the output for the states */
void
-output()
+output(void)
{
int i, k, c;
- register WSET *u, *v;
+ WSET *u, *v;
(void) fprintf(ftable, "static YYCONST yytabelem yyexca[] ={\n");
@@ -122,9 +120,7 @@ output()
static int pkdebug = 0;
int
-apack(p, n)
-int *p;
-int n;
+apack(int *p, int n)
{
/* pack state i from temp1 into amem */
int off;
@@ -169,7 +165,7 @@ int n;
if (pkdebug && foutput != NULL)
(void) fprintf(foutput,
- "off = %d, k = %" PRIdPTR "\n", off, rr-amem);
+ "off = %d, k = %" PRIdPTR "\n", off, rr-amem);
qq = rr;
for (pp = p; pp <= q; ++pp, ++qq) {
@@ -200,7 +196,7 @@ int n;
}
void
-go2out()
+go2out(void)
{
/* output the gotos for the nontermninals */
int i, j, k, best, count, cbest, times;
@@ -247,7 +243,8 @@ go2out()
}
static int g2debug = 0;
-static void go2gen(int c)
+static void
+go2gen(int c)
{
/* output the gotos for nonterminal c */
int i, work, cc;
@@ -488,9 +485,7 @@ wdef(wchar_t *s, int n)
}
void
-warray(s, v, n)
-wchar_t *s;
-int *v, n;
+warray(wchar_t *s, int *v, int n)
{
int i;
(void) fprintf(ftable, WSFMT("static YYCONST yytabelem %ws[]={\n"), s);
@@ -506,7 +501,7 @@ int *v, n;
}
void
-hideprod()
+hideprod(void)
{
/*
* in order to free up the mem and amem arrays for the optimizer,
@@ -542,15 +537,14 @@ hideprod()
static int
-cmpmbchars(p, q)
-MBCLIT *p, *q;
+cmpmbchars(MBCLIT *p, MBCLIT *q)
{
/* Compare two MBLITs. */
return ((p->character) - (q->character));
}
static void
-wrmbchars()
+wrmbchars(void)
{
int i;
wdef(L"YYNMBCHARS", nmbchars);
diff --git a/usr/src/cmd/sgs/yacc/common/y4.c b/usr/src/cmd/sgs/yacc/common/y4.c
index e9c6b60a62..3e4e1ce487 100644
--- a/usr/src/cmd/sgs/yacc/common/y4.c
+++ b/usr/src/cmd/sgs/yacc/common/y4.c
@@ -26,8 +26,6 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "dextern.h"
#define NOMORE -1000
@@ -52,7 +50,7 @@ static int nxdb = 0;
static int adb = 0;
void
-callopt()
+callopt(void)
{
int i, *p, j, k, *q;
@@ -368,7 +366,7 @@ stin(int i)
}
static int
-nxti()
+nxti(void)
{
/* finds the next i */
int i, max, maxi;
@@ -394,7 +392,7 @@ nxti()
}
static void
-osummary()
+osummary(void)
{
/* write summary */
int i, *p;
@@ -419,7 +417,7 @@ osummary()
}
static void
-aoutput()
+aoutput(void)
{
/* this version is for C */
/* write out the optimized parser */
@@ -431,9 +429,7 @@ aoutput()
}
static void
-arout(s, v, n)
-wchar_t *s;
-int *v, n;
+arout(wchar_t *s, int *v, int n)
{
int i;
@@ -450,7 +446,7 @@ int *v, n;
}
static int
-gtnm()
+gtnm(void)
{
int s, val, c;
@@ -476,8 +472,7 @@ gtnm()
}
void
-exp_act(ptr)
-int **ptr;
+exp_act(int **ptr)
{
static int *actbase;
int i;
diff --git a/usr/src/cmd/sgs/yacc/common/yaccpar b/usr/src/cmd/sgs/yacc/common/yaccpar
index 552002fa09..ccae88bb17 100644
--- a/usr/src/cmd/sgs/yacc/common/yaccpar
+++ b/usr/src/cmd/sgs/yacc/common/yaccpar
@@ -27,8 +27,6 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
** Skeleton parser driver for yacc output
*/
@@ -90,14 +88,10 @@ int yychar; /* current input token number */
#define YYLEX() yycvtok(yylex())
/*
** yycvtok - return a token if i is a wchar_t value that exceeds 255.
-** If i<255, i itself is the token. If i>255 but the neither
+** If i<255, i itself is the token. If i>255 but the neither
** of the 30th or 31st bit is on, i is already a token.
*/
-#if defined(__STDC__) || defined(__cplusplus)
int yycvtok(int i)
-#else
-int yycvtok(i) int i;
-#endif
{
int first = 0;
int last = YYNMBCHARS - 1;
@@ -111,7 +105,7 @@ int yycvtok(i) int i;
while ((last>=first)&&(first>=0)) {/*Binary search loop*/
mid = (first+last)/2;
j = yymbchars[mid].character;
- if( j==i ){/*Found*/
+ if( j==i ){/*Found*/
return yymbchars[mid].tvalue;
}else if( j<i ){
first = mid + 1;
@@ -132,13 +126,9 @@ int yycvtok(i) int i;
/*
** yyparse - return 0 if worked, 1 if syntax error not recovered from
*/
-#if defined(__STDC__) || defined(__cplusplus)
int yyparse(void)
-#else
-int yyparse()
-#endif
{
- register YYSTYPE *yypvt = 0; /* top of value stack for $vars */
+ YYSTYPE *yypvt = 0; /* top of value stack for $vars */
#if defined(__cplusplus) || defined(lint)
/*
@@ -176,10 +166,10 @@ int yyparse()
#endif
{
- register YYSTYPE *yy_pv; /* top of value stack */
- register int *yy_ps; /* top of state stack */
- register int yy_state; /* current state */
- register int yy_n; /* internal state number info */
+ YYSTYPE *yy_pv; /* top of value stack */
+ int *yy_ps; /* top of state stack */
+ int yy_state; /* current state */
+ int yy_n; /* internal state number info */
goto yystack; /* moved from 6 lines above to here to please C++ */
/*
@@ -217,7 +207,7 @@ int yyparse()
*/
if ( yydebug )
{
- register int yy_i;
+ int yy_i;
printf( "State %d, token ", yy_state );
if ( yychar == 0 )
@@ -301,7 +291,7 @@ int yyparse()
#if YYDEBUG
if ( yydebug && yytmp )
{
- register int yy_i;
+ int yy_i;
printf( "Received token " );
if ( yychar == 0 )
@@ -343,7 +333,7 @@ int yyparse()
#if YYDEBUG
if ( yydebug && yytmp )
{
- register int yy_i;
+ int yy_i;
printf( "Received token " );
if ( yychar == 0 )
@@ -370,7 +360,7 @@ int yyparse()
** look through exception table
*/
{
- register YYCONST int *yyxi = yyexca;
+ YYCONST int *yyxi = yyexca;
while ( ( *yyxi != -1 ) ||
( yyxi[1] != yy_state ) )
@@ -456,7 +446,7 @@ int yyparse()
*/
if ( yydebug )
{
- register int yy_i;
+ int yy_i;
printf( "Error recovery discards " );
if ( yychar == 0 )
@@ -516,7 +506,7 @@ int yyparse()
*/
{
/* length of production doubled with extra bit */
- register int yy_len = yyr2[ yy_n ];
+ int yy_len = yyr2[ yy_n ];
if ( !( yy_len & 01 ) )
{
@@ -556,4 +546,3 @@ int yyparse()
}
goto yystack; /* reset registers in driver code */
}
-