1 /* Basic error reporting routines.
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* warning, error, and fatal. These definitions are suitable for use
22 in the generator programs; eventually we would like to use them in
23 cc1 too, but that's a longer term project. */
29 /* Set this to argv[0] at the beginning of main. */
33 /* Starts out 0, set to 1 if error is called. */
37 /* Print a warning message - output produced, but there may be problems. */
40 warning
VPARAMS ((const char *format
, ...))
42 #ifndef ANSI_PROTOTYPES
47 VA_START (ap
, format
);
49 #ifndef ANSI_PROTOTYPES
50 format
= va_arg (ap
, const char *);
53 fprintf (stderr
, "%s: warning: ", progname
);
54 vfprintf (stderr
, format
, ap
);
60 /* Print an error message - we keep going but the output is unusable. */
63 error
VPARAMS ((const char *format
, ...))
65 #ifndef ANSI_PROTOTYPES
70 VA_START (ap
, format
);
72 #ifndef ANSI_PROTOTYPES
73 format
= va_arg (ap
, const char *);
76 fprintf (stderr
, "%s: ", progname
);
77 vfprintf (stderr
, format
, ap
);
85 /* Fatal error - terminate execution immediately. Does not return. */
88 fatal
VPARAMS ((const char *format
, ...))
90 #ifndef ANSI_PROTOTYPES
95 VA_START (ap
, format
);
97 #ifndef ANSI_PROTOTYPES
98 format
= va_arg (ap
, const char *);
101 fprintf (stderr
, "%s: ", progname
);
102 vfprintf (stderr
, format
, ap
);
105 exit (FATAL_EXIT_CODE
);