Date: Wed, 16 May 2018 14:00:54 -0700 From: John Baldwin <jhb@freebsd.org> To: Brooks Davis <brooks@freebsd.org> Cc: Bruce Evans <brde@optusnet.com.au>, arch@freebsd.org Subject: Re: LIBC_SCCS Message-ID: <6859500.cJmFvTkEvq@ralph.baldwin.cx> In-Reply-To: <20180501215303.GA4870@spindle.one-eyed-alien.net> References: <1711113.VelFtdTVS7@ralph.baldwin.cx> <20180428110152.Q4737@besplex.bde.org> <20180501215303.GA4870@spindle.one-eyed-alien.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, May 01, 2018 09:53:03 PM Brooks Davis wrote: > On Sat, Apr 28, 2018 at 11:39:02AM +1000, Bruce Evans wrote: > > On Fri, 27 Apr 2018, John Baldwin wrote: > > > > > I suspect no one cares, but for whatever reason our current handling of the > > > LIBC_SCCS macro in some of our libraries annoys me. In theory it seems like > > > LIBC_SCCS's purpose is to control whether or not old SCCS IDs from Berkeley > > > are included in libc's sources when libc is built. (Similar to how macros > > > control the behavior of __FBSDID().) However, we use an odd construct in > > > the tree. First, we define LIBC_SCCS by default in the CFLAGS of various > > > libraries (libkvm, libutil, libthr, libc, etc.) which in theory would enable > > > the IDs, but then we explicitly wrap them in #if 0, e.g.: > > > > > > #if defined(LIBC_SCCS) && !defined(lint) > > > #if 0 > > > static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93"; > > > #endif > > > #endif /* LIBC_SCCS and not lint */ > > > > Most aren't actually wrapped with '#if 0'. E.g., in libc/*/*.c there are > > 839 files but only 47 of these have any '#if 0' at all. SO this can be > > fixed without much churn. > > > > I thought there is a problem with the above not actually compiling if > > LIBC_SCCS is defined, but WARNS is only 2 for libc and it takes WARNS >= 4 > > to give -Wwrite-strings. > > At higher WARNS levels the ones without #if 0 also warn about unused > static variable. If we're going to keep them, using an __FBSDID()-like > macro seems like the best option so that's easy to make correct and > doesn't require churn if compilers change. I have a review for libkvm (which has many smaller examples than libc) at https://reviews.freebsd.org/D15459 for any folks who are interested. It uses __SCCSID() but then disables them by default via -DNO__SCCSID. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6859500.cJmFvTkEvq>