This is the mail archive of the mailing list for the GCC project.

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

Re: __VA_ARGS__ patch for cccp.c

	This small patch enables variable arguments for macros in the same style as         
	in my copy of the draft c9x standard.                                     
We really should have a way of specifying the c9x standard before adding
features that are specific to it.  I'll bring that up in another message.

	it essentially treats ... as __VA_ARGS__..., as in:
This looks mostly OK.  However, I don't see anything in the C9X draft about
using ## to delete a preceeding argument if the ... part is empty.  This stuff
should not be enabled if using the c9x style variable argument macros.
This happens at this comment:
        /* If followed by an empty rest arg with concatenation,
Maybe we could use a different value for the rest_args field to distinguish
between these two different cases.

	note also that this is always enabled (it doesn't clash with the older
	syntax), as was the arg... syntax (hmm, why is this enabled even with

That looks like a bug to me.  This patch seems to fix it.

Mon Mar  9 18:13:09 1998  Jim Wilson  <>

	* cccp.c (create_definition): If pedantic, call pedwarn for macro
	varargs feature.

Index: cccp.c
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cccp.c,v
retrieving revision 1.15
diff -p -r1.15 cccp.c
*** cccp.c	1998/03/06 23:54:33	1.15
--- cccp.c	1998/03/10 02:13:03
*************** create_definition (buf, limit, op)
*** 5565,5570 ****
--- 5565,5572 ----
  	/* do we have a "special" rest-args extension here? */
  	if (limit - bp > REST_EXTENSION_LENGTH
  	    && bcmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) {
+ 	  if (pedantic)
+ 	    pedwarn ("ANSI C does not allow macro with variable arguments");
  	  rest_args = 1;
  	  temp->rest_args = 1;

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