]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/errors.c
Kill stray blank lines
[thirdparty/gcc.git] / gcc / errors.c
CommitLineData
f8b6598e 1/* Basic error reporting routines.
711d877c 2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
f8b6598e
ZW
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18the Free Software Foundation, 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
20
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. */
24
25#include "config.h"
26#include "system.h"
27#include "errors.h"
28
29/* Set this to argv[0] at the beginning of main. */
30
31const char *progname;
32
33/* Starts out 0, set to 1 if error is called. */
34
35int have_error = 0;
36
37/* Print a warning message - output produced, but there may be problems. */
38
39void
711d877c 40warning VPARAMS ((const char *format, ...))
f8b6598e
ZW
41{
42#ifndef ANSI_PROTOTYPES
43 const char *format;
44#endif
45 va_list ap;
46
47 VA_START (ap, format);
48
49#ifndef ANSI_PROTOTYPES
50 format = va_arg (ap, const char *);
51#endif
52
53 fprintf (stderr, "%s: warning: ", progname);
54 vfprintf (stderr, format, ap);
55 va_end (ap);
56 fputc('\n', stderr);
57}
58
59
60/* Print an error message - we keep going but the output is unusable. */
61
62void
711d877c 63error VPARAMS ((const char *format, ...))
f8b6598e
ZW
64{
65#ifndef ANSI_PROTOTYPES
66 const char *format;
67#endif
68 va_list ap;
69
70 VA_START (ap, format);
71
72#ifndef ANSI_PROTOTYPES
73 format = va_arg (ap, const char *);
74#endif
75
76 fprintf (stderr, "%s: ", progname);
77 vfprintf (stderr, format, ap);
78 va_end (ap);
79 fputc('\n', stderr);
80
81 have_error = 1;
82}
83
84
85/* Fatal error - terminate execution immediately. Does not return. */
86
87void
711d877c 88fatal VPARAMS ((const char *format, ...))
f8b6598e
ZW
89{
90#ifndef ANSI_PROTOTYPES
91 const char *format;
92#endif
93 va_list ap;
94
95 VA_START (ap, format);
96
97#ifndef ANSI_PROTOTYPES
98 format = va_arg (ap, const char *);
99#endif
100
101 fprintf (stderr, "%s: ", progname);
102 vfprintf (stderr, format, ap);
103 va_end (ap);
104 fputc('\n', stderr);
105 exit (FATAL_EXIT_CODE);
106}
fbfc1192
ZW
107
108/* "Fancy" abort. Reports where in the compiler someone gave up.
109 This file is used only by build programs, so we're not as polite as
110 the version in diagnostic.c. */
111void
112fancy_abort (file, line, func)
113 const char *file;
114 int line;
115 const char *func;
116{
117 fatal ("ICE in %s, at %s:%d", func, file, line);
118}