#ifndef lint

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

#ifndef lint

Paul Irofti
I remember seeing a comment regarding the topic a few days ago on a
patch. But I can't seem to find it in the archive.

Anyways, I was browsing through the /usr/src and noticed that most c
files begin with something like:

#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1989, 1993\n\
        The Regents of the University of California.  All rights reserved.\n";
#endif /* not lint */

#ifndef lint
#if 0
static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95";
#else
static char rcsid[] = "$OpenBSD: cat.c,v 1.17 2005/04/05 01:18:53 jaredy
Exp $";
#endif
#endif /* not lint */


My question is why is this used twice? and not in a single #ifndef?

Thanks,
Paul.

Reply | Threaded
Open this post in threaded view
|

Re: #ifndef lint

Joachim Schipper
On Sun, Aug 27, 2006 at 04:38:00PM +0300, Paul Irofti wrote:

> I remember seeing a comment regarding the topic a few days ago on a
> patch. But I can't seem to find it in the archive.
>
> Anyways, I was browsing through the /usr/src and noticed that most c
> files begin with something like:
>
> #ifndef lint
> static char copyright[] =
> "@(#) Copyright (c) 1989, 1993\n\
> The Regents of the University of California.  All rights reserved.\n";
> #endif /* not lint */

This embeds the string in the final executable, so that strings(1) can
find it; however, lint(1) rightly complains that the string will never
be used.

> #ifndef lint
> #if 0
> static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95";
> #else
> static char rcsid[] = "$OpenBSD: cat.c,v 1.17 2005/04/05 01:18:53 jaredy
> Exp $";
> #endif
> #endif /* not lint */
>
>
> My question is why is this used twice? and not in a single #ifndef?

I suppose the point is to preserve the old Berkeley SCCS tag, while
still allowing the above (SCCS is a version control system much like
RCS; but where RCS evolved into CVS, SCCS isn't used a lot nowadays).

                Joachim