Re: pure and const function attributes

2020-05-05 Thread Paul Eggert
On 5/5/20 1:29 AM, Marc Nieper-Wißkirchen wrote:
> If I understand correctly, the patch seems to cover compilers that
> declare "__has_attribute", which should cover GCC and Clang. Does it
> make sense to support MSC's "__declspec" as well?

I don't use MSC so I'm not qualified to comment. I am a bit worried about bloat
here, though. This stuff goes into every config.h.

> As for the future-proof C2X approach: In the GCC 10 Changes
> (https://gcc.gnu.org/gcc-10/changes.html), the C2X standard attributes
> are written without double underscores.  In the attached patch, they
> are. What is correct?

The C2X draft says that both forms are OK. I used double-underscore as it's less
likely to infringe on the user namespace.



Re: Add gl_list_remove_last to list/xlist

2020-05-05 Thread Marc Nieper-Wißkirchen
Hi Bruno,

excellent; thank you very much!

Just one note: The documentation needs to be updated in section 14.8
as well ([1]).

So long,

Marc

[1] https://www.gnu.org/software/gnulib/manual/gnulib.html#Container-data-types

Am Sa., 2. Mai 2020 um 23:24 Uhr schrieb Bruno Haible :
>
> I wrote:
> > I should better revert yesterday's patch, and instead,
> > in the table show the guaranteed average performance
> >   gl_list_get_first
> >   gl_list_get_last
> >   gl_list_set_first
> >   gl_list_set_last
> >   gl_list_remove_first
> >   gl_list_remove_last
> > where these 6 functions are defined globally, not separately for each
> > implementation.
>
> Done through the two attached patches.
>
> 2020-05-02  Bruno Haible  
>
> list: Add get_first, get_last, set_first, set_last operations.
> * lib/gl_list.h (gl_list_get_first, gl_list_get_last,
> gl_list_nx_set_first, gl_list_nx_set_last): New functions.
> * lib/gl_xlist.h (gl_list_set_first, gl_list_set_last): New functions.
>
> 2020-05-02  Bruno Haible  
>
> list: Remove redundant code for remove_first and remove_last 
> operations.
> * lib/gl_list.h (struct gl_list_implementation): Remove fields
> remove_first, remove_last.
> (gl_list_remove_first, gl_list_remove_last): Implement in a generic 
> way.
> * lib/gl_array_list.c: Revert last change.
> * lib/gl_carray_list.c: Likewise.
> * lib/gl_anylinked_list2.h: Likewise.
> * lib/gl_linked_list.c: Likewise.
> * lib/gl_linkedhash_list.c: Likewise.
> * lib/gl_anytree_list2.h: Likewise.
> * lib/gl_avltree_list.c: Likewise.
> * lib/gl_avltreehash_list.c: Likewise.
> * lib/gl_rbtree_list.c: Likewise.
> * lib/gl_rbtreehash_list.c: Likewise.
> * lib/gl_sublist.c: Likewise.
>



Re: pure and const function attributes

2020-05-05 Thread Marc Nieper-Wißkirchen
Hi Paul,

thank you very much.

If I understand correctly, the patch seems to cover compilers that
declare "__has_attribute", which should cover GCC and Clang. Does it
make sense to support MSC's "__declspec" as well?

As for the future-proof C2X approach: In the GCC 10 Changes
(https://gcc.gnu.org/gcc-10/changes.html), the C2X standard attributes
are written without double underscores.  In the attached patch, they
are. What is correct?

Marc

Am So., 3. Mai 2020 um 08:21 Uhr schrieb Paul Eggert :
>
> Thanks for catching those glitches. I suppose you're right, the new
> _GL_ATTRIBUTE_* macros should be in gnulib-common.m4 even though that will now
> grow by a bit (meaning config.h will grow quite a bit). Attached is a revised
> draft patch to Gnulib, which (unlike the previous one) I have tested a bit. It
> doesn't attempt to revamp all of Gnulib to use the new macros, but does enough
> of them to give a flavor for the conversion.