From owner-freebsd-arch@freebsd.org Sat Apr 28 01:39:07 2018 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63870FB7C25 for ; Sat, 28 Apr 2018 01:39:07 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 0758972FC7 for ; Sat, 28 Apr 2018 01:39:07 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: by mailman.ysv.freebsd.org (Postfix) id BC482FB7C24; Sat, 28 Apr 2018 01:39:06 +0000 (UTC) Delivered-To: arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAC12FB7C23 for ; Sat, 28 Apr 2018 01:39:06 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 2E44472FC4; Sat, 28 Apr 2018 01:39:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 0FDE71A3312; Sat, 28 Apr 2018 11:39:03 +1000 (AEST) Date: Sat, 28 Apr 2018 11:39:02 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John Baldwin cc: arch@freebsd.org Subject: Re: LIBC_SCCS In-Reply-To: <1711113.VelFtdTVS7@ralph.baldwin.cx> Message-ID: <20180428110152.Q4737@besplex.bde.org> References: <1711113.VelFtdTVS7@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=yx2sZqNwYUSPZrZwlfMA:9 a=CjuIK1q_8ugA:10 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Apr 2018 01:39:07 -0000 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. style(9) says to use '#if 0', but not as above. It says to put the #if 0 around everything, but only if there is not already a suitable ifdef like the LIBC_SCCS one. The above style is apparently from NetBSD. It is now used a lot on libedit, with further ugliness and bugs: - first there is an #if-#else clause with a NetBSD __RCSID() in the #else clause, so that the #if 0 selects between the sccsid and the NetBSD id - __RCSID() may be killed by defining NO__RCSID. It is a bug that the application identifier NO__RCSID affects and system header. sys/cdefs.h is an especially important system header and is one of the few that tries to avoid namespace pollution bugs like this. The default is to keep the NetBSD id. - after this idfef tangle, there is an unconditional __FBSDID() to give the FreeBSD id - __FBSDID() may also be killed by defining either lint or STRIP_FBSDID. sys/cdefs.h is actually careless about namespace pollution bugs like this. > I'd rather that we make LIBC_SCCS actually work by removing the #if 0 (and > perhaps the lint baggage) but then remove it from the default CFLAGS to > preserve the existing behavior by default. Does anyone else care if I do > this? I don't mind removing FreeBSD mistakes like the '#if 0'. Editing to add const poisoning is hopefully not often needed. Bruce