Subject: Re: Compiler warning levels and sccsid/rcsid
To: John Birrell <cimaxp1!>
From: Tobias Weingartner <weingart@austin.BrandonU.CA>
List: current-users
Date: 07/27/1995 09:23:07
In message <>, John Birrell writes:
> 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 said in message
> <>).
> 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.

I must be stupid, but how 'bout this:

Modify (we have source, no?) gcc, to understand '#pragma ident "$NetBSD$"'
that (according to ANSI spec) should be ignored by compilers that do not
recognize it.

Also, it uses no includes, no funky non-portable defines, and if a compiler
does choke on it, a simple 'grep -v 'pragma  *ident' file.c' should be all
that is needed...

PS: Does anyone have a binary of gcc-2.7.0+libg++-2.7.0a, or the patches to
actally get it working under NetBSD-1.0a/i386.  Do I have to install a new
gas to handle the '.weak' directives?

| Tobias Weingartner | Email: weingart@BrandonU.Ca | Need a Unix sys-admin?  |
| Box 27, Beulah, MB |-----------------------------| Send E-Mail for resume, |
| R0M 0B0, Canada    | Unix Guru, Admin, Sys-Prgmr | and other details...    |
|      %SYSTEM-F-ANARCHISM, The operating system has been overthrown         |