Hello,
Upstream flex already updated function declarations to ANSI.
The following patch applies this change to the in-tree version.
Does it look OK?
- Michael
Index: ccl.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/ccl.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 ccl.c
--- ccl.c 19 Nov 2015 22:55:13 -0000 1.8
+++ ccl.c 25 Aug 2019 08:43:59 -0000
@@ -55,9 +55,7 @@ ccl_contains(const int cclp, const int c
/* ccladd - add a single character to a ccl */
void
-ccladd(cclp, ch)
- int cclp;
- int ch;
+ccladd(int cclp, int ch)
{
int ind, len, newpos, i;
@@ -190,7 +188,7 @@ ccl_set_union(int a, int b)
/* cclinit - return an empty ccl */
int
-cclinit()
+cclinit(void)
{
if (++lastccl >= current_maxccls) {
current_maxccls += MAX_CCLS_INCREMENT;
@@ -231,8 +229,7 @@ cclinit()
/* cclnegate - negate the given ccl */
void
-cclnegate(cclp)
- int cclp;
+cclnegate(int cclp)
{
cclng[cclp] = 1;
ccl_has_nl[cclp] = !ccl_has_nl[cclp];
@@ -247,9 +244,7 @@ cclnegate(cclp)
*/
void
-list_character_set(file, cset)
- FILE *file;
- int cset[];
+list_character_set(FILE *file, int cset[])
{
int i;
Index: dfa.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/dfa.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 dfa.c
--- dfa.c 19 Nov 2015 23:20:34 -0000 1.8
+++ dfa.c 25 Aug 2019 08:43:59 -0000
@@ -51,9 +51,8 @@ int symfollowset PROTO ((int[], int, int
* indexed by equivalence class.
*/
-void check_for_backing_up (ds, state)
- int ds;
- int state[];
+void
+check_for_backing_up(int ds, int state[])
{
if ((reject && !dfaacc[ds].dfaacc_set) || (!reject &&
!dfaacc[ds].dfaacc_state)) { /* state is non-accepting */
++num_backing_up;
@@ -98,10 +97,8 @@ void check_for_backing_up (ds, state)
* accset[1 .. nacc] is the list of accepting numbers for the DFA state.
*/
-void check_trailing_context (nfa_states, num_states, accset, nacc)
- int *nfa_states, num_states;
- int *accset;
- int nacc;
+void
+check_trailing_context(int *nfa_states, int num_states, int *accset, int nacc)
{
int i, j;
@@ -139,9 +136,8 @@ void check_trailing_context (nfa_states,
* and writes a report to the given file.
*/
-void dump_associated_rules (file, ds)
- FILE *file;
- int ds;
+void
+dump_associated_rules(FILE *file, int ds)
{
int i, j;
int num_associated_rules = 0;
@@ -189,9 +185,8 @@ void dump_associated_rules (file, ds)
* is done to the given file.
*/
-void dump_transitions (file, state)
- FILE *file;
- int state[];
+void
+dump_transitions(FILE *file, int state[])
{
int i, ec;
int out_char_set[CSIZE];
@@ -237,8 +232,8 @@ void dump_transitions (file, state)
* hashval is the hash value for the dfa corresponding to the state set.
*/
-int *epsclosure (t, ns_addr, accset, nacc_addr, hv_addr)
- int *t, *ns_addr, accset[], *nacc_addr, *hv_addr;
+int *
+epsclosure(int *t, int *ns_addr, int accset[], int *nacc_addr, int *hv_addr)
{
int stkpos, ns, tsp;
int numstates = *ns_addr, nacc, hashval, transsym, nfaccnum;
@@ -353,7 +348,8 @@ ADD_STATE(state); \
/* increase_max_dfas - increase the maximum number of DFAs */
-void increase_max_dfas ()
+void
+increase_max_dfas(void)
{
current_max_dfas += MAX_DFAS_INCREMENT;
@@ -380,7 +376,8 @@ void increase_max_dfas ()
* dfa starts out in state #1.
*/
-void ntod ()
+void
+ntod(void)
{
int *accset, ds, nacc, newds;
int sym, hashval, numstates, dsize;
@@ -822,8 +819,9 @@ void ntod ()
* On return, the dfa state number is in newds.
*/
-int snstods (sns, numstates, accset, nacc, hashval, newds_addr)
- int sns[], numstates, accset[], nacc, hashval, *newds_addr;
+int
+snstods(int sns[], int numstates, int accset[], int nacc, int hashval,
+ int *newds_addr)
{
int didsort = 0;
int i, j;
@@ -944,8 +942,8 @@ int snstods (sns, numstates, accset, nac
* int transsym, int nset[current_max_dfa_size] );
*/
-int symfollowset (ds, dsize, transsym, nset)
- int ds[], dsize, transsym, nset[];
+int
+symfollowset(int ds[], int dsize, int transsym, int nset[])
{
int ns, tsp, sym, i, j, lenccl, ch, numstates, ccllist;
@@ -1022,9 +1020,8 @@ int symfollowset (ds, dsize, transsym, n
* int symlist[numecs], int duplist[numecs] );
*/
-void sympartition (ds, numstates, symlist, duplist)
- int ds[], numstates;
- int symlist[], duplist[];
+void
+sympartition(int ds[], int numstates, int symlist[], int duplist[])
{
int tch, i, j, k, ns, dupfwd[CSIZE + 1], lenccl, cclp, ich;
Index: gen.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/gen.c,v
retrieving revision 1.15
diff -u -p -u -r1.15 gen.c
--- gen.c 19 Nov 2015 23:28:03 -0000 1.15
+++ gen.c 25 Aug 2019 08:43:59 -0000
@@ -129,7 +129,7 @@ mkeoltbl(void)
/* Generate the table for possible eol matches. */
static void
-geneoltbl()
+geneoltbl(void)
{
int i;
@@ -154,7 +154,7 @@ geneoltbl()
/* Generate the code to keep backing-up information. */
void
-gen_backing_up()
+gen_backing_up(void)
{
if (reject || num_backing_up == 0)
return;
@@ -176,7 +176,7 @@ gen_backing_up()
/* Generate the code to perform the backing up. */
void
-gen_bu_action()
+gen_bu_action(void)
{
if (reject || num_backing_up == 0)
return;
@@ -342,7 +342,7 @@ mkssltbl(void)
/* genctbl - generates full speed compressed transition table */
void
-genctbl()
+genctbl(void)
{
int i;
int end_of_buffer_action = num_rules + 1;
@@ -476,7 +476,7 @@ mkecstbl(void)
/* Generate equivalence-class tables. */
void
-genecs()
+genecs(void)
{
int i, j;
int numrows;
@@ -512,7 +512,7 @@ genecs()
/* Generate the code to find the action number. */
void
-gen_find_action()
+gen_find_action(void)
{
if (fullspd)
indent_puts("yy_act = yy_current_state[-1].yy_nxt;");
@@ -690,7 +690,7 @@ mkftbl(void)
/* genftbl - generate full transition table */
void
-genftbl()
+genftbl(void)
{
int i;
int end_of_buffer_action = num_rules + 1;
@@ -725,8 +725,7 @@ genftbl()
/* Generate the code to find the next compressed-table state. */
void
-gen_next_compressed_state(char_map)
- char *char_map;
+gen_next_compressed_state(char *char_map)
{
indent_put2s("YY_CHAR yy_c = %s;", char_map);
@@ -771,7 +770,7 @@ gen_next_compressed_state(char_map)
/* Generate the code to find the next match. */
void
-gen_next_match()
+gen_next_match(void)
{
/*
* NOTE - changes in here should be reflected in gen_next_state() and
@@ -873,8 +872,7 @@ gen_next_match()
/* Generate the code to find the next state. */
void
-gen_next_state(worry_about_NULs)
- int worry_about_NULs;
+gen_next_state(int worry_about_NULs)
{ /* NOTE - changes in here should be reflected
* in gen_next_match() */
char char_map[256];
@@ -940,7 +938,7 @@ gen_next_state(worry_about_NULs)
/* Generate the code to make a NUL transition. */
void
-gen_NUL_trans()
+gen_NUL_trans(void)
{ /* NOTE - changes in here should be reflected
* in gen_next_match() */
/*
@@ -1025,7 +1023,7 @@ gen_NUL_trans()
/* Generate the code to find the start state. */
void
-gen_start_state()
+gen_start_state(void)
{
if (fullspd) {
if (bol_needed) {
@@ -1056,7 +1054,7 @@ gen_start_state()
/* gentabs - generate data statements for the transition tables */
void
-gentabs()
+gentabs(void)
{
int i, j, k, *accset, nacc, *acc_array, total_states;
int end_of_buffer_action = num_rules + 1;
@@ -1475,8 +1473,7 @@ gentabs()
*/
void
-indent_put2s(fmt, arg)
- const char *fmt, *arg;
+indent_put2s(const char *fmt, const char *arg)
{
do_indent();
out_str(fmt, arg);
@@ -1489,8 +1486,7 @@ indent_put2s(fmt, arg)
*/
void
-indent_puts(str)
- const char *str;
+indent_puts(const char *str)
{
do_indent();
outn(str);
@@ -1501,7 +1497,7 @@ indent_puts(str)
*/
void
-make_tables()
+make_tables(void)
{
int i;
int did_eof_rule = false;
Index: libmain.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/libmain.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 libmain.c
--- libmain.c 19 Nov 2015 22:52:40 -0000 1.9
+++ libmain.c 25 Aug 2019 08:43:59 -0000
@@ -26,9 +26,7 @@
extern int yylex();
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
while (yylex() != 0);
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/main.c,v
retrieving revision 1.27
diff -u -p -u -r1.27 main.c
--- main.c 21 Jan 2017 08:33:07 -0000 1.27
+++ main.c 25 Aug 2019 08:44:00 -0000
@@ -137,9 +137,7 @@ int flex_main PROTO((int argc, char *arg
int main PROTO((int argc, char *argv[]));
int
-flex_main(argc, argv)
- int argc;
- char *argv[];
+flex_main(int argc, char *argv[])
{
int i, exit_status, child_status;
@@ -202,9 +200,7 @@ flex_main(argc, argv)
/* Wrapper around flex_main, so flex_main can be built as a library. */
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
#if ENABLE_NLS
#if HAVE_LOCALE_H
@@ -226,7 +222,7 @@ main(argc, argv)
/* check_options - check user-specified options */
void
-check_options()
+check_options(void)
{
int i;
@@ -473,9 +469,7 @@ check_options()
*/
void
-flexend(exit_status)
- int exit_status;
-
+flexend(int exit_status)
{
static int called_before = -1; /* prevent infinite recursion. */
int tblsiz;
@@ -904,9 +898,7 @@ flexend(exit_status)
/* flexinit - initialize flex */
void
-flexinit(argc, argv)
- int argc;
- char **argv;
+flexinit(int argc, char **argv)
{
int i, sawcmpflag, rv, optind;
char *arg;
@@ -1434,7 +1426,7 @@ flexinit(argc, argv)
/* readin - read in the rules section of the input file(s) */
void
-readin()
+readin(void)
{
static char yy_stdinit[] = "FILE *yyin = stdin, *yyout = stdout;";
static char yy_nostdinit[] =
@@ -1660,7 +1652,7 @@ readin()
/* set_up_initial_allocations - allocate memory for internal tables */
void
-set_up_initial_allocations()
+set_up_initial_allocations(void)
{
maximum_mns = (long_align ? MAXIMUM_MNS_LONG : MAXIMUM_MNS);
current_mns = INITIAL_MNS;
@@ -1721,9 +1713,7 @@ set_up_initial_allocations()
/* extracts basename from path, optionally stripping the extension "\.*"
* (same concept as /bin/sh `basename`, but different handling of extension).
*/
static char *
-basename2(path, strip_ext)
- char *path;
- int strip_ext; /* boolean */
+basename2(char *path, int strip_ext)
{
char *b, *e = 0;
@@ -1740,7 +1730,7 @@ basename2(path, strip_ext)
}
void
-usage()
+usage(void)
{
FILE *f = stdout;
Index: misc.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/misc.c,v
retrieving revision 1.19
diff -u -p -u -r1.19 misc.c
--- misc.c 19 Nov 2015 23:34:56 -0000 1.19
+++ misc.c 25 Aug 2019 08:44:00 -0000
@@ -95,9 +95,7 @@ sko_pop(bool * dc)
/* Append "#define defname value\n" to the running buffer. */
void
-action_define(defname, value)
- const char *defname;
- int value;
+action_define(const char *defname, int value)
{
char buf[MAXLINE];
char *cpy;
@@ -140,8 +138,7 @@ action_m4_define(const char *defname, co
/* Append "new_text" to the running buffer. */
void
-add_action(new_text)
- const char *new_text;
+add_action(const char *new_text)
{
int len = strlen(new_text);
@@ -172,9 +169,7 @@ add_action(new_text)
/* allocate_array - allocate memory for an integer array of the given size */
void *
-allocate_array(size, element_size)
- int size;
- size_t element_size;
+allocate_array(int size, size_t element_size)
{
void *mem;
size_t num_bytes = element_size * size;
@@ -191,8 +186,7 @@ allocate_array(size, element_size)
/* all_lower - true if a string is all lower-case */
int
-all_lower(str)
- char *str;
+all_lower(char *str)
{
while (*str) {
if (!isascii((u_char) * str) || !islower((u_char) * str))
@@ -207,8 +201,7 @@ all_lower(str)
/* all_upper - true if a string is all upper-case */
int
-all_upper(str)
- char *str;
+all_upper(char *str)
{
while (*str) {
if (!isascii((u_char) * str) || !isupper((u_char) * str))
@@ -235,8 +228,7 @@ intcmp(const void *a, const void *b)
*/
void
-check_char(c)
- int c;
+check_char(int c)
{
if (c >= CSIZE)
lerrsf(_("bad character '%s' detected in check_char()"),
@@ -253,8 +245,7 @@ check_char(c)
/* clower - replace upper-case letter to lower-case */
u_char
-clower(c)
- int c;
+clower(int c)
{
return (u_char) ((isascii(c) && isupper(c)) ? tolower(c) : c);
}
@@ -263,8 +254,7 @@ clower(c)
/* copy_string - returns a dynamically allocated copy of a string */
char *
-copy_string(str)
- const char *str;
+copy_string(const char *str)
{
const char *c1;
char *c2;
@@ -292,8 +282,7 @@ copy_string(str)
*/
u_char *
-copy_unsigned_string(str)
- u_char *str;
+copy_unsigned_string(u_char *str)
{
u_char *c;
u_char *copy;
@@ -326,7 +315,7 @@ cclcmp(const void *a, const void *b)
/* dataend - finish up a block of data declarations */
void
-dataend()
+dataend(void)
{
/* short circuit any output */
if (gentables) {
@@ -345,7 +334,7 @@ dataend()
/* dataflush - flush generated data statements */
void
-dataflush()
+dataflush(void)
{
/* short circuit any output */
if (!gentables)
@@ -369,8 +358,7 @@ dataflush()
/* flexerror - report an error message and terminate */
void
-flexerror(msg)
- const char *msg;
+flexerror(const char *msg)
{
fprintf(stderr, "%s: %s\n", program_name, msg);
flexend(1);
@@ -380,8 +368,7 @@ flexerror(msg)
/* flexfatal - report a fatal error message and terminate */
void
-flexfatal(msg)
- const char *msg;
+flexfatal(const char *msg)
{
fprintf(stderr, _("%s: fatal internal error, %s\n"),
program_name, msg);
@@ -392,8 +379,7 @@ flexfatal(msg)
/* htoi - convert a hexadecimal digit string to an integer value */
int
-htoi(str)
- u_char str[];
+htoi(u_char str[])
{
unsigned int result;
@@ -406,9 +392,7 @@ htoi(str)
/* lerrif - report an error message formatted with one integer argument */
void
-lerrif(msg, arg)
- const char *msg;
- int arg;
+lerrif(const char *msg, int arg)
{
char errmsg[MAXLINE];
@@ -420,8 +404,7 @@ lerrif(msg, arg)
/* lerrsf - report an error message formatted with one string argument */
void
-lerrsf(msg, arg)
- const char *msg, arg[];
+lerrsf(const char *msg, const char arg[])
{
char errmsg[MAXLINE];
@@ -434,8 +417,7 @@ lerrsf(msg, arg)
/* lerrsf_fatal - as lerrsf, but call flexfatal */
void
-lerrsf_fatal(msg, arg)
- const char *msg, arg[];
+lerrsf_fatal(const char *msg, const char arg[])
{
char errmsg[MAXLINE];
@@ -448,9 +430,7 @@ lerrsf_fatal(msg, arg)
/* line_directive_out - spit out a "#line" statement */
void
-line_directive_out(output_file, do_infile)
- FILE *output_file;
- int do_infile;
+line_directive_out(FILE *output_file, int do_infile)
{
char directive[MAXLINE], filename[MAXLINE];
char *s1, *s2, *s3;
@@ -499,7 +479,7 @@ line_directive_out(output_file, do_infil
* and the prolog begins
*/
void
-mark_defs1()
+mark_defs1(void)
{
defs1_offset = 0;
action_array[action_index++] = '\0';
@@ -512,7 +492,7 @@ mark_defs1()
* representing the end of the action prolog
*/
void
-mark_prolog()
+mark_prolog(void)
{
action_array[action_index++] = '\0';
action_offset = action_index;
@@ -525,8 +505,7 @@ mark_prolog()
* Generates a data statement initializing the current 2-D array to "value".
*/
void
-mk2data(value)
- int value;
+mk2data(int value)
{
/* short circuit any output */
if (!gentables)
@@ -555,8 +534,7 @@ mk2data(value)
* "value".
*/
void
-mkdata(value)
- int value;
+mkdata(int value)
{
/* short circuit any output */
if (!gentables)
@@ -581,8 +559,7 @@ mkdata(value)
/* myctoi - return the integer represented by a string of digits */
int
-myctoi(array)
- const char *array;
+myctoi(const char *array)
{
int val = 0;
@@ -595,8 +572,7 @@ myctoi(array)
/* myesc - return character corresponding to escape sequence */
u_char
-myesc(array)
- u_char array[];
+myesc(u_char array[])
{
u_char c, esc_char;
@@ -686,8 +662,7 @@ myesc(array)
/* otoi - convert an octal digit string to an integer value */
int
-otoi(str)
- u_char str[];
+otoi(u_char str[])
{
unsigned int result;
@@ -701,68 +676,55 @@ otoi(str)
*/
void
-out(str)
- const char *str;
+out(const char *str)
{
fputs(str, stdout);
}
void
-out_dec(fmt, n)
- const char *fmt;
- int n;
+out_dec(const char *fmt, int n)
{
fprintf(stdout, fmt, n);
}
void
-out_dec2(fmt, n1, n2)
- const char *fmt;
- int n1, n2;
+out_dec2(const char *fmt, int n1, int n2)
{
fprintf(stdout, fmt, n1, n2);
}
void
-out_hex(fmt, x)
- const char *fmt;
- unsigned int x;
+out_hex(const char *fmt, unsigned int x)
{
fprintf(stdout, fmt, x);
}
void
-out_str(fmt, str)
- const char *fmt, str[];
+out_str(const char *fmt, const char str[])
{
fprintf(stdout, fmt, str);
}
void
-out_str3(fmt, s1, s2, s3)
- const char *fmt, s1[], s2[], s3[];
+out_str3(const char *fmt, const char s1[], const char s2[], const char s3[])
{
fprintf(stdout, fmt, s1, s2, s3);
}
void
-out_str_dec(fmt, str, n)
- const char *fmt, str[];
- int n;
+out_str_dec(const char *fmt, const char str[], int n)
{
fprintf(stdout, fmt, str, n);
}
void
-outc(c)
- int c;
+outc(int c)
{
fputc(c, stdout);
}
void
-outn(str)
- const char *str;
+outn(const char *str)
{
fputs(str, stdout);
fputc('\n', stdout);
@@ -787,8 +749,7 @@ out_m4_define(const char *def, const cha
*/
char *
-readable_form(c)
- int c;
+readable_form(int c)
{
static char rform[10];
@@ -831,10 +792,7 @@ readable_form(c)
/* reallocate_array - increase the size of a dynamic array */
void *
-reallocate_array(array, size, element_size)
- void *array;
- int size;
- size_t element_size;
+reallocate_array(void *array, int size, size_t element_size)
{
void *new_array;
size_t num_bytes = element_size * size;
@@ -854,7 +812,7 @@ reallocate_array(array, size, element_si
* "%%" or EOF is found.
*/
void
-skelout()
+skelout(void)
{
char buf_storage[MAXLINE];
char *buf = buf_storage;
@@ -969,8 +927,7 @@ skelout()
*/
void
-transition_struct_out(element_v, element_n)
- int element_v, element_n;
+transition_struct_out(int element_v, int element_n)
{
/* short circuit any output */
@@ -996,8 +953,7 @@ transition_struct_out(element_v, element
* broken versions of bison.
*/
void *
-yy_flex_xmalloc(size)
- int size;
+yy_flex_xmalloc(int size)
{
void *result = malloc((size_t) size);
@@ -1013,8 +969,7 @@ yy_flex_xmalloc(size)
* str can be any null-terminated string, or NULL.
* returns str. */
char *
-chomp(str)
- char *str;
+chomp(char *str)
{
char *p = str;
Index: nfa.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/nfa.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 nfa.c
--- nfa.c 19 Nov 2015 22:52:40 -0000 1.11
+++ nfa.c 25 Aug 2019 08:44:00 -0000
@@ -48,8 +48,7 @@ void mkxtion PROTO((int, int));
*/
void
-add_accept(mach, accepting_number)
- int mach, accepting_number;
+add_accept(int mach, int accepting_number)
{
/*
* Hang the accepting number off an epsilon state. if it is
@@ -82,8 +81,7 @@ add_accept(mach, accepting_number)
*/
int
-copysingl(singl, num)
- int singl, num;
+copysingl(int singl, int num)
{
int copy, i;
@@ -99,9 +97,7 @@ copysingl(singl, num)
/* dumpnfa - debugging routine to write out an nfa */
void
-dumpnfa(state1)
- int state1;
-
+dumpnfa(int state1)
{
int sym, tsp1, tsp2, anum, ns;
@@ -156,8 +152,7 @@ dumpnfa(state1)
*/
int
-dupmachine(mach)
- int mach;
+dupmachine(int mach)
{
int i, init, state_offset;
int state = 0;
@@ -204,9 +199,8 @@ dupmachine(mach)
*/
void
-finish_rule(mach, variable_trail_rule, headcnt, trailcnt,
- pcont_act)
- int mach, variable_trail_rule, headcnt, trailcnt, pcont_act;
+finish_rule(int mach, int variable_trail_rule, int headcnt, int trailcnt,
+ int pcont_act)
{
char action_text[MAXLINE];
@@ -319,8 +313,7 @@ finish_rule(mach, variable_trail_rule, h
*/
int
-link_machines(first, last)
- int first, last;
+link_machines(int first, int last)
{
if (first == NIL)
return last;
@@ -347,8 +340,7 @@ link_machines(first, last)
*/
void
-mark_beginning_as_normal(mach)
- int mach;
+mark_beginning_as_normal(int mach)
{
switch (state_type[mach]) {
case STATE_NORMAL:
@@ -390,8 +382,7 @@ mark_beginning_as_normal(mach)
*/
int
-mkbranch(first, second)
- int first, second;
+mkbranch(int first, int second)
{
int eps;
@@ -419,8 +410,7 @@ mkbranch(first, second)
*/
int
-mkclos(state)
- int state;
+mkclos(int state)
{
return mkopt(mkposcl(state));
}
@@ -441,8 +431,7 @@ mkclos(state)
*/
int
-mkopt(mach)
- int mach;
+mkopt(int mach)
{
int eps;
@@ -479,8 +468,7 @@ mkopt(mach)
*/
int
-mkor(first, second)
- int first, second;
+mkor(int first, int second)
{
int eps, orend;
@@ -534,8 +522,7 @@ mkor(first, second)
*/
int
-mkposcl(state)
- int state;
+mkposcl(int state)
{
int eps;
@@ -563,8 +550,7 @@ mkposcl(state)
*/
int
-mkrep(mach, lb, ub)
- int mach, lb, ub;
+mkrep(int mach, int lb, int ub)
{
int base_mach, tail, copy, i;
@@ -609,8 +595,7 @@ mkrep(mach, lb, ub)
*/
int
-mkstate(sym)
- int sym;
+mkstate(int sym)
{
if (++lastnfa >= current_mns) {
if ((current_mns += MNS_INCREMENT) >= maximum_mns)
@@ -686,8 +671,7 @@ mkstate(sym)
*/
void
-mkxtion(statefrom, stateto)
- int statefrom, stateto;
+mkxtion(int statefrom, int stateto)
{
if (trans1[statefrom] == NO_TRANSITION)
trans1[statefrom] = stateto;
@@ -705,7 +689,7 @@ mkxtion(statefrom, stateto)
/* new_rule - initialize for a new rule */
void
-new_rule()
+new_rule(void)
{
if (++num_rules >= current_max_rules) {
++num_reallocs;
Index: scanopt.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/scanopt.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 scanopt.c
--- scanopt.c 31 May 2017 07:20:26 -0000 1.6
+++ scanopt.c 25 Aug 2019 08:44:02 -0000
@@ -44,9 +44,8 @@
#else
static int STRCASECMP PROTO ((const char *, const char *));
-static int STRCASECMP (a, b)
- const char *a;
- const char *b;
+static int
+STRCASECMP(const char *a, const char *b)
{
while (tolower ((u_char)*a++) == tolower ((u_char)*b++)) ;
return b - a;
@@ -89,38 +88,33 @@ static int matchlongopt PROTO ((char *,
static int find_opt
PROTO ((struct _scanopt_t *, int, char *, int, int *, int *opt_offset));
-static const char *NAME (s, i)
- struct _scanopt_t *s;
- int i;
+static const char *
+NAME(struct _scanopt_t *s, int i)
{
return s->options[i].opt_fmt +
((s->aux[i].flags & IS_LONG) ? 2 : 1);
}
-static int PRINTLEN (s, i)
- struct _scanopt_t *s;
- int i;
+static int
+PRINTLEN(struct _scanopt_t *s, int i)
{
return s->aux[i].printlen;
}
-static int RVAL (s, i)
- struct _scanopt_t *s;
- int i;
+static int
+RVAL(struct _scanopt_t *s, int i)
{
return s->options[i].r_val;
}
-static int FLAGS (s, i)
- struct _scanopt_t *s;
- int i;
+static int
+FLAGS(struct _scanopt_t *s, int i)
{
return s->aux[i].flags;
}
-static const char *DESC (s, i)
- struct _scanopt_t *s;
- int i;
+static const char *
+DESC(struct _scanopt_t *s, int i)
{
return s->options[i].desc ? s->options[i].desc : "";
}
@@ -128,7 +122,8 @@ static const char *DESC (s, i)
#ifndef NO_SCANOPT_USAGE
static int get_cols PROTO ((void));
-static int get_cols ()
+static int
+get_cols(void)
{
char *env;
int cols = 80; /* default */
@@ -161,11 +156,8 @@ static int get_cols ()
(s)->subscript= 0; \
}while(0)
-scanopt_t *scanopt_init (options, argc, argv, flags)
- const optspec_t *options;
- int argc;
- char **argv;
- int flags;
+scanopt_t *
+scanopt_init(const optspec_t *options, int argc, char **argv, int flags)
{
int i;
struct _scanopt_t *s;
@@ -257,10 +249,8 @@ typedef struct usg_elem usg_elem;
[indent][option, alias1, alias2...][indent][description line1
description line2...]
*/
-int scanopt_usage (scanner, fp, usage)
- scanopt_t *scanner;
- FILE *fp;
- const char *usage;
+int
+scanopt_usage(scanopt_t *scanner, FILE *fp, const char *usage)
{
struct _scanopt_t *s;
int i, columns, indent = 2;
@@ -531,11 +521,8 @@ int scanopt_usage (scanner, fp, usag
#endif /* no scanopt_usage */
-static int scanopt_err (s, opt_offset, is_short, err)
- struct _scanopt_t *s;
- int opt_offset;
- int is_short;
- int err;
+static int
+scanopt_err(struct _scanopt_t *s, int opt_offset, int is_short, int err)
{
const char *optname = "";
char optchar[2];
@@ -594,12 +581,8 @@ static int scanopt_err (s, opt_offset, i
* optname will point to str + 2
*
*/
-static int matchlongopt (str, optname, optlen, arg, arglen)
- char *str;
- char **optname;
- int *optlen;
- char **arg;
- int *arglen;
+static int
+matchlongopt(char *str, char **optname, int *optlen, char **arg, int *arglen)
{
char *p;
@@ -641,13 +624,9 @@ static int matchlongopt (str, optname, o
* Short options must be exact.
* Return boolean true if found and no error.
* Error stored in err_code or zero if no error. */
-static int find_opt (s, lookup_long, optstart, len, err_code, opt_offset)
- struct _scanopt_t *s;
- int lookup_long;
- char *optstart;
- int len;
- int *err_code;
- int *opt_offset;
+static int
+find_opt(struct _scanopt_t *s, int lookup_long, char *optstart, int len,
+ int *err_code, int *opt_offset)
{
int nmatch = 0, lastr_val = 0, i;
@@ -704,12 +683,9 @@ static int find_opt (s, lookup_long, opt
return *err_code ? 0 : 1;
}
-
-int scanopt (svoid, arg, optindex)
- scanopt_t *svoid;
- char **arg;
- int *optindex;
+int
+scanopt(scanopt_t *svoid, char **arg, int *optindex)
{
char *optname = NULL, *optarg = NULL, *pstart;
int namelen = 0, arglen = 0;
@@ -857,8 +833,8 @@ int scanopt (svoid, arg, optindex)
}
-void scanopt_destroy (svoid)
- scanopt_t *svoid;
+void
+scanopt_destroy(scanopt_t *svoid)
{
struct _scanopt_t *s;
Index: sym.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/sym.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 sym.c
--- sym.c 19 Nov 2015 23:34:56 -0000 1.9
+++ sym.c 25 Aug 2019 08:44:04 -0000
@@ -74,12 +74,8 @@ static int hashfunct PROTO ((const char
* -1 is returned if the symbol already exists, and the change not made.
*/
-static int addsym (sym, str_def, int_def, table, table_size)
- char sym[];
- char *str_def;
- int int_def;
- hash_table table;
- int table_size;
+static int
+addsym(char sym[], char *str_def, int int_def, hash_table table, int
table_size)
{
int hash_val = hashfunct (sym, table_size);
struct hash_entry *sym_entry = table[hash_val];
@@ -121,9 +117,8 @@ static int addsym (sym, str_def, int_def
/* cclinstal - save the text of a character class */
-void cclinstal (ccltxt, cclnum)
- u_char ccltxt[];
- int cclnum;
+void
+cclinstal(u_char ccltxt[], int cclnum)
{
/* We don't bother checking the return status because we are not
* called unless the symbol is new.
@@ -139,8 +134,8 @@ void cclinstal (ccltxt, cclnum)
* Returns 0 if there's no CCL associated with the text.
*/
-int ccllookup (ccltxt)
- u_char ccltxt[];
+int
+ccllookup(u_char ccltxt[])
{
return findsym ((char *) ccltxt, ccltab, CCL_HASH_SIZE)->int_val;
}
@@ -148,10 +143,8 @@ int ccllookup (ccltxt)
/* findsym - find symbol in symbol table */
-static struct hash_entry *findsym (sym, table, table_size)
- const char *sym;
- hash_table table;
- int table_size;
+static struct hash_entry *
+findsym(const char *sym, hash_table table, int table_size)
{
static struct hash_entry empty_entry = {
(struct hash_entry *) 0, (struct hash_entry *) 0,
@@ -172,9 +165,8 @@ static struct hash_entry *findsym (sym,
/* hashfunct - compute the hash value for "str" and hash size "hash_size" */
-static int hashfunct (str, hash_size)
- const char *str;
- int hash_size;
+static int
+hashfunct(const char *str, int hash_size)
{
int hashval;
int locstr;
@@ -193,9 +185,8 @@ static int hashfunct (str, hash_size)
/* ndinstal - install a name definition */
-void ndinstal (name, definition)
- const char *name;
- u_char definition[];
+void
+ndinstal(const char *name, u_char definition[])
{
if (addsym (copy_string (name),
@@ -210,8 +201,8 @@ void ndinstal (name, definition)
* Returns a nil pointer if the name definition does not exist.
*/
-u_char *ndlookup (nd)
- const char *nd;
+u_char *
+ndlookup(const char *nd)
{
return (u_char *) findsym (nd, ndtbl, NAME_TABLE_HASH_SIZE)->str_val;
}
@@ -219,7 +210,8 @@ u_char *ndlookup (nd)
/* scextend - increase the maximum number of start conditions */
-void scextend ()
+void
+scextend(void)
{
current_max_scs += MAX_SCS_INCREMENT;
@@ -239,9 +231,8 @@ void scextend ()
* The start condition is "exclusive" if xcluflg is true.
*/
-void scinstal (str, xcluflg)
- const char *str;
- int xcluflg;
+void
+scinstal(const char *str, int xcluflg)
{
if (++lastsc >= current_max_scs)
@@ -267,8 +258,8 @@ str);
* Returns 0 if no such start condition.
*/
-int sclookup (str)
- const char *str;
+int
+sclookup(const char *str)
{
return findsym (str, sctbl, START_COND_HASH_SIZE)->int_val;
}
Index: tblcmp.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/tblcmp.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 tblcmp.c
--- tblcmp.c 19 Nov 2015 23:34:56 -0000 1.10
+++ tblcmp.c 25 Aug 2019 08:44:04 -0000
@@ -81,8 +81,7 @@ int tbldiff PROTO((int[], int, int[]));
*/
void
-bldtbl(state, statenum, totaltrans, comstate, comfreq)
- int state[], statenum, totaltrans, comstate, comfreq;
+bldtbl(int state[], int statenum, int totaltrans, int comstate, int comfreq)
{
int extptr, extrct[2][CSIZE + 1];
int mindiff, minprot, i, d;
@@ -231,7 +230,7 @@ bldtbl(state, statenum, totaltrans, coms
*/
void
-cmptmps()
+cmptmps(void)
{
int tmpstorage[CSIZE + 1];
int *tmp = tmpstorage, i, j;
@@ -299,7 +298,7 @@ cmptmps()
/* expand_nxt_chk - expand the next check arrays */
void
-expand_nxt_chk()
+expand_nxt_chk(void)
{
int old_max = current_max_xpairs;
@@ -334,8 +333,7 @@ expand_nxt_chk()
*/
int
-find_table_space(state, numtrans)
- int *state, numtrans;
+find_table_space(int *state, int numtrans)
{
/*
* Firstfree is the position of the first possible occurrence of two
@@ -435,7 +433,7 @@ find_table_space(state, numtrans)
* all "chk" entries to be zero.
*/
void
-inittbl()
+inittbl(void)
{
int i;
@@ -467,7 +465,7 @@ inittbl()
/* mkdeftbl - make the default, "jam" table entries */
void
-mkdeftbl()
+mkdeftbl(void)
{
int i;
@@ -518,9 +516,7 @@ mkdeftbl()
*/
void
-mkentry(state, numchars, statenum, deflink, totaltrans)
- int *state;
- int numchars, statenum, deflink, totaltrans;
+mkentry(int *state, int numchars, int statenum, int deflink, int totaltrans)
{
int minec, maxec, i, baseaddr;
int tblbase, tbllast;
@@ -636,8 +632,7 @@ mkentry(state, numchars, statenum, defli
*/
void
-mk1tbl(state, sym, onenxt, onedef)
- int state, sym, onenxt, onedef;
+mk1tbl(int state, int sym, int onenxt, int onedef)
{
if (firstfree < sym)
firstfree = sym;
@@ -663,8 +658,7 @@ mk1tbl(state, sym, onenxt, onedef)
/* mkprot - create new proto entry */
void
-mkprot(state, statenum, comstate)
- int state[], statenum, comstate;
+mkprot(int state[], int statenum, int comstate)
{
int i, slot, tblbase;
@@ -701,8 +695,7 @@ mkprot(state, statenum, comstate)
*/
void
-mktemplate(state, statenum, comstate)
- int state[], statenum, comstate;
+mktemplate(int state[], int statenum, int comstate)
{
int i, numdiff, tmpbase, tmp[CSIZE + 1];
u_char transset[CSIZE + 1];
@@ -755,8 +748,7 @@ mktemplate(state, statenum, comstate)
/* mv2front - move proto queue element to front of queue */
void
-mv2front(qelm)
- int qelm;
+mv2front(int qelm)
{
if (firstprot != qelm) {
if (qelm == lastprot)
@@ -783,8 +775,7 @@ mv2front(qelm)
*/
void
-place_state(state, statenum, transnum)
- int *state, statenum, transnum;
+place_state(int *state, int statenum, int transnum)
{
int i;
int *state_ptr;
@@ -828,8 +819,7 @@ place_state(state, statenum, transnum)
*/
void
-stack1(statenum, sym, nextstate, deflink)
- int statenum, sym, nextstate, deflink;
+stack1(int statenum, int sym, int nextstate, int deflink)
{
if (onesp >= ONE_STACK_SIZE - 1)
mk1tbl(statenum, sym, nextstate, deflink);
@@ -859,8 +849,7 @@ stack1(statenum, sym, nextstate, deflink
*/
int
-tbldiff(state, pr, ext)
- int state[], pr, ext[];
+tbldiff(int state[], int pr, int ext[])
{
int i, *sp = state, *ep = ext, *protp;
int numdiff = 0;
Index: yylex.c
===================================================================
RCS file: /cvs/src/usr.bin/lex/yylex.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 yylex.c
--- yylex.c 19 Nov 2015 19:43:40 -0000 1.6
+++ yylex.c 25 Aug 2019 08:44:04 -0000
@@ -40,7 +40,8 @@
/* yylex - scan for a regular expression token */
-int yylex ()
+int
+yylex(void)
{
int toktype;
static int beglin = false;