Subject: Re: Compiler warning levels and sccsid/rcsid
To: None <cimaxp1!jb@cimlogic.com.au>
From: Antti Miettinen <apm@kikka.hut.fi>
List: current-users
Date: 07/24/1995 14:47:41
>I just did a sup and thought I'd try -Wall when compiling. A lot of the
>NetBSD code has things like...
>
>#ifndef lint
>static char sccsid[] = "@(#)insch.c 8.2 (Berkeley) 5/4/94";
>#endif /* not lint */
>
>With -Wall this causes a warning...
>
>warning: `sccsid' defined but not used
These warnings can be worked around with something like the following:
static char id[] = "$Id$";
static struct iduse { char *a; struct iduse *b; } iduse = { id, &iduse };
Ugly, yeah. And some day gcc may be clever enough to warn about the
above too. I suppose it would be hard if not impossible to come up
with a portable asm() definition for the id strings..
But all of this could be put to a header defining a macro. Something
like the following:
#ifndef lint
# ifdef __GNUC__
# define ID(s) \
static char id[] = s; \
static struct iduse { char *a; struct iduse *b; } iduse = { id, &iduse };
# else
# define ID(s) \
static char id[] = s;
# endif /* ?__GNUC__ */
#else
# define ID(s)
#endif /* ?lint */
And files defining id strings would say `ID("$Id$")'.