From owner-svn-src-all@freebsd.org Wed Aug 24 20:26:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0187BC524E; Wed, 24 Aug 2016 20:26:40 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id A5C62132A; Wed, 24 Aug 2016 20:26:40 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 68FAE56488; Wed, 24 Aug 2016 15:26:39 -0500 (CDT) Subject: Re: svn commit: r303988 - head/lib/libc/gen To: Bryan Drewery , Ed Schouten References: <201608120703.u7C73whf007189@repo.freebsd.org> <9ae1c2eb-02ad-b8fe-6aff-7e17e955607a@FreeBSD.org> <2632f5f8-d765-3df7-74d7-da878eb4b7a8@FreeBSD.org> <62adcb77-490e-0691-0942-9218c1d55b68@FreeBSD.org> Cc: svn-src-head@freebsd.org, jilles@freebsd.org, svn-src-all@freebsd.org, src-committers , Ed Schouten From: Eric van Gyzen Message-ID: <8ef5b79d-5e7e-d5be-db8e-ae5284abdc31@FreeBSD.org> Date: Wed, 24 Aug 2016 15:26:38 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 20:26:40 -0000 On 08/24/2016 15:16, Bryan Drewery wrote: > On 8/24/16 1:12 PM, Eric van Gyzen wrote: >> On 08/24/2016 15:01, Ed Schouten wrote: >>> 2016-08-24 21:53 GMT+02:00 Bryan Drewery : >>>> Is it possible to cause the use of these old prototypes to print a >>>> warning and note that they are deprecated/unsafe? >>> >>> That's a good question. In theory, we could annotate these functions >>> with __attribute__((__deprecated__)): >>> >>> https://gcc.gnu.org/onlinedocs/gcc-3.3.4/gcc/Type-Attributes.html >>> >>> But I'm actually too afraid to use it. In the worst case it may cause >>> the compiler to generate a warning even when basename()/dirname() is >>> used correctly, as __old_* will still be part of the compiled >>> expression. >> >> Could __warn_references() be used, as libc currently does for gets() and >> others? >> >> Eric >> > > /usr/include/stdio.h:extern char *gets (char *__s) __wur > __attribute_deprecated__; > /usr/include/x86_64-linux-gnu/sys/cdefs.h:# define > __attribute_deprecated__ __attribute__ ((__deprecated__)) > > __wur being warning about unused result. /usr/src/lib/libc/stdio/gets.c:__warn_references(gets, "warning: this program uses gets(), which is unsafe."); > As for actually using it here, I tried adding it onto the > _old_dirname/basename prototypes. It produces an error, fine, in the > bootstrap build for xinstall it would not error, great. However, for > building xinstall on head where it will not use the __old_dirname and > will use the new dirname@FBSD_1.5, it _still_ complains about using the > __old_dirname() prototype via __generic and errors in the wrong case.