(s_errwarn): New function.
* read.h (s_errwarn): Declare.
* doc/as.texinfo (Error, Warning): Document .error and .warning.
+2004-11-22 Hans-Peter Nilsson <hp@axis.com>
+
+ * 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.
+
2004-11-22 Nick Clifton <nickc@redhat.com>
* config/tc-tic54x.c (tic54x_adjust_symtab): Adjust call to
* Equ:: @code{.equ @var{symbol}, @var{expression}}
* Equiv:: @code{.equiv @var{symbol}, @var{expression}}
* Err:: @code{.err}
+* Error:: @code{.error @var{string}}
* Exitm:: @code{.exitm}
* Extern:: @code{.extern}
* Fail:: @code{.fail}
* VTableInherit:: @code{.vtable_inherit @var{child}, @var{parent}}
@end ifset
+* Warning:: @code{.warning @var{string}}
* Weak:: @code{.weak @var{names}}
* Word:: @code{.word @var{expressions}}
* Deprecated:: Deprecated Directives
message and, unless the @option{-Z} option was used, it will not generate an
object file. This can be used to signal error an conditionally compiled code.
+@node Error
+@section @code{.error "@var{string}"}
+@cindex error directive
+
+Similarly to @code{.err}, this directive emits an error, but you can specify a
+string that will be emitted as the error message. If you don't specify the
+message, it defaults to @code{".error directive invoked in source file"}.
+@xref{Errors, ,Error and Warning Messages}.
+
+@smallexample
+ .error "This code has not been assembled and tested."
+@end smallexample
+
@node Exitm
@section @code{.exitm}
Exit early from the current macro definition. @xref{Macro}.
parent name of @code{0} is treated as refering the @code{*ABS*} section.
@end ifset
+@node Warning
+@section @code{.warning "@var{string}"}
+@cindex warning directive
+Similar to the directive @code{.error}
+(@pxref{Error,,@code{.error "@var{string}"}}), but just emits a warning.
+
@node Weak
@section @code{.weak @var{names}}
{"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. */
{"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. */
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
extern void s_end (int arg);
extern void s_endif (int arg);
extern void s_err (int);
+extern void s_errwarn (int);
extern void s_fail (int);
extern void s_fill (int);
extern void s_float_space (int mult);