Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Bruno Haible
Hi Marc, Some comments: * GL_HAMT_THREAD_SAFE can be defined to 1 not only if __STDC_VERSION__ >= 201112 && ! defined __STD_NO_ATOMICS__ but also if __GNUC__ + (__GNUC_MINOR >= 9) > 4 (see the other mail). * Still '#ifdef GL_HAMT_THREAD_SAFE'. * Typo s/comparision/comparison/ *

Re: _Atomic

2020-10-10 Thread Bruno Haible
Paul Eggert wrote: > On 10/10/20 8:04 AM, Marc Nieper-Wißkirchen wrote: > > #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && > > !defined (__STD_NO_ATOMICS__) > > > > I am asking because there may be non-C11 compilers that nevertheless > > understand _Atomic. > > I suggest not

Re: stack bounds

2020-10-10 Thread Bruno Haible
Paul Eggert wrote: > > On Linux, the kernel allows the stack to grow by any amount, if it does not > > become closer than 1 MB to another VMA and does not violate the set limits. > > See linux/mm/mmap.c:expand_downwards and linux/mm/mmap.c:acct_stack_growth. > > Therefore on Linux, there is no

Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Marc Nieper-Wißkirchen
I have attached an improved version of the HAMT module to this email. Apart from improving the comments (which includes moving some documentation into the header file) and changing the things already discussed, I added a few more tests and three procedures for in-place updates. For example, you

Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Marc Nieper-Wißkirchen
Am Sa., 10. Okt. 2020 um 20:19 Uhr schrieb Paul Eggert : > #if __STDC_VERSION__ < 201112 || defined __STD_NO_ATOMICS__ > > which is a cleaner way of writing the negative of the above test. These days > there should be no reason to check whether __STDC_VERSION__ is defined, > generally it's

Re: Unused parameter warnings

2020-10-10 Thread Bruno Haible
Paul Eggert wrote: > I installed the attached commentary changes. OK, with these definitions of 'pure' and 'const', I can make the change Marc requested - and some more. 2020-10-10 Bruno Haible *-list, *-oset, *-omap: Avoid possible compiler warnings. Reported by Marc

Re: Unused parameter warnings

2020-10-10 Thread Bruno Haible
Marc Nieper-Wißkirchen wrote: > so that the code is compilable with -Werror -Wall -Wextra. Note that Gnulib does not guarantee this. Especially for -Wsign-compare and -Wunused-parameter (but also some other warning types) we have no intention to fix them; the cure would be often worse than the

[PATCH] stack: New module.

2020-10-10 Thread Marc Nieper-Wißkirchen
From: Marc Nieper-Wißkirchen * MODULES.html.sh: Add entry for the stack module. * modules/stack: New file. * modules/stack-tests: New file. * lib/stack.h: New file. * tests/test-stack.c: New file. --- ChangeLog | 9 +++ MODULES.html.sh | 1 + lib/stack.h | 165

Re: stack bounds

2020-10-10 Thread Paul Eggert
On 10/10/20 5:08 AM, Bruno Haible wrote: On Linux, the kernel allows the stack to grow by any amount, if it does not become closer than 1 MB to another VMA and does not violate the set limits. See linux/mm/mmap.c:expand_downwards and linux/mm/mmap.c:acct_stack_growth. Therefore on Linux, there

Re: Unused parameter warnings

