This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] allow macros with variable number of arguments


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]