* 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.
This commit is contained in:
parent
a7eec87693
commit
d190d04643
4 changed files with 68 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
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
|
||||
|
|
|
@ -3726,6 +3726,7 @@ Some machine configurations provide additional directives.
|
|||
* 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}
|
||||
|
@ -3842,6 +3843,7 @@ Some machine configurations provide additional directives.
|
|||
* 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
|
||||
|
@ -4240,6 +4242,19 @@ If @command{@value{AS}} assembles a @code{.err} directive, it will print an erro
|
|||
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}.
|
||||
|
@ -5865,6 +5880,12 @@ parent whose addend is the value of the child symbol. As a special case the
|
|||
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}}
|
||||
|
||||
|
|
39
gas/read.c
39
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
|
||||
|
|
|
@ -151,6 +151,7 @@ extern void s_elseif (int arg);
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue