]>
git.saurik.com Git - bison.git/blob - src/complain.c
1 /* Declaration for error-reporting function for Bison.
3 Copyright (C) 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 /* Based on error.c and error.h,
21 written by David MacKenzie <djm@gnu.ai.mit.edu>. */
31 /* The calling program should define program_name and set it to the
32 name of the executing program. */
33 extern char *program_name
;
35 /* This variable is set each time `warn' is called. */
38 /* This variable is set each time `complain' is called. */
39 bool complaint_issued
;
42 /*--------------------------------.
43 | Report a warning, and proceed. |
44 `--------------------------------*/
47 warn_at (location loc
, const char *message
, ...)
51 location_print (stderr
, loc
);
53 fputs (_("warning: "), stderr
);
55 va_start (args
, message
);
56 vfprintf (stderr
, message
, args
);
59 warning_issued
= true;
64 warn (const char *message
, ...)
68 fprintf (stderr
, "%s: %s", current_file
? current_file
: program_name
, _("warning: "));
70 va_start (args
, message
);
71 vfprintf (stderr
, message
, args
);
74 warning_issued
= true;
78 /*-----------------------------------------------------------.
79 | An error has occurred, but we can proceed, and die later. |
80 `-----------------------------------------------------------*/
83 complain_at (location loc
, const char *message
, ...)
87 location_print (stderr
, loc
);
90 va_start (args
, message
);
91 vfprintf (stderr
, message
, args
);
94 complaint_issued
= true;
99 complain (const char *message
, ...)
103 fprintf (stderr
, "%s: ", current_file
? current_file
: program_name
);
105 va_start (args
, message
);
106 vfprintf (stderr
, message
, args
);
109 complaint_issued
= true;
113 /*-------------------------------------------------.
114 | A severe error has occurred, we cannot proceed. |
115 `-------------------------------------------------*/
118 fatal_at (location loc
, const char *message
, ...)
122 location_print (stderr
, loc
);
123 fputs (": ", stderr
);
124 fputs (_("fatal error: "), stderr
);
126 va_start (args
, message
);
127 vfprintf (stderr
, message
, args
);
134 fatal (const char *message
, ...)
138 fprintf (stderr
, "%s: ", current_file
? current_file
: program_name
);
140 fputs (_("fatal error: "), stderr
);
142 va_start (args
, message
);
143 vfprintf (stderr
, message
, args
);