On 03/28/2010 04:35 AM, Bruno Haible wrote: >>> Did you know that GCC has a special optimization for include files? ... > >> are you saying that the optimization is useless for those files, because they >> are split includes, and thus already fail to meet the pattern that gcc >> is looking for? > > No, on the contrary: The previous shape of most of our *.in.h files matches > what GCC is looking for: It starts with a "#ifndef _GL_STRING_H" and ends > with the corresponding "#endif". The fact that _GL_STRING_H is tested again > inside is irrelevant for this optimization.
I think we're in violent agreement - for the few files with special invocation (like fcntl.h), we cannot satisfy gcc's optimization anyway, so we might as well guarantee the pragma is up front to avoid any issues with conditional optimization; but for the remaining files, we might as well satisfy gcc's optimization, since the effort is trivial. > Here's the proposed patch: Please apply. > +++ lib/arpa_inet.in.h Sun Mar 28 12:07:53 2010 > @@ -16,12 +16,12 @@ > along with this program; if not, write to the Free Software Foundation, > Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ > > -# if __GNUC__ >= 3 > -...@pragma_system_header@ > -# endif > - > #ifndef _GL_ARPA_INET_H > > +#if __GNUC__ >= 3 > +...@pragma_system_header@ > +#endif Hmm, if we were using cppi more religiously, I wouldn't have introduced the whitespace usage in that #if in the first place. -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature