diff options
author | Jan Beulich <jbeulich@novell.com> | 2005-05-06 06:50:31 +0000 |
---|---|---|
committer | Jan Beulich <jbeulich@novell.com> | 2005-05-06 06:50:31 +0000 |
commit | 6eaeac8ad728ca5efd19aca44c559199dcb296e2 (patch) | |
tree | f123565d5b6198599c3684dc76e3d7eef6b58299 /gas/doc | |
parent | 26aca5f60e2dde898fb5e6d71859778f0b786f09 (diff) | |
download | gdb-6eaeac8ad728ca5efd19aca44c559199dcb296e2.zip gdb-6eaeac8ad728ca5efd19aca44c559199dcb296e2.tar.gz gdb-6eaeac8ad728ca5efd19aca44c559199dcb296e2.tar.bz2 |
gas/
2005-05-06 Jan Beulich <jbeulich@novell.com>
* macro.c (new_formal, del_formal): New.
(do_formals): Use new_formal. Check for and parse qualifier. Warn if
required argument has default value. Stop looking for more formal
when there was a vararg one.
(macro_expand_body): Use new_formal and del_formal.
(macro_expand): Likewise. Initialize local variable err. Don't
return immediately when encountering an error. Warn when keyword
argument already had a value assigned. Eliminate duplicate clearing
of argument value. When current positional argument matches parameter
of vararg type, assign to it all the remaining arguments. Issue error
when required parameter does not have value.
(free_macro): Use del_formal.
(expand_irp): Initialize formal type. Free buffers associated with
formal prior to returning.
* macro.h (struct formal_struct): Add new field 'type' with new
enumeration type 'formal_type'.
* doc/as.texinfo: Document macro parameter qualifiers.
* NEWS: Mention new functionality.
gas/testsuite/
2005-05-06 Jan Beulich <jbeulich@novell.com>
* gas/macros/badarg.s: Add check for bad qualifier specification.
* gas/macros/badarg.l: Adjust.
* gas/macros/vararg.[sd]: New.
* gas/macros/macros.exp: Run new test.
Diffstat (limited to 'gas/doc')
-rw-r--r-- | gas/doc/as.texinfo | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index 8186aba..4db81f6 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -4866,7 +4866,10 @@ With that definition, @samp{SUM 0,5} is equivalent to this assembly input: @cindex @code{macro} directive Begin the definition of a macro called @var{macname}. If your macro definition requires arguments, specify their names after the macro name, -separated by commas or spaces. You can supply a default value for any +separated by commas or spaces. You can qualify the macro argument to +indicate whether all invocations must specify a non-blank value (through +@samp{:@code{req}}), or whether it takes all of the remaining arguments +(through @samp{:@code{vararg}}). You can supply a default value for any macro argument by following the name with @samp{=@var{deflt}}. You cannot define two macros with the same @var{macname} unless it has been subject to the @code{.purgem} directive (@xref{Purgem}.) between the two @@ -4893,6 +4896,12 @@ After the definition is complete, you can call the macro either as @samp{0}, and @samp{\p2} evaluating to @var{b}). @end table +@item .macro m p1:req, p2=0, p3:vararg +Begin the definition of a macro called @code{m}, with at least three +arguments. The first argument must always have a value specified, but +not the second, which instead has a default value. The third formal +will get assigned all remaining arguments specified at invocation time. + When you call a macro, you can specify the argument values either by position, or by keyword. For example, @samp{sum 9,17} is equivalent to @samp{sum to=17, from=9}. |