aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2004-11-22 13:05:27 +0000
committerHans-Peter Nilsson <hp@axis.com>2004-11-22 13:05:27 +0000
commitd190d04643fb43aac495e83f40040b62b378a042 (patch)
tree2fbb59d865331f89003c11b874862885720bbf7e /gas/read.c
parenta7eec87693b35bd94817259d6425e71352d8ba4e (diff)
downloadgdb-d190d04643fb43aac495e83f40040b62b378a042.zip
gdb-d190d04643fb43aac495e83f40040b62b378a042.tar.gz
gdb-d190d04643fb43aac495e83f40040b62b378a042.tar.bz2
* read.c (potable): Add "error" and "warning".
(s_errwarn): New function. * read.h (s_errwarn): Declare. * doc/as.texinfo (Error, Warning): Document .error and .warning.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gas/read.c b/gas/read.c
index 00fd38a..d0bf2c1f 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -306,6 +306,7 @@ static const pseudo_typeS potable[] = {
{"equ", s_set, 0},
{"equiv", s_set, 1},
{"err", s_err, 0},
+ {"error", s_errwarn, 1},
{"exitm", s_mexit, 0},
/* extend */
{"extern", s_ignore, 0}, /* We treat all undef as ext. */
@@ -411,6 +412,7 @@ static const pseudo_typeS potable[] = {
{"xdef", s_globl, 0},
{"xref", s_ignore, 0},
{"xstabs", s_xstab, 's'},
+ {"warning", s_errwarn, 0},
{"word", cons, 2},
{"zero", s_space, 0},
{NULL, NULL, 0} /* End sentinel. */
@@ -1665,6 +1667,43 @@ s_err (int ignore ATTRIBUTE_UNUSED)
demand_empty_rest_of_line ();
}
+/* Handle the .error and .warning pseudo-ops. */
+
+void
+s_errwarn (int err)
+{
+ int len;
+ /* The purpose for the conditional assignment is not to
+ internationalize the directive itself, but that we need a
+ self-contained message, one that can be passed like the
+ demand_copy_C_string return value, and with no assumption on the
+ location of the name of the directive within the message. */
+ char *msg
+ = (err ? _(".error directive invoked in source file")
+ : _(".warning directive invoked in source file"));
+
+ if (!is_it_end_of_statement ())
+ {
+ if (*input_line_pointer != '\"')
+ {
+ as_bad (_("%s argument must be a string"),
+ err ? ".error" : ".warning");
+ discard_rest_of_line ();
+ return;
+ }
+
+ msg = demand_copy_C_string (&len);
+ if (msg == NULL)
+ return;
+ }
+
+ if (err)
+ as_bad ("%s", msg);
+ else
+ as_warn ("%s", msg);
+ demand_empty_rest_of_line ();
+}
+
/* Handle the MRI fail pseudo-op. */
void