Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Feb 2003 22:46:21 -0800
From:      "David O'Brien" <obrien@FreeBSD.org>
To:        Alfred Perlstein <bright@mu.org>
Cc:        Chad David <davidc@FreeBSD.org>, src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org, legacy-committers@FreeBSD.org
Subject:   Re: cvs commit: src/usr.bin/yacc skeleton.c
Message-ID:  <20030208064621.GA7566@dragon.nuxi.com>
In-Reply-To: <20030208063406.GG88781@elvis.mu.org>
References:  <200302070339.h173dRvU071460@repoman.freebsd.org> <20030208062131.GA7362@dragon.nuxi.com> <20030208063406.GG88781@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 07, 2003 at 10:34:06PM -0800, Alfred Perlstein wrote:
> * David O'Brien <obrien@FreeBSD.org> [030207 22:23] wrote:
> > On Thu, Feb 06, 2003 at 07:39:27PM -0800, Chad David wrote:
> > > davidc      2003/02/06 19:39:27 PST
> > > 
> > >   Modified files:
> > >     usr.bin/yacc         skeleton.c 
> > >   Log:
> > >   Add __unused to the declaration of yyrcsid.
> > >   
> > >   Revision  Changes    Path
> > >   1.35      +2 -1      src/usr.bin/yacc/skeleton.c
> > > http://cvsweb.freebsd.org/src/usr.bin/yacc/skeleton.c.diff?r1=1.34&r2=1.35
> > 
> > Please back this out.  Non-portable parsers are now produced.  Not every
> > OS has <sys/cdefs.h>, nor do they understand "__unused".
> 
> How about taking the time to offer advice that will gain us forward
> progress?  Chad wants to get rid of warnings from the code produced,
> perhaps if he added #ifdef __FreeBSD__ or something to the generated
> output?

Use "gcc -Dlint".

You can't use __FreeBSD__ as that covers all versions of FreeBSD.  You
can't use __FreeBSD_version as that requires one to include
<sys/param.h>, which you can't assume exists.  You could use:

    #ifndef lint
    #if (defined(__unix__) || defined(unix)) && !defined(USG)
    #include <sys/param.h>
    #endif
    #if defined(__FreeBSD_version) && __FreeBSD_version >= ?????
    #include <sys/cdefs.h>
    static char const 
    yyrcsid[] __unused = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.35 2003/02/07 03:39:27 davidc Exp $";
    #else
    static char const 
    yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.35 2003/02/07 03:39:27 davidc Exp $";
    #endif
    #endif


but this gets very ugly very quickly.  There is not good fix other than to
just use -Dlint.  I thought this was oblivious enough that I wouldn't had
to have taking so much time expounding on the problem that I didn't
create.  If I had know of an easy fix I would have mentioned it.
If one really, really must do something about this, add a new switch to
Yacc telling it you want to target only FreeBSD.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-src" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030208064621.GA7566>