aboutsummaryrefslogtreecommitdiff
path: root/gas/messages.c
diff options
context:
space:
mode:
Diffstat (limited to 'gas/messages.c')
-rw-r--r--gas/messages.c78
1 files changed, 40 insertions, 38 deletions
diff --git a/gas/messages.c b/gas/messages.c
index 18d22da..005cd22 100644
--- a/gas/messages.c
+++ b/gas/messages.c
@@ -1,5 +1,5 @@
/* messages.c - error reporter -
- Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001
+ Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -48,46 +48,46 @@ static void as_warn_internal (char *, unsigned int, char *);
static void as_bad_internal (char *, unsigned int, char *);
/* Despite the rest of the comments in this file, (FIXME-SOON),
- * here is the current scheme for error messages etc:
- *
- * as_fatal() is used when gas is quite confused and
- * continuing the assembly is pointless. In this case we
- * exit immediately with error status.
- *
- * as_bad() is used to mark errors that result in what we
- * presume to be a useless object file. Say, we ignored
- * something that might have been vital. If we see any of
- * these, assembly will continue to the end of the source,
- * no object file will be produced, and we will terminate
- * with error status. The new option, -Z, tells us to
- * produce an object file anyway but we still exit with
- * error status. The assumption here is that you don't want
- * this object file but we could be wrong.
- *
- * as_warn() is used when we have an error from which we
- * have a plausible error recovery. eg, masking the top
- * bits of a constant that is longer than will fit in the
- * destination. In this case we will continue to assemble
- * the source, although we may have made a bad assumption,
- * and we will produce an object file and return normal exit
- * status (ie, no error). The new option -X tells us to
- * treat all as_warn() errors as as_bad() errors. That is,
- * no object file will be produced and we will exit with
- * error status. The idea here is that we don't kill an
- * entire make because of an error that we knew how to
- * correct. On the other hand, sometimes you might want to
- * stop the make at these points.
- *
- * as_tsktsk() is used when we see a minor error for which
- * our error recovery action is almost certainly correct.
- * In this case, we print a message and then assembly
- * continues as though no error occurred.
- */
+ here is the current scheme for error messages etc:
+
+ as_fatal() is used when gas is quite confused and
+ continuing the assembly is pointless. In this case we
+ exit immediately with error status.
+
+ as_bad() is used to mark errors that result in what we
+ presume to be a useless object file. Say, we ignored
+ something that might have been vital. If we see any of
+ these, assembly will continue to the end of the source,
+ no object file will be produced, and we will terminate
+ with error status. The new option, -Z, tells us to
+ produce an object file anyway but we still exit with
+ error status. The assumption here is that you don't want
+ this object file but we could be wrong.
+
+ as_warn() is used when we have an error from which we
+ have a plausible error recovery. eg, masking the top
+ bits of a constant that is longer than will fit in the
+ destination. In this case we will continue to assemble
+ the source, although we may have made a bad assumption,
+ and we will produce an object file and return normal exit
+ status (ie, no error). The new option -X tells us to
+ treat all as_warn() errors as as_bad() errors. That is,
+ no object file will be produced and we will exit with
+ error status. The idea here is that we don't kill an
+ entire make because of an error that we knew how to
+ correct. On the other hand, sometimes you might want to
+ stop the make at these points.
+
+ as_tsktsk() is used when we see a minor error for which
+ our error recovery action is almost certainly correct.
+ In this case, we print a message and then assembly
+ continues as though no error occurred. */
static void
identify (char *file)
{
static int identified;
+
if (identified)
return;
identified++;
@@ -109,7 +109,7 @@ static int warning_count;
int
had_warnings (void)
{
- return (warning_count);
+ return warning_count;
}
/* Nonzero if we've hit a 'bad error', and should not write an obj file,
@@ -120,7 +120,7 @@ static int error_count;
int
had_errors (void)
{
- return (error_count);
+ return error_count;
}
/* Print the current location to stderr. */
@@ -144,9 +144,11 @@ as_perror (const char *gripe, /* Unpunctuated error theme. */
const char *filename)
{
const char *errtxt;
+ int saved_errno = errno;
as_show_where ();
fprintf (stderr, gripe, filename);
+ errno = saved_errno;
#ifdef BFD_ASSEMBLER
errtxt = bfd_errmsg (bfd_get_error ());
#else