]>
git.saurik.com Git - bison.git/blob - src/complain.c
1 /* Declaration for error-reporting function for Bison.
2 Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 /* Based on error.c and error.h,
20 written by David MacKenzie <djm@gnu.ai.mit.edu>. */
29 /* The calling program should define program_name and set it to the
30 name of the executing program. */
31 extern char *program_name
;
33 /* This variable is set each time `warn' is called. */
36 /* This variable is set each time `complain' is called. */
37 bool complaint_issued
;
40 /*--------------------------------.
41 | Report a warning, and proceed. |
42 `--------------------------------*/
45 warn_at (location loc
, const char *message
, ...)
49 location_print (stderr
, loc
);
51 fputs (_("warning: "), stderr
);
53 va_start (args
, message
);
54 vfprintf (stderr
, message
, args
);
57 warning_issued
= true;
62 warn (const char *message
, ...)
66 fprintf (stderr
, "%s: %s", current_file
? current_file
: program_name
, _("warning: "));
68 va_start (args
, message
);
69 vfprintf (stderr
, message
, args
);
72 warning_issued
= true;
76 /*-----------------------------------------------------------.
77 | An error has occurred, but we can proceed, and die later. |
78 `-----------------------------------------------------------*/
81 complain_at (location loc
, const char *message
, ...)
85 location_print (stderr
, loc
);
88 va_start (args
, message
);
89 vfprintf (stderr
, message
, args
);
92 complaint_issued
= true;
97 complain (const char *message
, ...)
101 fprintf (stderr
, "%s: ", current_file
? current_file
: program_name
);
103 va_start (args
, message
);
104 vfprintf (stderr
, message
, args
);
107 complaint_issued
= true;
111 /*-------------------------------------------------.
112 | A severe error has occurred, we cannot proceed. |
113 `-------------------------------------------------*/
116 fatal_at (location loc
, const char *message
, ...)
120 location_print (stderr
, loc
);
121 fputs (": ", stderr
);
122 fputs (_("fatal error: "), stderr
);
124 va_start (args
, message
);
125 vfprintf (stderr
, message
, args
);
132 fatal (const char *message
, ...)
136 fprintf (stderr
, "%s: ", current_file
? current_file
: program_name
);
138 fputs (_("fatal error: "), stderr
);
140 va_start (args
, message
);
141 vfprintf (stderr
, message
, args
);