xref: /freebsd/contrib/byacc/error.c (revision 822ca3276345b4a67ccbc9b54616d8b205fd37f2)
1*822ca327SBaptiste Daroussin /* $Id: error.c,v 1.17 2023/05/18 21:38:35 tom Exp $ */
298e903e7SBaptiste Daroussin 
398e903e7SBaptiste Daroussin /* routines for printing error messages  */
498e903e7SBaptiste Daroussin 
598e903e7SBaptiste Daroussin #include "defs.h"
698e903e7SBaptiste Daroussin 
798e903e7SBaptiste Daroussin void
fatal(const char * msg)898e903e7SBaptiste Daroussin fatal(const char *msg)
998e903e7SBaptiste Daroussin {
1098e903e7SBaptiste Daroussin     fprintf(stderr, "%s: f - %s\n", myname, msg);
1198e903e7SBaptiste Daroussin     done(2);
1298e903e7SBaptiste Daroussin }
1398e903e7SBaptiste Daroussin 
1498e903e7SBaptiste Daroussin void
on_error(void)15*822ca327SBaptiste Daroussin on_error(void)
1698e903e7SBaptiste Daroussin {
17*822ca327SBaptiste Daroussin     const char *msg;
18*822ca327SBaptiste Daroussin     if (errno && (msg = strerror(errno)) != NULL)
19*822ca327SBaptiste Daroussin 	fatal(msg);
20*822ca327SBaptiste Daroussin     else
21*822ca327SBaptiste Daroussin 	fatal("unknown error");
2298e903e7SBaptiste Daroussin }
2398e903e7SBaptiste Daroussin 
2498e903e7SBaptiste Daroussin void
open_error(const char * filename)2598e903e7SBaptiste Daroussin open_error(const char *filename)
2698e903e7SBaptiste Daroussin {
2798e903e7SBaptiste Daroussin     fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename);
2898e903e7SBaptiste Daroussin     done(2);
2998e903e7SBaptiste Daroussin }
3098e903e7SBaptiste Daroussin 
3198e903e7SBaptiste Daroussin void
missing_brace(void)3298e903e7SBaptiste Daroussin missing_brace(void)
3398e903e7SBaptiste Daroussin {
3498e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", missing '}'\n",
3598e903e7SBaptiste Daroussin 	    myname, lineno, input_file_name);
3698e903e7SBaptiste Daroussin     done(1);
3798e903e7SBaptiste Daroussin }
3898e903e7SBaptiste Daroussin 
3998e903e7SBaptiste Daroussin void
unexpected_EOF(void)4098e903e7SBaptiste Daroussin unexpected_EOF(void)
4198e903e7SBaptiste Daroussin {
4298e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n",
4398e903e7SBaptiste Daroussin 	    myname, lineno, input_file_name);
4498e903e7SBaptiste Daroussin     done(1);
4598e903e7SBaptiste Daroussin }
4698e903e7SBaptiste Daroussin 
4798e903e7SBaptiste Daroussin static void
print_pos(const char * st_line,const char * st_cptr)480c8de5b0SBaptiste Daroussin print_pos(const char *st_line, const char *st_cptr)
4998e903e7SBaptiste Daroussin {
500c8de5b0SBaptiste Daroussin     const char *s;
5198e903e7SBaptiste Daroussin 
5298e903e7SBaptiste Daroussin     if (st_line == 0)
5398e903e7SBaptiste Daroussin 	return;
5498e903e7SBaptiste Daroussin     for (s = st_line; *s != '\n'; ++s)
5598e903e7SBaptiste Daroussin     {
5698e903e7SBaptiste Daroussin 	if (isprint(UCH(*s)) || *s == '\t')
5798e903e7SBaptiste Daroussin 	    putc(*s, stderr);
5898e903e7SBaptiste Daroussin 	else
5998e903e7SBaptiste Daroussin 	    putc('?', stderr);
6098e903e7SBaptiste Daroussin     }
6198e903e7SBaptiste Daroussin     putc('\n', stderr);
6298e903e7SBaptiste Daroussin     for (s = st_line; s < st_cptr; ++s)
6398e903e7SBaptiste Daroussin     {
6498e903e7SBaptiste Daroussin 	if (*s == '\t')
6598e903e7SBaptiste Daroussin 	    putc('\t', stderr);
6698e903e7SBaptiste Daroussin 	else
6798e903e7SBaptiste Daroussin 	    putc(' ', stderr);
6898e903e7SBaptiste Daroussin     }
6998e903e7SBaptiste Daroussin     putc('^', stderr);
7098e903e7SBaptiste Daroussin     putc('\n', stderr);
7198e903e7SBaptiste Daroussin }
7298e903e7SBaptiste Daroussin 
7398e903e7SBaptiste Daroussin void
syntax_error(int st_lineno,const char * st_line,const char * st_cptr)74*822ca327SBaptiste Daroussin syntax_error(int st_lineno, const char *st_line, const char *st_cptr)
7598e903e7SBaptiste Daroussin {
7698e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", syntax error\n",
7798e903e7SBaptiste Daroussin 	    myname, st_lineno, input_file_name);
7898e903e7SBaptiste Daroussin     print_pos(st_line, st_cptr);
7998e903e7SBaptiste Daroussin     done(1);
8098e903e7SBaptiste Daroussin }
8198e903e7SBaptiste Daroussin 
8298e903e7SBaptiste Daroussin void
unexpected_value(const struct ainfo * a)83*822ca327SBaptiste Daroussin unexpected_value(const struct ainfo *a)
84*822ca327SBaptiste Daroussin {
85*822ca327SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", unexpected value\n",
86*822ca327SBaptiste Daroussin 	    myname, a->a_lineno, input_file_name);
87*822ca327SBaptiste Daroussin     print_pos(a->a_line, a->a_cptr);
88*822ca327SBaptiste Daroussin     done(1);
89*822ca327SBaptiste Daroussin }
90*822ca327SBaptiste Daroussin 
91*822ca327SBaptiste Daroussin void
unterminated_comment(const struct ainfo * a)922aca18c7SJung-uk Kim unterminated_comment(const struct ainfo *a)
9398e903e7SBaptiste Daroussin {
9498e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n",
952aca18c7SJung-uk Kim 	    myname, a->a_lineno, input_file_name);
962aca18c7SJung-uk Kim     print_pos(a->a_line, a->a_cptr);
9798e903e7SBaptiste Daroussin     done(1);
9898e903e7SBaptiste Daroussin }
9998e903e7SBaptiste Daroussin 
10098e903e7SBaptiste Daroussin void
unterminated_string(const struct ainfo * a)1012aca18c7SJung-uk Kim unterminated_string(const struct ainfo *a)
10298e903e7SBaptiste Daroussin {
10398e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n",
1042aca18c7SJung-uk Kim 	    myname, a->a_lineno, input_file_name);
1052aca18c7SJung-uk Kim     print_pos(a->a_line, a->a_cptr);
10698e903e7SBaptiste Daroussin     done(1);
10798e903e7SBaptiste Daroussin }
10898e903e7SBaptiste Daroussin 
10998e903e7SBaptiste Daroussin void
unterminated_text(const struct ainfo * a)1102aca18c7SJung-uk Kim unterminated_text(const struct ainfo *a)
11198e903e7SBaptiste Daroussin {
11298e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n",
1132aca18c7SJung-uk Kim 	    myname, a->a_lineno, input_file_name);
1142aca18c7SJung-uk Kim     print_pos(a->a_line, a->a_cptr);
11598e903e7SBaptiste Daroussin     done(1);
11698e903e7SBaptiste Daroussin }
11798e903e7SBaptiste Daroussin 
11898e903e7SBaptiste Daroussin void
unterminated_union(const struct ainfo * a)1192aca18c7SJung-uk Kim unterminated_union(const struct ainfo *a)
12098e903e7SBaptiste Daroussin {
12198e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", unterminated %%union \
1222aca18c7SJung-uk Kim declaration\n", myname, a->a_lineno, input_file_name);
1232aca18c7SJung-uk Kim     print_pos(a->a_line, a->a_cptr);
12498e903e7SBaptiste Daroussin     done(1);
12598e903e7SBaptiste Daroussin }
12698e903e7SBaptiste Daroussin 
12798e903e7SBaptiste Daroussin void
over_unionized(const char * u_cptr)128*822ca327SBaptiste Daroussin over_unionized(const char *u_cptr)
12998e903e7SBaptiste Daroussin {
13098e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", too many %%union \
13198e903e7SBaptiste Daroussin declarations\n", myname, lineno, input_file_name);
13298e903e7SBaptiste Daroussin     print_pos(line, u_cptr);
13398e903e7SBaptiste Daroussin     done(1);
13498e903e7SBaptiste Daroussin }
13598e903e7SBaptiste Daroussin 
13698e903e7SBaptiste Daroussin void
illegal_tag(int t_lineno,const char * t_line,const char * t_cptr)137*822ca327SBaptiste Daroussin illegal_tag(int t_lineno, const char *t_line, const char *t_cptr)
13898e903e7SBaptiste Daroussin {
13998e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", illegal tag\n",
14098e903e7SBaptiste Daroussin 	    myname, t_lineno, input_file_name);
14198e903e7SBaptiste Daroussin     print_pos(t_line, t_cptr);
14298e903e7SBaptiste Daroussin     done(1);
14398e903e7SBaptiste Daroussin }
14498e903e7SBaptiste Daroussin 
14598e903e7SBaptiste Daroussin void
illegal_character(const char * c_cptr)146*822ca327SBaptiste Daroussin illegal_character(const char *c_cptr)
14798e903e7SBaptiste Daroussin {
14898e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", illegal character\n",
14998e903e7SBaptiste Daroussin 	    myname, lineno, input_file_name);
15098e903e7SBaptiste Daroussin     print_pos(line, c_cptr);
15198e903e7SBaptiste Daroussin     done(1);
15298e903e7SBaptiste Daroussin }
15398e903e7SBaptiste Daroussin 
15498e903e7SBaptiste Daroussin void
used_reserved(const char * s)155*822ca327SBaptiste Daroussin used_reserved(const char *s)
15698e903e7SBaptiste Daroussin {
15798e903e7SBaptiste Daroussin     fprintf(stderr,
15898e903e7SBaptiste Daroussin 	    "%s: e - line %d of \"%s\", illegal use of reserved symbol \
15998e903e7SBaptiste Daroussin %s\n", myname, lineno, input_file_name, s);
16098e903e7SBaptiste Daroussin     done(1);
16198e903e7SBaptiste Daroussin }
16298e903e7SBaptiste Daroussin 
16398e903e7SBaptiste Daroussin void
tokenized_start(const char * s)164*822ca327SBaptiste Daroussin tokenized_start(const char *s)
16598e903e7SBaptiste Daroussin {
16698e903e7SBaptiste Daroussin     fprintf(stderr,
16798e903e7SBaptiste Daroussin 	    "%s: e - line %d of \"%s\", the start symbol %s cannot be \
16898e903e7SBaptiste Daroussin declared to be a token\n", myname, lineno, input_file_name, s);
16998e903e7SBaptiste Daroussin     done(1);
17098e903e7SBaptiste Daroussin }
17198e903e7SBaptiste Daroussin 
17298e903e7SBaptiste Daroussin void
retyped_warning(const char * s)173*822ca327SBaptiste Daroussin retyped_warning(const char *s)
17498e903e7SBaptiste Daroussin {
17598e903e7SBaptiste Daroussin     fprintf(stderr, "%s: w - line %d of \"%s\", the type of %s has been \
17698e903e7SBaptiste Daroussin redeclared\n", myname, lineno, input_file_name, s);
17798e903e7SBaptiste Daroussin }
17898e903e7SBaptiste Daroussin 
17998e903e7SBaptiste Daroussin void
reprec_warning(const char * s)180*822ca327SBaptiste Daroussin reprec_warning(const char *s)
18198e903e7SBaptiste Daroussin {
18298e903e7SBaptiste Daroussin     fprintf(stderr,
18398e903e7SBaptiste Daroussin 	    "%s: w - line %d of \"%s\", the precedence of %s has been \
18498e903e7SBaptiste Daroussin redeclared\n", myname, lineno, input_file_name, s);
18598e903e7SBaptiste Daroussin }
18698e903e7SBaptiste Daroussin 
18798e903e7SBaptiste Daroussin void
revalued_warning(const char * s)188*822ca327SBaptiste Daroussin revalued_warning(const char *s)
18998e903e7SBaptiste Daroussin {
19098e903e7SBaptiste Daroussin     fprintf(stderr, "%s: w - line %d of \"%s\", the value of %s has been \
19198e903e7SBaptiste Daroussin redeclared\n", myname, lineno, input_file_name, s);
19298e903e7SBaptiste Daroussin }
19398e903e7SBaptiste Daroussin 
19498e903e7SBaptiste Daroussin void
terminal_start(const char * s)195*822ca327SBaptiste Daroussin terminal_start(const char *s)
19698e903e7SBaptiste Daroussin {
19798e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s is a \
19898e903e7SBaptiste Daroussin token\n", myname, lineno, input_file_name, s);
19998e903e7SBaptiste Daroussin     done(1);
20098e903e7SBaptiste Daroussin }
20198e903e7SBaptiste Daroussin 
20298e903e7SBaptiste Daroussin void
restarted_warning(void)20398e903e7SBaptiste Daroussin restarted_warning(void)
20498e903e7SBaptiste Daroussin {
20598e903e7SBaptiste Daroussin     fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \
20698e903e7SBaptiste Daroussin redeclared\n", myname, lineno, input_file_name);
20798e903e7SBaptiste Daroussin }
20898e903e7SBaptiste Daroussin 
20998e903e7SBaptiste Daroussin void
no_grammar(void)21098e903e7SBaptiste Daroussin no_grammar(void)
21198e903e7SBaptiste Daroussin {
21298e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \
21398e903e7SBaptiste Daroussin specified\n", myname, lineno, input_file_name);
21498e903e7SBaptiste Daroussin     done(1);
21598e903e7SBaptiste Daroussin }
21698e903e7SBaptiste Daroussin 
21798e903e7SBaptiste Daroussin void
terminal_lhs(int s_lineno)21898e903e7SBaptiste Daroussin terminal_lhs(int s_lineno)
21998e903e7SBaptiste Daroussin {
22098e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", a token appears on the lhs \
22198e903e7SBaptiste Daroussin of a production\n", myname, s_lineno, input_file_name);
22298e903e7SBaptiste Daroussin     done(1);
22398e903e7SBaptiste Daroussin }
22498e903e7SBaptiste Daroussin 
22598e903e7SBaptiste Daroussin void
prec_redeclared(void)22698e903e7SBaptiste Daroussin prec_redeclared(void)
22798e903e7SBaptiste Daroussin {
22898e903e7SBaptiste Daroussin     fprintf(stderr, "%s: w - line %d of  \"%s\", conflicting %%prec \
22998e903e7SBaptiste Daroussin specifiers\n", myname, lineno, input_file_name);
23098e903e7SBaptiste Daroussin }
23198e903e7SBaptiste Daroussin 
23298e903e7SBaptiste Daroussin void
unterminated_action(const struct ainfo * a)2332aca18c7SJung-uk Kim unterminated_action(const struct ainfo *a)
23498e903e7SBaptiste Daroussin {
23598e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n",
2362aca18c7SJung-uk Kim 	    myname, a->a_lineno, input_file_name);
2372aca18c7SJung-uk Kim     print_pos(a->a_line, a->a_cptr);
23898e903e7SBaptiste Daroussin     done(1);
23998e903e7SBaptiste Daroussin }
24098e903e7SBaptiste Daroussin 
24198e903e7SBaptiste Daroussin void
dollar_warning(int a_lineno,int i)24298e903e7SBaptiste Daroussin dollar_warning(int a_lineno, int i)
24398e903e7SBaptiste Daroussin {
24498e903e7SBaptiste Daroussin     fprintf(stderr, "%s: w - line %d of \"%s\", $%d references beyond the \
24598e903e7SBaptiste Daroussin end of the current rule\n", myname, a_lineno, input_file_name, i);
24698e903e7SBaptiste Daroussin }
24798e903e7SBaptiste Daroussin 
24898e903e7SBaptiste Daroussin void
dollar_error(int a_lineno,const char * a_line,const char * a_cptr)249*822ca327SBaptiste Daroussin dollar_error(int a_lineno, const char *a_line, const char *a_cptr)
25098e903e7SBaptiste Daroussin {
25198e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", illegal $-name\n",
25298e903e7SBaptiste Daroussin 	    myname, a_lineno, input_file_name);
25398e903e7SBaptiste Daroussin     print_pos(a_line, a_cptr);
25498e903e7SBaptiste Daroussin     done(1);
25598e903e7SBaptiste Daroussin }
25698e903e7SBaptiste Daroussin 
25798e903e7SBaptiste Daroussin void
dislocations_warning(void)258*822ca327SBaptiste Daroussin dislocations_warning(void)
259*822ca327SBaptiste Daroussin {
260*822ca327SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", expected %%locations\n",
261*822ca327SBaptiste Daroussin 	    myname, lineno, input_file_name);
262*822ca327SBaptiste Daroussin }
263*822ca327SBaptiste Daroussin 
264*822ca327SBaptiste Daroussin void
untyped_lhs(void)26598e903e7SBaptiste Daroussin untyped_lhs(void)
26698e903e7SBaptiste Daroussin {
26798e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", $$ is untyped\n",
26898e903e7SBaptiste Daroussin 	    myname, lineno, input_file_name);
26998e903e7SBaptiste Daroussin     done(1);
27098e903e7SBaptiste Daroussin }
27198e903e7SBaptiste Daroussin 
27298e903e7SBaptiste Daroussin void
untyped_rhs(int i,const char * s)273*822ca327SBaptiste Daroussin untyped_rhs(int i, const char *s)
27498e903e7SBaptiste Daroussin {
27598e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", $%d (%s) is untyped\n",
27698e903e7SBaptiste Daroussin 	    myname, lineno, input_file_name, i, s);
27798e903e7SBaptiste Daroussin     done(1);
27898e903e7SBaptiste Daroussin }
27998e903e7SBaptiste Daroussin 
28098e903e7SBaptiste Daroussin void
unknown_rhs(int i)28198e903e7SBaptiste Daroussin unknown_rhs(int i)
28298e903e7SBaptiste Daroussin {
28398e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n",
28498e903e7SBaptiste Daroussin 	    myname, lineno, input_file_name, i);
28598e903e7SBaptiste Daroussin     done(1);
28698e903e7SBaptiste Daroussin }
28798e903e7SBaptiste Daroussin 
28898e903e7SBaptiste Daroussin void
default_action_warning(const char * s)289*822ca327SBaptiste Daroussin default_action_warning(const char *s)
29098e903e7SBaptiste Daroussin {
29198e903e7SBaptiste Daroussin     fprintf(stderr,
292c5b5d71aSJung-uk Kim 	    "%s: w - line %d of \"%s\", the default action for %s assigns an \
293c5b5d71aSJung-uk Kim undefined value to $$\n",
294c5b5d71aSJung-uk Kim 	    myname, lineno, input_file_name, s);
29598e903e7SBaptiste Daroussin }
29698e903e7SBaptiste Daroussin 
29798e903e7SBaptiste Daroussin void
undefined_goal(const char * s)298*822ca327SBaptiste Daroussin undefined_goal(const char *s)
29998e903e7SBaptiste Daroussin {
30098e903e7SBaptiste Daroussin     fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s);
30198e903e7SBaptiste Daroussin     done(1);
30298e903e7SBaptiste Daroussin }
30398e903e7SBaptiste Daroussin 
30498e903e7SBaptiste Daroussin void
undefined_symbol_warning(const char * s)305*822ca327SBaptiste Daroussin undefined_symbol_warning(const char *s)
30698e903e7SBaptiste Daroussin {
30798e903e7SBaptiste Daroussin     fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s);
30898e903e7SBaptiste Daroussin }
3090c8de5b0SBaptiste Daroussin 
3100c8de5b0SBaptiste Daroussin #if ! defined(YYBTYACC)
3110c8de5b0SBaptiste Daroussin void
unsupported_flag_warning(const char * flag,const char * details)3120c8de5b0SBaptiste Daroussin unsupported_flag_warning(const char *flag, const char *details)
3130c8de5b0SBaptiste Daroussin {
3140c8de5b0SBaptiste Daroussin     fprintf(stderr, "%s: w - %s flag unsupported, %s\n",
3150c8de5b0SBaptiste Daroussin 	    myname, flag, details);
3160c8de5b0SBaptiste Daroussin }
3170c8de5b0SBaptiste Daroussin #endif
3180c8de5b0SBaptiste Daroussin 
3190c8de5b0SBaptiste Daroussin #if defined(YYBTYACC)
3200c8de5b0SBaptiste Daroussin void
at_warning(int a_lineno,int i)3210c8de5b0SBaptiste Daroussin at_warning(int a_lineno, int i)
3220c8de5b0SBaptiste Daroussin {
3230c8de5b0SBaptiste Daroussin     fprintf(stderr, "%s: w - line %d of \"%s\", @%d references beyond the \
3240c8de5b0SBaptiste Daroussin end of the current rule\n", myname, a_lineno, input_file_name, i);
3250c8de5b0SBaptiste Daroussin }
3260c8de5b0SBaptiste Daroussin 
3270c8de5b0SBaptiste Daroussin void
at_error(int a_lineno,const char * a_line,const char * a_cptr)328*822ca327SBaptiste Daroussin at_error(int a_lineno, const char *a_line, const char *a_cptr)
3290c8de5b0SBaptiste Daroussin {
3300c8de5b0SBaptiste Daroussin     fprintf(stderr,
3310c8de5b0SBaptiste Daroussin 	    "%s: e - line %d of \"%s\", illegal @$ or @N reference\n",
3320c8de5b0SBaptiste Daroussin 	    myname, a_lineno, input_file_name);
3330c8de5b0SBaptiste Daroussin     print_pos(a_line, a_cptr);
3340c8de5b0SBaptiste Daroussin     done(1);
3350c8de5b0SBaptiste Daroussin }
3360c8de5b0SBaptiste Daroussin 
3370c8de5b0SBaptiste Daroussin void
unterminated_arglist(const struct ainfo * a)3382aca18c7SJung-uk Kim unterminated_arglist(const struct ainfo *a)
3390c8de5b0SBaptiste Daroussin {
3400c8de5b0SBaptiste Daroussin     fprintf(stderr,
3410c8de5b0SBaptiste Daroussin 	    "%s: e - line %d of \"%s\", unterminated argument list\n",
3422aca18c7SJung-uk Kim 	    myname, a->a_lineno, input_file_name);
3432aca18c7SJung-uk Kim     print_pos(a->a_line, a->a_cptr);
3440c8de5b0SBaptiste Daroussin     done(1);
3450c8de5b0SBaptiste Daroussin }
3460c8de5b0SBaptiste Daroussin 
3470c8de5b0SBaptiste Daroussin void
arg_number_disagree_warning(int a_lineno,const char * a_name)348*822ca327SBaptiste Daroussin arg_number_disagree_warning(int a_lineno, const char *a_name)
3490c8de5b0SBaptiste Daroussin {
3500c8de5b0SBaptiste Daroussin     fprintf(stderr, "%s: w - line %d of \"%s\", number of arguments of %s "
3510c8de5b0SBaptiste Daroussin 	    "doesn't agree with previous declaration\n",
3520c8de5b0SBaptiste Daroussin 	    myname, a_lineno, input_file_name, a_name);
3530c8de5b0SBaptiste Daroussin }
3540c8de5b0SBaptiste Daroussin 
3550c8de5b0SBaptiste Daroussin void
bad_formals(void)3560c8de5b0SBaptiste Daroussin bad_formals(void)
3570c8de5b0SBaptiste Daroussin {
3580c8de5b0SBaptiste Daroussin     fprintf(stderr, "%s: e - line %d of \"%s\", bad formal argument list\n",
3590c8de5b0SBaptiste Daroussin 	    myname, lineno, input_file_name);
3600c8de5b0SBaptiste Daroussin     print_pos(line, cptr);
3610c8de5b0SBaptiste Daroussin     done(1);
3620c8de5b0SBaptiste Daroussin }
3630c8de5b0SBaptiste Daroussin 
3640c8de5b0SBaptiste Daroussin void
arg_type_disagree_warning(int a_lineno,int i,const char * a_name)365*822ca327SBaptiste Daroussin arg_type_disagree_warning(int a_lineno, int i, const char *a_name)
3660c8de5b0SBaptiste Daroussin {
3670c8de5b0SBaptiste Daroussin     fprintf(stderr, "%s: w - line %d of \"%s\", type of argument %d "
3680c8de5b0SBaptiste Daroussin 	    "to %s doesn't agree with previous declaration\n",
3690c8de5b0SBaptiste Daroussin 	    myname, a_lineno, input_file_name, i, a_name);
3700c8de5b0SBaptiste Daroussin }
3710c8de5b0SBaptiste Daroussin 
3720c8de5b0SBaptiste Daroussin void
unknown_arg_warning(int d_lineno,const char * dlr_opt,const char * d_arg,const char * d_line,const char * d_cptr)373*822ca327SBaptiste Daroussin unknown_arg_warning(int d_lineno, const char *dlr_opt,
374*822ca327SBaptiste Daroussin 		    const char *d_arg,
375*822ca327SBaptiste Daroussin 		    const char *d_line,
376*822ca327SBaptiste Daroussin 		    const char *d_cptr)
3770c8de5b0SBaptiste Daroussin {
3780c8de5b0SBaptiste Daroussin     fprintf(stderr, "%s: w - line %d of \"%s\", unknown argument %s%s\n",
3790c8de5b0SBaptiste Daroussin 	    myname, d_lineno, input_file_name, dlr_opt, d_arg);
3800c8de5b0SBaptiste Daroussin     print_pos(d_line, d_cptr);
3810c8de5b0SBaptiste Daroussin }
3820c8de5b0SBaptiste Daroussin 
3830c8de5b0SBaptiste Daroussin void
untyped_arg_warning(int a_lineno,const char * dlr_opt,const char * a_name)3840c8de5b0SBaptiste Daroussin untyped_arg_warning(int a_lineno, const char *dlr_opt, const char *a_name)
3850c8de5b0SBaptiste Daroussin {
3860c8de5b0SBaptiste Daroussin     fprintf(stderr, "%s: w - line %d of \"%s\", untyped argument %s%s\n",
3870c8de5b0SBaptiste Daroussin 	    myname, a_lineno, input_file_name, dlr_opt, a_name);
3880c8de5b0SBaptiste Daroussin }
3890c8de5b0SBaptiste Daroussin 
3900c8de5b0SBaptiste Daroussin void
wrong_number_args_warning(const char * which,const char * a_name)3910c8de5b0SBaptiste Daroussin wrong_number_args_warning(const char *which, const char *a_name)
3920c8de5b0SBaptiste Daroussin {
3930c8de5b0SBaptiste Daroussin     fprintf(stderr,
3940c8de5b0SBaptiste Daroussin 	    "%s: w - line %d of \"%s\", wrong number of %sarguments for %s\n",
3950c8de5b0SBaptiste Daroussin 	    myname, lineno, input_file_name, which, a_name);
3960c8de5b0SBaptiste Daroussin     print_pos(line, cptr);
3970c8de5b0SBaptiste Daroussin }
3980c8de5b0SBaptiste Daroussin 
3990c8de5b0SBaptiste Daroussin void
wrong_type_for_arg_warning(int i,const char * a_name)400*822ca327SBaptiste Daroussin wrong_type_for_arg_warning(int i, const char *a_name)
4010c8de5b0SBaptiste Daroussin {
4020c8de5b0SBaptiste Daroussin     fprintf(stderr,
4030c8de5b0SBaptiste Daroussin 	    "%s: w - line %d of \"%s\", wrong type for default argument %d to %s\n",
4040c8de5b0SBaptiste Daroussin 	    myname, lineno, input_file_name, i, a_name);
4050c8de5b0SBaptiste Daroussin     print_pos(line, cptr);
4060c8de5b0SBaptiste Daroussin }
4070c8de5b0SBaptiste Daroussin 
4080c8de5b0SBaptiste Daroussin void
start_requires_args(const char * a_name)409*822ca327SBaptiste Daroussin start_requires_args(const char *a_name)
4100c8de5b0SBaptiste Daroussin {
4110c8de5b0SBaptiste Daroussin     fprintf(stderr,
4120c8de5b0SBaptiste Daroussin 	    "%s: w - line %d of \"%s\", start symbol %s requires arguments\n",
4130c8de5b0SBaptiste Daroussin 	    myname, 0, input_file_name, a_name);
4140c8de5b0SBaptiste Daroussin 
4150c8de5b0SBaptiste Daroussin }
4160c8de5b0SBaptiste Daroussin 
4170c8de5b0SBaptiste Daroussin void
destructor_redeclared_warning(const struct ainfo * a)4182aca18c7SJung-uk Kim destructor_redeclared_warning(const struct ainfo *a)
4190c8de5b0SBaptiste Daroussin {
4200c8de5b0SBaptiste Daroussin     fprintf(stderr, "%s: w - line %d of \"%s\", destructor redeclared\n",
4212aca18c7SJung-uk Kim 	    myname, a->a_lineno, input_file_name);
4222aca18c7SJung-uk Kim     print_pos(a->a_line, a->a_cptr);
4230c8de5b0SBaptiste Daroussin }
4240c8de5b0SBaptiste Daroussin #endif
425