Re: [PATCH 1/2] mark functions with const and pure attributes

2011-05-01 Thread Bruno Haible
Paul Eggert wrote: > The declarations should be marked. For example, the declaration of argmatch > should be marked with _GL_ATTRIBUTE_PURE (or _GL_PURE) in argmatch.h. Yes. Good point. Jim, in the current idioms with macros from c++defs.h the attribute needs to be added in the _GL_FUNCDECL_RPL

Re: [PATCH 1/2] mark functions with const and pure attributes

2011-05-01 Thread Paul Eggert
One other thing, and this is more important. The declarations should be marked. For example, the declaration of argmatch should be marked with _GL_ATTRIBUTE_PURE (or _GL_PURE) in argmatch.h. We mark functions partly so that callers can be optimized better, but typically this works for other comp

Re: [PATCH 1/2] mark functions with const and pure attributes

2011-05-01 Thread Bruno Haible
Paul Eggert wrote: > > +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) > > The names _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST seem > gratingly long to me; when reading a function signature they > get in the way of other important information. > ... > renaming them to _GL_PURE and _GL_CON

Re: [PATCH 1/2] mark functions with const and pure attributes

2011-05-01 Thread Jim Meyering
Paul Eggert wrote: > On 05/01/11 06:31, Jim Meyering wrote: >> +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) > > The names _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST seem > gratingly long to me; when reading a function signature they > get in the way of other important information. Also,

Re: [PATCH 1/2] mark functions with const and pure attributes

2011-05-01 Thread Paul Eggert
On 05/01/11 06:31, Jim Meyering wrote: > +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) The names _GL_ATTRIBUTE_PURE and _GL_ATTRIBUTE_CONST seem gratingly long to me; when reading a function signature they get in the way of other important information. Also, these two names use a differ

[PATCH 1/2] mark functions with const and pure attributes

2011-05-01 Thread Jim Meyering
Here's a better pair of patches. The first one makes gnulib-common.m4 emit definitions of these two _GL_ATTRIBUTE_... macros. The second addresses all of the warnings in gnulib code induced by building coreutils with CFLAGS='-O3 -Wsuggest-attribute=const -Wsuggest-attribute=pure -Wsuggest-attribut