2020-10-10 Thread Paul Eggert
On 10/10/20 8:00 AM, Marc Nieper-Wißkirchen wrote: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97364 Looking at that bug report and related material (particularly Richard Biener's 2012 comment ) the GCC folks seem to have decided long

Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Paul Eggert
On 10/10/20 8:04 AM, Marc Nieper-Wißkirchen wrote: #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined (__STD_NO_ATOMICS__) I am asking because there may be non-C11 compilers that nevertheless understand _Atomic. I suggest not worrying about this problem until we run

Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Marc Nieper-Wißkirchen
Am Sa., 10. Okt. 2020 um 19:41 Uhr schrieb Bruno Haible : > > Hi Marc, > > > Is there a special Gnulib way (or Autoconf macro) for the following test: > > > > #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && > > !defined (__STD_NO_ATOMICS__) > > > > I am asking because there may be

Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Bruno Haible
Hi Marc, > > - +/* The public interface is documented in the file hamt.c. > > > > This is not good. As a user of the module, I would want to read *only* > > hamt.h and know how to use the public interface. In other words, hamt.h > > should have the functions' comments. > > I

Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Bruno Haible
Hi Marc, > Is there a special Gnulib way (or Autoconf macro) for the following test: > > #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && > !defined (__STD_NO_ATOMICS__) > > I am asking because there may be non-C11 compilers that nevertheless > understand _Atomic. And there may

Re: ChangeLog entries

2020-10-10 Thread Bruno Haible
Hi Marc, > (Do I have to > do something about the ChangeLog entry or will it be auto-generated > from my Git commit message?) The ChangeLog entries are not auto-generated, no. We want the ChangeLog entries to be essentially in sync with the git commits. This means, you typically prepare the

Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Marc Nieper-Wißkirchen
Speaking of GL_HAMT_THREAD_SAFE: Is there a special Gnulib way (or Autoconf macro) for the following test: #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined (__STD_NO_ATOMICS__) I am asking because there may be non-C11 compilers that nevertheless understand _Atomic. Am

Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Marc Nieper-Wißkirchen
Am Sa., 10. Okt. 2020 um 16:54 Uhr schrieb Bruno Haible : > > Since you define GL_HAMT_THREAD_SAFE to either 0 or 1, you need > to test it through > #if GL_HAMT_THREAD_SAFE > not > #ifdef GL_HAMT_THREAD_SAFE > > Bruno Oh, yes... thanks!

Re: Unused parameter warnings

2020-10-10 Thread Marc Nieper-Wißkirchen
Am Sa., 10. Okt. 2020 um 16:39 Uhr schrieb Bruno Haible : > > Hi Marc, > > > I can ask for a better description of "pure" in the GCC manual. > > Yes, please. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97364

Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Bruno Haible
Since you define GL_HAMT_THREAD_SAFE to either 0 or 1, you need to test it through #if GL_HAMT_THREAD_SAFE not #ifdef GL_HAMT_THREAD_SAFE Bruno

Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Marc Nieper-Wißkirchen
Hi Bruno, Am Sa., 10. Okt. 2020 um 16:35 Uhr schrieb Bruno Haible : > It is exciting to see such a datastructure with various application domains > [1] > in Gnulib! I'm glad that you like the idea. > > I haven't read through it line by line; nevertheless a couple of comments: A few more

Re: Unused parameter warnings

2020-10-10 Thread Bruno Haible
Hi Marc, > I can ask for a better description of "pure" in the GCC manual. Yes, please. > Anyway, the function gl_linked_iterator_from_to in Gnulib should > probably be fixed independently by adding the "pure" attribute so that > the code is compilable with -Werror -Wall -Wextra. I don't think

Re: stack module

2020-10-10 Thread Marc Nieper-Wißkirchen
Hi Bruno, Am Sa., 10. Okt. 2020 um 16:06 Uhr schrieb Bruno Haible : > > Hi Marc, > > > please see the attached patch for the new module. > > Very nice. Looks all good, except for some nit-picking in the comments: Thanks. > > > + Introspection: ELEMENT *base = stack_base (); > > I would

Re: [New module] Persistent Hash Array Mapped Tries (HAMTs)

2020-10-10 Thread Bruno Haible
Hi Marc, > It implements a persistent version of Phil Bagwell's HAMTs, which has > been popularized by Clojure. HAMTs can be used when a persistent > (functional/pure) version of a data structure akin to hash tables is > needed. For example, the dynamic environment of a (possibly >

Re: Unused parameter warnings

2020-10-10 Thread Marc Nieper-Wißkirchen
I can ask for a better description of "pure" in the GCC manual. In any case, if a function doesn't return at all due to a function call marked with _Noreturn, it does not affect the observable state locally and GCC can avoid "emitting some calls in repeated invocations of the function with the

Re: stack module

2020-10-10 Thread Bruno Haible
Hi Marc, > please see the attached patch for the new module. Very nice. Looks all good, except for some nit-picking in the comments: > + Introspection: ELEMENT *base = stack_base (); I would add a comment here: Where ELEMENT is the type to which GL_STACK_ELEMENT was defined when

Re: Unused parameter warnings

2020-10-10 Thread Bruno Haible
Marc Nieper-Wißkirchen wrote: > > And a function that may invoke abort () does "affect observable state". > > This description of the a pure function does not seem to be accurate. > When a function calls another function like abort that is marked with > _Noreturn in a pure context, for the

Re: stack bounds

2020-10-10 Thread Bruno Haible
Hi Paul, you wrote on 2020-09-22: > I am thinking of some combination of gcc -fstack-check and/or > -fstack-clash-protection and/or related ideas (not that I've looked into all > the > details). That is, I'm expecting help from the hardware, the kernel, and from > GCC. Stack-exhaustion

Re: clang warnings in regcomp.c

2020-10-10 Thread Bruno Haible
Paul Eggert wrote: > > What is the point of these parentheses? > > Haven't a clue. It's an unusual style. > > > static reg_errcode_t preorder (bin_tree_t *root, > > - reg_errcode_t (fn (void *, bin_tree_t *)), > > + reg_errcode_t fn (void *,