🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #387

Re: cccp patch for multi-arg defines...

#387
From: Lars Henrik Mathiesen
Date: Tue, 14 Apr 1992 11:08
38 lines
2326 bytes
gray@antaire.COM (Gray Watson) writes:
>Not a bug.  A feature upgrade on-top of gcc version 2.1.
>>	#define vmacro (...)		(void)printf(...)

>After a couple of hours of deep discussion here, we came up with __REST__ as
>magical token.  It is quite arbitrary and is #defined on in the patches so it
>can be changed easily.

Some years ago, I saw a description of another implementation of this
feature, the syntax of which I liked better:

#define errprint(fmt args) \
	(void)fprintf(stderr, "%s: "##fmt##": %s\n", prog args, strerr(errno))

Note the ``missing'' commas in both parameter and replacement lists;
the expansion of the last parameter includes the leading comma (if
any) to allow for the number of variable arguments to be zero. (Yes,
this causes odd expansions like |foo(, bar)| --- but varargs functions
in Standard C always have at least one fixed argument, so this would
only occur when using the preprocessor for other purposes.)

>In any case.  It seems to work fine here.  Can anyone see any problems with
>this being integrated into ccp?

Well, it seems to me that the above version is better because it
allows a proper name for the parameter, and allows it to cover zero
arguments. Since implementation in GCC probably is the only hope of
creating prior art so that a feature like this can be included in a
future revision of Standard C, I'd like to see as capable a version as
possible.

I don't have the 2.1 cccp.c unpacked at the moment, and more
importantly, I don't have the time to test anything, but I looked at
the 1.40 cccp.c and the patch file you sent, and I think this version
can be implemented with about the same amount of changes as the
__REST__ version, or perhaps a bit less. Perhaps after Easter ...

Lars Mathiesen (U of Copenhagen CS Dep) <thorinn@diku.dk> (Humour NOT marked)
Technical Details
Message-ID: <1992Apr14.110849.19681@odin.diku.dk>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!diku.dk!thorinn
References: <9204130207.AA02495@antaire.com>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!diku.dk!thorinn
From: thorinn@diku.dk (Lars Henrik Mathiesen)
Subject: Re: cccp patch for multi-arg defines...
Message-ID: <1992Apr14.110849.19681@odin.diku.dk>
Sender: gnulists@ai.mit.edu
Organization: Department of Computer Science, U of Copenhagen
References: <9204130207.AA02495@antaire.com>
Distribution: gnu
Date: Tue, 14 Apr 1992 11:08:49 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 39