bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: avoiding 'static inline'


From: Ben Pfaff
Subject: Re: avoiding 'static inline'
Date: Sat, 18 Aug 2012 22:04:51 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Paul Eggert <address@hidden> writes:

> I recently added a bunch of static inline functions to Emacs,
> and just for fun I tried changing them to plain 'static' to
> see how much that would hurt performance.  To my surprise, it
> made Emacs 14% faster on my standard Lisp benchmark (taking the nth
> element of a long list).  It also shrank the size of the text segment
> by 1.7%, which was not as much of a surprise.
>
> Clearly I've been using 'static inline' too much.  Come to think of
> it, these days there's little need for 'static inline' as opposed to
> 'static', since GCC and other modern compilers will inline 'static'
> functions for you.  And apparently they do a better job if they're not
> given bad advice by people who use the 'inline' keyword.
>
> I'd like to install some changes to gnulib, so that its code does
> not use 'static inline' in the modules that Emacs uses.  This is part
> of a similar, larger change to Emacs proper.  These patches won't
> affect extern inline functions, just static ones.

With GCC, adding "inline" to "static" has the side effect of
suppressing "unused static function" warnings.  For "static
inline" functions in header files in particular, that's an
important side effect, since most C source files that #include a
header won't have a call to every "static inline" function in the
header.

I see that some of your patches remove "inline" from some "static
inline" functions in header files, but I don't see anything
added, such as __attribute__((unused)), that would suppress an
"unused static function" warning.  (Perhaps I just missed it.)
Did you consider this issue?

Thanks,

Ben.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]