1 /* messages.c - error reporter -
2 Copyright (C) 1987 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS 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 1, or (at your option)
11 GAS 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 GAS; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
24 #include <mach/mach.h>
25 #include <mach/mach_init.h>
26 #if defined(__OPENSTEP__) || defined(__GONZO_BUNSEN_BEAKER__)
27 #include <servers/netname.h>
29 #ifndef __has_extension
30 # define __has_extension(x) 0
33 #define __has_feature(x) 0
35 #include <servers/bootstrap.h>
38 #include "input-scrub.h"
44 We print the error message 1st, beginning in column 1.
45 All ancillary info starts in column 2 on lines after the
47 We try to print a location in logical and physical file
48 just after the main error text.
49 Caller then prints any appendices after that, begining all
50 lines with at least 1 space.
52 Optionally, we may die.
53 There is no need for a trailing '\n' in your error text format
54 because we supply one.
56 as_warn(fmt,args) Like fprintf(stderr,fmt,args) but also call errwhere().
58 as_fatal(fmt,args) Like as_warn() but exit with a fatal status.
64 * Nonzero if we've hit a 'bad error', and should not write an obj file,
65 * and exit with a nonzero error code.
70 * If set to non-zero in main() -arch_multiple as been specified so if any
71 * error messages are printed print a single line first to start which errors
72 * the architectures are for.
74 int arch_multiple
= 0;
77 * architecture_banner() returns the string to say what target we are assembling
82 architecture_banner(void)
85 return("as: for architecture m68k\n");
88 return("as: for architecture m88k\n");
91 return("as: for architecture ppc\n");
94 return("as: for architecture i860\n");
97 return("as: for architecture i386\n");
100 return("as: for architecture hppa\n");
103 return("as: for architecture sparc\n");
106 return("as: for architecture arm\n");
111 * print_architecture_banner() prints what architecture we are assembling for
112 * if it has not previously been printed.
116 print_architecture_banner(void)
118 static int printed
= 0;
120 if(arch_multiple
&& !printed
){
121 printf("%s", architecture_banner());
129 * Send to stderr a string as a warning, and locate warning in input file(s).
130 * Please only use this for when we have some recovery action.
131 * Please explain in string (which may have '\n's) what recovery was done.
141 print_architecture_banner();
143 va_start(ap
, format
);
144 vfprintf(stderr
, format
, ap
);
145 fprintf(stderr
, "\n");
150 /* Like as_bad but the file name and line number are passed in. */
152 as_warn_where (char *file
, unsigned int line
, const char *format
, ...)
158 print_architecture_banner();
159 fprintf(stderr
,"%s:%u:", file
, line
);
160 va_start (args
, format
);
161 vfprintf(stderr
, format
, args
);
167 * Like as_warn_where but the file name and optional line number and column
171 as_warn_where_with_column (char *file
, unsigned int line
, unsigned int column
, const char *format
, ...)
177 print_architecture_banner();
178 fprintf(stderr
, "%s:", file
);
181 fprintf(stderr
, "%u:", line
);
183 fprintf(stderr
, "%u:", column
);
185 va_start (args
, format
);
186 vfprintf(stderr
, format
, args
);
187 fprintf(stderr
, "\n");
195 * Send to stderr a string as a warning, * and locate warning in input file(s).
196 * Please us when there is no recovery, but we want to continue processing
197 * but not produce an object file.
198 * Please explain in string (which may have '\n's) what recovery was done.
207 print_architecture_banner();
210 va_start(ap
, format
);
211 vfprintf(stderr
, format
, ap
);
212 fprintf(stderr
, "\n");
217 * a s _ f a t a l ( )
219 * Send to stderr a string (with bell) (JF: Bell is obnoxious!) as a fatal
220 * message, and locate stdsource in input file(s).
221 * Please only use this for when we DON'T have some recovery action.
222 * It exit()s with a warning status.
231 print_architecture_banner();
234 va_start(ap
, format
);
235 fprintf (stderr
, "FATAL:");
236 vfprintf(stderr
, format
, ap
);
237 fprintf(stderr
, "\n");
243 sprint_value (char *buf
, signed_expr_t val
)
245 sprintf (buf
, "%qd", val
);