Date: Wed, 24 Aug 2016 15:26:38 -0500 From: Eric van Gyzen <vangyzen@FreeBSD.org> To: Bryan Drewery <bdrewery@FreeBSD.org>, Ed Schouten <ed@nuxi.nl> Cc: svn-src-head@freebsd.org, jilles@freebsd.org, svn-src-all@freebsd.org, src-committers <src-committers@freebsd.org>, Ed Schouten <ed@freebsd.org> Subject: Re: svn commit: r303988 - head/lib/libc/gen Message-ID: <8ef5b79d-5e7e-d5be-db8e-ae5284abdc31@FreeBSD.org> In-Reply-To: <b53255ae-9afc-dbee-1b60-d3b9619dde3c@FreeBSD.org> References: <201608120703.u7C73whf007189@repo.freebsd.org> <d23b295a-1902-193c-dee6-ba49ebd77280@FreeBSD.org> <9ae1c2eb-02ad-b8fe-6aff-7e17e955607a@FreeBSD.org> <CABh_MKkxD3OTF7VO9Rq_eZyqHPN%2BxVws3q3dsH2R3DfZ343kFw@mail.gmail.com> <2632f5f8-d765-3df7-74d7-da878eb4b7a8@FreeBSD.org> <CABh_MKm_YQ3bJD19Cz1vBCGr=YxuzctXV6F1iqMASkSx-PsVMw@mail.gmail.com> <d606b841-dda9-488e-ab35-a9289668d2c4@FreeBSD.org> <CABh_MKmg9XqSg44P8i_S0jit_2tV8-Zyknu6gefMaxXN9piyxQ@mail.gmail.com> <62adcb77-490e-0691-0942-9218c1d55b68@FreeBSD.org> <b53255ae-9afc-dbee-1b60-d3b9619dde3c@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <bdrewery@freebsd.org>: >>>> 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8ef5b79d-5e7e-d5be-db8e-ae5284abdc31>