Subject: Re: Compiler warning levels and sccsid/rcsid
To: None <current-users@NetBSD.ORG>
From: John Birrell <cimaxp1!jb@cimlogic.com.au>
List: current-users
Date: 07/27/1995 10:23:17
Hmmm. Trying to trick the pre-processor?

> >#    define ID(s) \
> >#ident s
> 
> This can't be done in ISO C. Macro replacement are not rescanned for
> preprocessor commands.

Well here's something that _does_ work with gcc...

----------------------------------------------------------------------------
#define ID(prefix,nl,string) nl##prefix string##nl

#if defined(__GNUC__)
ID(#ident,
, "@(#) $Id: fname.c,v 1.1 1995/07/14 01:00:39 jb Exp $")
#endif
----------------------------------------------------------------------------

Notice that the use of ID() _requires_ the two lines in order to get the new
line character in the output.

This will let us use -Wall without rcsid usage warnings and without allocating
space for the version strings in memory, but it means that #ident has to be
implemented in gcc (like jconklin@netcom.com said in message
<199507261558.IAA15018@netcom4.netcom.com>).

I'd like to see #ident do something useful because it's one of the few things
I like about the old System V we've got. Putting the @(#) in the #ident
strings and being able to do a 'what' on the binary was nice. When we got
systems that ignore #ident, we were not prepared to have these strings take
up memory at runtime, so we stopped using them and created a utility that
writes them to another file.


-- 
John Birrell                                CIMlogic Pty Ltd
jb@cimlogic.com.au                          119 Cecil Street
Ph  +61  3 9690 9600                        South Melbourne Vic 3205
Fax +61  3 9690 6650                        Australia
Mob +61 18  353  137