This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: -Winline option
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Paul Eggert <eggert at cs dot ucla dot edu>, David Miller <davem at davemloft dot net>, roland at hack dot frob dot com, libc-alpha at sourceware dot org
- Date: Fri, 1 May 2015 16:00:35 +0200
- Subject: Re: -Winline option
- Authentication-results: sourceware.org; auth=none
- References: <55269642 dot 8040507 at redhat dot com> <20150409 dot 141202 dot 1584701513523037804 dot davem at davemloft dot net> <20150409192408 dot 6BB132C3B96 at topped-with-meat dot com> <20150409 dot 171238 dot 122593176026308256 dot davem at davemloft dot net> <55277438 dot 2050604 at cs dot ucla dot edu> <5527835E dot 9000705 at redhat dot com>
On Fri, Apr 10, 2015 at 10:01:34AM +0200, Florian Weimer wrote:
> On 04/10/2015 08:56 AM, Paul Eggert wrote:
> > David Miller wrote:
> >> In this particular case the inline is in a header file to provide a
> >> function used by applications.
> >
> > As I understand it <scratch_buffer.h> is a private header, not for use
> > by applications. See, e.g.,
> > <https://sourceware.org/ml/libc-alpha/2015-04/msg00047.html> where I ask
> > "These functions are all private to glibc, right?" and the followup
> > <https://sourceware.org/ml/libc-alpha/2015-04/msg00067.html> where
> > Florian says "My concern was the internal ABI between libc and the NSS
> > modules."
> >
> > If <scratch_buffer.h> is intended to be public then we have a problem,
> > as C99 frowns on public headers defining static inline functions for use
> > in application code.
>
> It's not intended as a public header, not for the foreseeable future.
> The concern about unused static functions is still valid, though.
>
> I think we either have to ban âinlineâ and use â__always_inlineâ
> exclusively where that makes sense, or drop -Winline. As I said, the
> latter shouldn't be needed anymore because __always_inline failures are
> covered under -Wattributes.
>
Agreed. Its known problem that gcc cannot handle macro-like inline
functions well so forcing always_inline is appropriate. gcc uses
heuristic that use function size as parameter regardless that it could
be almost optimized out when inlined.