[PATCH] allow macros with variable number of arguments
Nick Clifton
nickc@redhat.com
Thu May 5 10:06:00 GMT 2005
Hi Jan,
> gas/
> 2005-04-27 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.
>
> gas/testsuite/
> 2005-04-27 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.
Approved - please apply - but ...
* Please add an entry in the gas/NEWS file mentioning the new feature.
* Also:
> +static formal_entry *
> +new_formal ()
Please insert "void" into the parameter list.
> + formal = (formal_entry *) xmalloc (sizeof (formal_entry));
The cast is not necessary.
> + else if (strcmp(qual.ptr, "req") == 0)
Missing space between function name and opening parenthesis.
> + else if (strcmp(qual.ptr, "vararg") == 0)
Same here.
> + enum formal_type {
> + FORMAL_OPTIONAL,
Suggest moving the opening curly parenthesis to a line of its own.
Cheers
Nick
More information about the Binutils
mailing list