Re: new module 'vma-prot'

2024-09-02 Thread Marc Nieper-Wißkirchen
Am Mo., 2. Sept. 2024 um 13:58 Uhr schrieb Bruno Haible : > I did: > > vma-prot: Add tests. > > * tests/test-vma-prot.c: New file. > > * modules/vma-prot-tests: New file. > > Oops, I forgot some parentheses. (I will never understand why the '&' and > '|' > operators, which are mo

Re: [PATCH 2/2] libgmp-mpq: Add tests.

2024-08-29 Thread Marc Nieper-Wißkirchen
Am Do., 29. Aug. 2024 um 11:36 Uhr schrieb Bruno Haible : > Hi Marc, > > > +#ifndef MINI_GMP_LIMB_TYPE > > +/* Verify that the gmp.h header file was generated for the same > > + machine word size as we are using. */ > > +static_assert (GMP_NUMB_BITS == sizeof (mp_limb_t) * CHAR_BIT); > > +#endi

Re: [PATCH 1/2] libgmp-mpq: New module.

2024-08-29 Thread Marc Nieper-Wißkirchen
Am Do., 29. Aug. 2024 um 11:31 Uhr schrieb Bruno Haible : > Hi Marc, > > this looks good, except for two small things: > > 1) In the ChangeLog entry > > > + * lib/mini-mpq.c: New upstream source file. > > + * lib/mini-mpq.h: New upstream source file. > > I would like to see more precision

Re: Include mini-mpq

2024-08-29 Thread Marc Nieper-Wißkirchen
Am Do., 29. Aug. 2024 um 10:27 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > Shouldn't get the new module libgmp-mpz an entry in MODULES.html.sh? > > Yes, feel free to add it. I tend to update this file only occasionally. > I followed your suggestio

Re: Include mini-mpq

2024-08-29 Thread Marc Nieper-Wißkirchen
Am Mi., 28. Aug. 2024 um 14:21 Uhr schrieb Bruno Haible : [...] > Let me start with the renamings of what is already in gnulib. Then, > your additions are welcome (as two patches, please: one for the > new code in module libgmp, and one for the new tests). > > > 2024-08-28 Bruno Haible > >

Re: Include mini-mpq

2024-08-28 Thread Marc Nieper-Wißkirchen
PS Here is a suggestion for a new `mpq' module. What do you think? Am Mi., 28. Aug. 2024 um 08:41 Uhr schrieb Marc Nieper-Wißkirchen < marc.nieper+...@gmail.com>: > Hi, > > This is a request to integrate the missing parts of the mini-gmp library > into Gnulib. To be mor

Include mini-mpq

2024-08-27 Thread Marc Nieper-Wißkirchen
Hi, This is a request to integrate the missing parts of the mini-gmp library into Gnulib. To be more specific, mini-mpq is currently missing in Gnulib; see [1]. Thanks, Marc -- [1] https://gmplib.org/repo/gmp/file/tip/mini-gmp

Re: Possible UNINIT bug within man-db gl sources

2024-08-27 Thread Marc Nieper-Wißkirchen
Am Do., 22. Aug. 2024 um 07:27 Uhr schrieb Paul Eggert : > On 2024-08-21 06:36, Bruno Haible wrote: > > In summary, this paragraph makes no sense for structs. > > Hmm, well, the paragraph makes sense to me. I suppose somebody could > fire off a question to the C committee about the intent of the p

Re: Accurate reading of floating point numbers

2024-08-26 Thread Marc Nieper-Wißkirchen
Hi Bruno, Am Mo., 26. Aug. 2024 um 12:37 Uhr schrieb Bruno Haible : > Hi Marc, > > > Gnulib > > offers strtod replacements, but these refer to conversion routines of the > > host systems and may lack the accuracy described in Clinger's well-known > > paper [1] IIUC. > > > > Wouldn't it make sense

Accurate reading of floating point numbers

2024-08-26 Thread Marc Nieper-Wißkirchen
Gnulib contains modules like dtoastr that accurately convert floating point numbers to strings. For the opposite direction of conversion, Gnulib offers strtod replacements, but these refer to conversion routines of the host systems and may lack the accuracy described in Clinger's well-known paper

Re: gnulib creates tests/ directory

2024-08-17 Thread Marc Nieper-Wißkirchen
Am Sa., 17. Aug. 2024 um 15:00 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > > This is fixed now. > > > > > > > What about the shell-based gnulib tool? Or should I consider that one > > deprecated? > > Yes. The shell-based impl

Re: gnulib creates tests/ directory

2024-08-17 Thread Marc Nieper-Wißkirchen
Hi! Bruno Haible schrieb am Sa., 17. Aug. 2024, 11:14: > Hi Simon, > > > Ouch. Shouldn't we rename 'valgrind-tests' instead? > > ... > > Whatever problem appears if we rename > > 'valgrind-tests' to, say, 'valgrindtests' we could fix. > > 'valgrindtests' would be a hack. > > 'valgrind-support-f

Re: gitsub.sh hardcodes origin/master

2024-08-16 Thread Marc Nieper-Wißkirchen
Am Fr., 16. Aug. 2024 um 20:51 Uhr schrieb Collin Funk < collin.fu...@gmail.com>: > Hi Marc, > > Marc Nieper-Wißkirchen writes: > > > ./gitsub.sh upgrade > > > > fails when submodules are present where the master branch is not called > > "master&

Re: gnulib creates tests/ directory

2024-08-16 Thread Marc Nieper-Wißkirchen
ts in liboath/ and libpskc/ of oath-toolkit. > Thank you for the patch. I can confirm that the problem has been fixed when using GNULIB_TOOL_IMPL=py and is still present when using GNULIB_TOOL_IMPL=sh. Best wishes, Marc > 2024-08-16 Bruno Haible > > gnulib-t

gitsub.sh hardcodes origin/master

2024-08-16 Thread Marc Nieper-Wißkirchen
Hi! Running ./gitsub.sh upgrade fails when submodules are present where the master branch is not called "master" but something else, e.g. "main", which becomes increasingly common. The branch name "origin/master" is currently hardcoded in gitsub.sh. Thanks, Marc

gnulib creates tests/ directory

2024-08-15 Thread Marc Nieper-Wißkirchen
Hi! Although I don't use gnulib with '--with-tests', it does create a tests/ directory during bootstrap and fills it with a few files. I attached my gnulib-cache.m4. Do you think I can prevent gnulib from creating the directory? Did I include some module that makes it create the directory, or d

Re: Parameterize the memory allocator for the container library

2024-02-15 Thread Marc Nieper-Wißkirchen
Hi, If I may chime into the discussion, let me remark that local parameterization of the memory allocator is often useful (while the linker approach means a global replacement). For example, part of the program/library may work with an arena allocator (see, e.g. [1] for a general discussion) and

Re: new module 'jit/cache'

2023-12-20 Thread Marc Nieper-Wißkirchen
Do you have detailed test results/logs? Thanks, Marc Am Di., 19. Dez. 2023 um 23:13 Uhr schrieb Bruno Haible : > My (preliminary) test results: > > The test passes on x86_64, m68k, alpha, s390, s390x, riscv64, loongarch64. > > It fails on some platforms with i386, mips, sparc, arm, arm64 > > It

Re: pointer addition and arrays

2023-12-17 Thread Marc Nieper-Wißkirchen
Am So., 17. Dez. 2023 um 09:50 Uhr schrieb Paul Eggert : > On 2023-12-16 04:42, Marc Nieper-Wißkirchen wrote: > > the problem is if further down in the compiler pipeline, the > > P <= P expression produces some intermediate code that becomes equal to > > code the opt

Re: pointer addition and arrays

2023-12-16 Thread Marc Nieper-Wißkirchen
Am Fr., 15. Dez. 2023 um 02:00 Uhr schrieb Paul Eggert : > On 12/3/23 05:15, Andreas F. Borchert wrote: > > You will have > > then to possibly live with annoying warnings and odd behaviours. > > The C standard says that when P is a null pointer, P==P must be true > whereas P<=P has undefined behav

Re: undefined-behavior obstack.c:139

2023-12-03 Thread Marc Nieper-Wißkirchen
Am So., 3. Dez. 2023 um 10:05 Uhr schrieb Paul Eggert : > On 2023-12-02 01:04, Bruno Haible wrote: > > On the contrary, I will try to find and eliminate such alarms. > > Please don't complicate and/or slow down shared Gnulib code just to > pacify this particular false alarm from Clang. The obstack

Re: undefined-behavior obstack.c:139

2023-12-01 Thread Marc Nieper-Wißkirchen
Am Fr., 1. Dez. 2023 um 21:01 Uhr schrieb Paul Eggert : > On 2023-12-01 10:40, Bruno Haible wrote: > > > Indeed, this sentence appears to forbid ((char *) NULL) + something. > > Yes. However, Gnulib code can still use ((char *) NULL) + something) > because the Gnulib portability guidelines allow i

Re: undefined-behavior obstack.c:139

2023-12-01 Thread Marc Nieper-Wißkirchen
Am Fr., 1. Dez. 2023 um 19:42 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > By 6.5.6 "Additive Operators": > > > > (2) "... one operator shall be a pointer to a complete object type..." > > > > NULL, which is a null pointer con

Re: undefined-behavior obstack.c:139

2023-12-01 Thread Marc Nieper-Wißkirchen
By 6.5.6 "Additive Operators": (2) "... one operator shall be a pointer to a complete object type..." NULL, which is a null pointer constant, is not necessarily a pointer to a complete object type. (9) "... If the pointer operand and the result do not point to elements of the same array object o

Re: new module 'jit/cache'

2023-11-28 Thread Marc Nieper-Wißkirchen
I forgot to actually make use of the patched part in the test case; here is the full patch. Please excuse the mess. Am Mo., 27. Nov. 2023 um 18:36 Uhr schrieb Marc Nieper-Wißkirchen < marc.nieper+...@gmail.com>: > Am Mo., 27. Nov. 2023 um 17:27 Uhr schrieb Marc Nieper-W

Re: new module 'jit/cache'

2023-11-27 Thread Marc Nieper-Wißkirchen
Am Mo., 27. Nov. 2023 um 17:27 Uhr schrieb Marc Nieper-Wißkirchen < marc.nieper+...@gmail.com>: [...] > For the moment, I expect >> - a SIGSEGV on powerpc*-aix, powerpc64-linux, ia64, hppa, and hppa64 >> due to the structure of function pointers, see >> >

[PATCH] stack: Fix documentation in header file.

2023-11-27 Thread Marc Nieper-Wißkirchen
Marc Nieper-Wißkirchen + + stack: Fix documentation in header file. + * lib/stack.h: Correct documentation on `stack_current_base'. + 2023-11-27 Marc Nieper-Wißkirchen jit/cache-tests: Fix include guard. diff --git a/lib/stack.h b/lib/stack.h index dbd6812bc8..91b1944

[PATCH] jit/cache-tests: Fix include guard.

2023-11-27 Thread Marc Nieper-Wißkirchen
+1,8 @@ +2023-11-27 Marc Nieper-Wißkirchen + + jit/cache-tests: Fix include guard. + * tests/jit/test-cache.c (main): Extend range of include guard. + 2023-11-25 Marc Nieper-Wißkirchen jit/cache-tests: New module. diff --git a/tests/jit/test-cache.c b/tests/jit/test

Re: new module 'jit/cache'

2023-11-27 Thread Marc Nieper-Wißkirchen
Am Sa., 25. Nov. 2023 um 21:19 Uhr schrieb Bruno Haible : > Hello Marc, > > > Here is my attempt at a simple unit test for your new cache module. > > > > I have tested it on an x86 box (where the instruction cache is always in > > sync) and on an Armv8 Raspberry, both running GNU/Linux. Commentin

Re: new module 'jit/cache'

2023-11-25 Thread Marc Nieper-Wißkirchen
--- ChangeLog | 9 + m4/valgrind-helper.m4 | 3 +- modules/jit/cache-tests | 20 +++ tests/jit/test-cache.c | 77 + 4 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 modules/jit/cache-tests create mode 100644 tests/jit/test-cache.c diff --git

Re: test environments

2023-11-14 Thread Marc Nieper-Wißkirchen
Hi Bruno, Thanks for making your module available. I have acquired a Raspberry Pi with an ARMv8, so as soon as my time permits, I should be able to do some testing. Marc Am Mo., 13. Nov. 2023 um 00:10 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > I only have access

Re: Provide a module for `clear_cache'

2023-11-06 Thread Marc Nieper-Wißkirchen
Hello Bruno, Am Mo., 6. Nov. 2023 um 19:33 Uhr schrieb Bruno Haible : [...] I can provide such a thing easily. In fact, I have it already sitting > around on my disk since 2021 :-) > This is great! > > GNU > > lightning currently calls libgcc's `__clear_cache' directly ([1]), but > this > > w

Provide a module for `clear_cache'

2023-11-06 Thread Marc Nieper-Wißkirchen
The idea is to offer the builtin procedure __builtin__clear_cache (void *begin, void *end), which is provided at least by gcc and clang, in a portable manner. From the documentation of gcc's version: "This function is used to flush the processor’s instruction cache for the region of memory betw

Re: How to fix code blocks?

2023-01-02 Thread Marc Nieper-Wißkirchen
Happy new year, Bruno! Yes, sorry, wrong list! :) Marc Am Mo., 2. Jan. 2023 um 15:42 Uhr schrieb Bruno Haible : > > Hi Marc, > > > For purposes of dynamically calling code, I need the following layout > > of the assembled code: > > > > 0x00: 16-byte header > > 0x10: entry point #1 > > 0x20: entr

How to fix code blocks?

2023-01-02 Thread Marc Nieper-Wißkirchen
For purposes of dynamically calling code, I need the following layout of the assembled code: 0x00: 16-byte header 0x10: entry point #1 0x20: entry point #2 I want to use the new align/skip instructions for this. My code generator currently looks like this: align (16) header: ski

[PATCH] hamt: fix technically undefined behavior

2022-08-12 Thread Marc Nieper-Wißkirchen
rtions(+) diff --git a/ChangeLog b/ChangeLog index ccf4acd03..0d04cb70e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2022-08-12 Marc Nieper-Wißkirchen + + hamt: fix technically undefined behavior + Bug reported by Bruno Haible in + <https://lists.gnu.org/r/bug-gnuli

Re: undefined behaviour in hamt.c

2022-04-14 Thread Marc Nieper-Wißkirchen
Hi Bruno, thanks for exhibiting this. The complaint by the UB sanitizer is correct. Although the code won't use the 64-bit value shifted by 65, it is technically UB. When I wrote the code, I erroneously assumed that it would not be UB, but that the result of the shift would be implementation-depen

Re: Module idx

2022-04-13 Thread Marc Nieper-Wißkirchen
Bruno, Paul, thank you for your responses. So for a universal solution, one would have to teach first the i18n toolchain how to interpret general PRIxxx macros. Am Mi., 13. Apr. 2022 um 09:05 Uhr schrieb Paul Eggert : > > On 4/12/22 02:12, Marc Nieper-Wißkirchen wrote: > > I am wond

Module idx

2022-04-12 Thread Marc Nieper-Wißkirchen
I am wondering how to print (using printf) values of type idx_t reliably without assuming that idx_t == ptrdiff_t and without conversion to uintptr_t. Would it make sense to add PRIxxx and SCNxxx macros (as those found in inttypes.h) to idx.h? Thanks, Marc

Re: and C++

2022-01-08 Thread Marc Nieper-Wißkirchen
Am Sa., 8. Jan. 2022 um 11:51 Uhr schrieb Bruno Haible : > > Marc Nieper-Wißkirchen wrote: > > I submitted a patch. An email will follow. > > Ah, you already pushed it. Good! My workflow is not optimized yet. Pushing and sending out the email with the patch has to happen in two steps.

[PATCH 1/1] c-stack: Adapt header file for use in C++ applications.

2022-01-08 Thread Marc Nieper-Wißkirchen
* lib/c-stack.h: Add extern "C" block. --- ChangeLog | 5 + lib/c-stack.h | 8 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index ad525f531..64d70fd41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2022-01-08 Marc Nieper-Wißkirchen +

[PATCH 1/1] version-etc: Adapt header file for use in C++ applications.

2022-01-08 Thread Marc Nieper-Wißkirchen
* lib/version-etc.h: Add extern "C" block. --- ChangeLog | 5 + lib/version-etc.h | 9 + 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 60ca624f1..ad525f531 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2022-01-08 Marc Nieper-

Re: and C++

2022-01-08 Thread Marc Nieper-Wißkirchen
Am Fr., 7. Jan. 2022 um 21:54 Uhr schrieb Bruno Haible : > > Marc Nieper-Wißkirchen wrote: > > I just noticed that doesn't include extern "C" guards > > so that inclusion in a C++ source file becomes easier (see 4.2 in the > > Gnulib manual). > >

and C++

2022-01-07 Thread Marc Nieper-Wißkirchen
I just noticed that doesn't include extern "C" guards so that inclusion in a C++ source file becomes easier (see 4.2 in the Gnulib manual). I don't know what the general policy is, but including in a C++ makes sense to me and could be made easier. Marc PS I haven't systematically checked other

Re: Bytewise u??_conv_from_encoding

2022-01-06 Thread Marc Nieper-Wißkirchen
Am Mi., 5. Jan. 2022 um 21:59 Uhr schrieb Bruno Haible : > > Hello Marc, > [...] > > If I understand your classification correctly, I meant something more > > like (E) than (D), I think. As an interface, I would propose would be > > something along the following lines: > > > > decoder_t d = decod

Re: Stack module and -Wsign-compare

2022-01-06 Thread Marc Nieper-Wißkirchen
Thank you, Paul. My local tests also show that it behaves better now. Am Mi., 5. Jan. 2022 um 20:54 Uhr schrieb Paul Eggert : > > On 1/5/22 10:00, Bruno Haible wrote: > > Another possible fix would be to change > >size_t size; > > to > >idx_t size; > > in the struct. > > Yes, that fits bet

Stack module and -Wsign-compare

2022-01-05 Thread Marc Nieper-Wißkirchen
Commit 3dc36216f168f4e752b648b19d85eab32a037827 by Paul Eggert introduced a regression in the stack module. If "stack.h" is included by client code that is supposed to be compiled with "-Wsign-compare", the compiler will complain about the comparison on line 121. There wasn't a problem before com

Re: [striconveh] Error handling and Unicode replacement character

2022-01-05 Thread Marc Nieper-Wißkirchen
Dear Bruno, thank you for responding so quickly and for this addition! Marc Am Sa., 1. Jan. 2022 um 19:55 Uhr schrieb Bruno Haible : > > Marc Nieper-Wißkirchen wrote on 2021-12-30: > > The striconveh module and related modules offer an error handler > > argument. The current p

Re: Bytewise u??_conv_from_encoding

2022-01-01 Thread Marc Nieper-Wißkirchen
Hi Bruno, thanks for your insights, valuable as always. Am Sa., 1. Jan. 2022 um 13:57 Uhr schrieb Bruno Haible : > > Hi Marc, > > > The demand to read a file (in local encoding) and to decode it > > incrementally seems a typical one. > > There are four ways to satisfy this demand. > > (A) Using a

Bytewise u??_conv_from_encoding

2022-01-01 Thread Marc Nieper-Wißkirchen
The demand to read a file (in local encoding) and to decode it incrementally seems a typical one. With Gnulib, this can be done using the mbfile module to read in the multibytes byte-by-byte and then using the striconveh module to decode the multibytes in, say, UTF-8 or UTF-32. This, however, doe

[striconveh] Error handling and Unicode replacement character

2021-12-30 Thread Marc Nieper-Wißkirchen
The striconveh module and related modules offer an error handler argument. The current possible values are: iconveh_error iconveh_question_mark iconveh_escape_sequence The second option replaces any unconvertible character with a question mark "?". I would like to request to add a fourth option,

Re: Non-recursive Make and prefix-gnulib-mk

2021-12-16 Thread Marc Nieper-Wißkirchen
Thanks for the tips! It's working perfectly now. Marc Am Do., 16. Dez. 2021 um 18:08 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > Am I supposed to set ${gl_source_base_prefix} somewhere? > > No. gnulib-tool defines gl_source_base_prefix as appropriate

Re: Non-recursive Make and prefix-gnulib-mk

2021-12-16 Thread Marc Nieper-Wißkirchen
based on bootstrap and I have set source_base (and tests_base) in bootstrap.conf. Thanks, Marc Am Mi., 15. Dez. 2021 um 22:43 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > I'm using build-aux/prefix-gnulib-mk to rewrite the Gnulib Makefile > > fragment so tha

Non-recursive Make and prefix-gnulib-mk

2021-12-11 Thread Marc Nieper-Wißkirchen
Hi, I'm using build-aux/prefix-gnulib-mk to rewrite the Gnulib Makefile fragment so that it can be included by a Makefile in a top-level directory. What I haven't managed to get working, though, is renaming the Gnulib lib/ directory at the same time (by setting $source_base in bootstrap.conf). Th

Re: Signaling NaNs

2021-12-09 Thread Marc Nieper-Wißkirchen
Hi Bruno, thanks for replying so quickly! My intention is neither to feed the signaling NaN into floating-point operations nor to cause it an exception to be raised. What I really want to do is to model a type whose value is either a floating-point number (including infinities and the NaNs retur

Signaling NaNs

2021-12-09 Thread Marc Nieper-Wißkirchen
Hi, I have been searching through the list of modules but haven't been able to find it: Does Gnulib offer a way to store a signaling NaN in a memory location (if supported by the platform) and some way to check a memory location whether it contains a signaling NaN? The forthcoming C2x standard w

Inline warnings in gl_xlist.h

2021-07-21 Thread Marc Nieper-Wißkirchen
When compiling my code with "-Winline", I suddenly get a warning from calling gl_list_add_last: "Call is unlikely and code size would grow." Is there a way to suppress this warning using Gnulib or can the inline functions of gl_xlist.h be implemented in a way so that this warning cannot show up?

Re: Module suggestion: timeout

2021-04-30 Thread Marc Nieper-Wißkirchen
, ...). Am Fr., 30. Apr. 2021 um 11:43 Uhr schrieb Simon Josefsson < si...@josefsson.org>: > Marc Nieper-Wißkirchen writes: > > > Moreover, use cases for a baked-in timeout are not restricted to tests. > For > > example, I may want to restrict the build time of certain c

Re: Module suggestion: timeout

2021-04-30 Thread Marc Nieper-Wißkirchen
Dear Bruno, dear Simon, thank you for your replies. I understand that valgrind-tests and the proposed "timeout-tests" solution are not completely equivalent. Nevertheless, I still think that some timeout functionality provided by Gnulib would be useful. Bruno's solution ** #if HAVE_DECL_ALARM

Module suggestion

2021-04-29 Thread Marc Nieper-Wißkirchen
Gnulib contains a module named valgrind that allows the easy use of Valgrind for tests whenever it is supported by the build system. I would suggest to add a similar module named timeout that sets the variable TIMEOUT with suitable defaults whenever the GNU coreutils timeout program (or an equival

Fwd: guile-devel Digest, Vol 221, Issue 18

2021-04-28 Thread Marc Nieper-Wißkirchen
Hi! In Guile's digest I noticed a comment about replacing libltdl (see below) with the standard `dlopen' interface and providing a shim for systems not supporting it directly. Do Guile's observations apply in general? Would it make sense for the Gnulib project to provide such a shimmed version of

Re: Autogenerated header files not included in .gitignore

2021-04-16 Thread Marc Nieper-Wißkirchen
behavior to the other but that, in principle, a developer can decide to switch to in-tree builds by touching such a file locally. Am Fr., 9. Apr. 2021 um 13:16 Uhr schrieb Marc Nieper-Wißkirchen < marc.nieper+...@gmail.com>: > I have been experimenting a bit with building in a dedicated

Re: Autogenerated header files not included in .gitignore

2021-04-09 Thread Marc Nieper-Wißkirchen
_open-osf.h lib/iconv_open-solaris.h lib/iconv_open-zos.h Thanks, Marc Am Sa., 3. Apr. 2021 um 12:22 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > Would it do much harm if ".gitignore" included all built files even for > > developers that work in a

Re: xalloc.h use idx_t

2021-04-07 Thread Marc Nieper-Wißkirchen
xalloc is now called with a size_t argument. If the argument type is silently changed to an idx_t, existing code which calls the new xalloc still with a size_t argument will trigger a compiler warning under GCC's -Wsign-conversion. Fixing existing code isn't easy because the sizeof operator return

Re: Modules xsize and idx

2021-04-07 Thread Marc Nieper-Wißkirchen
Hi Bruno, thanks for replying so quickly. Let's assume I have a procedure void *foo_create (size_t n) { void *foo = malloc (a + n * b); if (foo == NULL) ...; ... return foo; } I want 'foo_create' to handle possible overflows. To me, it seems that should use the xsize module for this and

Modules xsize and idx

2021-04-07 Thread Marc Nieper-Wißkirchen
What is the relationship between these two modules? Both try to minimize subtle bugs due to overflow. However, both approaches cannot be easily combined as xsize expects unsigned integers while idx is a signed one. What is the suggested use of these modules for new code? Thanks, Marc

Re: gl_list API

2021-04-06 Thread Marc Nieper-Wißkirchen
Am Di., 6. Apr. 2021 um 23:04 Uhr schrieb Bruno Haible : > > > But when designing a general utility, for all kinds of programs to use, > > > it is inappropriate to say "storing null elements is not useful". > > > > I'm afraid we'll have to disagree here. > > In some of my uses of the gl_list modul

Re: Type-safe typecasts

2021-04-06 Thread Marc Nieper-Wißkirchen
list_iterator_t iter, gl_list_node_t *node_ptr) { void *e; return gl_list_iterator_next (iter, &e, node_ptr) ? e : NULL; } to the global API (modulo a better name for the procedure). Am Di., 6. Apr. 2021 um 21:20 Uhr schrieb Paul Eggert : > On 4/6/21 12:13 PM, M

Re: New function xpalloc in module xalloc

2021-04-06 Thread Marc Nieper-Wißkirchen
Am Di., 6. Apr. 2021 um 21:05 Uhr schrieb Paul Eggert : > On 4/5/21 11:48 PM, Marc Nieper-Wißkirchen wrote: > > SIZE_MAX < (uintmax_t) nbytes > > Eeuuw! That's a cure worse than the disease. Among other things, there > is no guarantee that PTRDIFF_MAX <= UINTMAX_MAX

Re: Type-safe typecasts

2021-04-06 Thread Marc Nieper-Wißkirchen
Hi Paul, thanks! By the way, the snippet you gave is not portable C code, as it assumes > that 'void *' and 'struct foo *' have the same machine representation. > This is not necessarily true on (admittedly now-rare) machines that have > different flavors of pointers. I suspect the main problem h

Type-safe typecasts

2021-04-06 Thread Marc Nieper-Wißkirchen
Hi, I have been wondering whether it makes sense to add a small utility trying to make typecasts in C as type-safe as possible. The problem is that typecasts are sometimes unavoidable. For an example, let's take a look at the following snippet using Gnulib's xlist module: struct foo { int bar

Re: New function xpalloc in module xalloc

2021-04-05 Thread Marc Nieper-Wißkirchen
Hi Paul, Am Di., 6. Apr. 2021 um 05:19 Uhr schrieb Paul Eggert : > On 4/3/21 11:17 PM, Marc Nieper-Wißkirchen wrote: > > Does the comparison make any sense, by the way? > > Yes, although it's needed only on unusual (and these days perhaps > theoretical?) platforms where

[PATCH 1/1] hamt: Fix coding errors.

2021-04-05 Thread Marc Nieper-Wißkirchen
From: Marc Nieper-Wißkirchen Reported by Bruno Haible in <https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00047.html> after a Coverity run. * lib/hamt.c (bucket_do_while, hamt_iterator): Add missing derefencing operator and silence a bogus warning on uninitialized variables. *

Re: [PATCH] hamt: New module.

2021-04-05 Thread Marc Nieper-Wißkirchen
Hi Bruno, Am Mo., 5. Apr. 2021 um 15:02 Uhr schrieb Bruno Haible : > Hi Marc, > > > * tests/test-hamt.c: New file. > > Can you please have a quick look whether these Coverity findings (from our > weekly Coverity run) are relevant? > Coverity seems to be a good tool. I haven't yet tested GCC's ne

Re: Node to first or last element of a sequential list in module list/xlist

2021-04-05 Thread Marc Nieper-Wißkirchen
Hi Bruno, Am Mo., 5. Apr. 2021 um 04:45 Uhr schrieb Bruno Haible : > [Adding back bug-gnulib in CC.] > Thanks! > > Is there a fundamental reason why a list walking algorithm that both > > inserts and removes items is not possible with an arbitrary Gnulib list > > container? Obviously, the curr

[PATCH 1/1] hamt: Document the module in the Gnulib manual.

2021-04-04 Thread Marc Nieper-Wißkirchen
From: Marc Nieper-Wißkirchen Suggested by Bruno Haible in <https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00026.html>. * doc/containers.texi: Add a subsection to section 15.11 Container data types. * lib/hamt.h: Improve documentation on how Hamt_entry is supposed to b

Re: New function xpalloc in module xalloc

2021-04-03 Thread Marc Nieper-Wißkirchen
warning and to make it explicit. Am So., 4. Apr. 2021 um 08:24 Uhr schrieb Jeffrey Walton : > On Sun, Apr 4, 2021 at 2:17 AM Marc Nieper-Wißkirchen > wrote: > > > > GCC prints the following warning when compiling the new code: > > > > lib/xmalloc.c: In fun

New function xpalloc in module xalloc

2021-04-03 Thread Marc Nieper-Wißkirchen
GCC prints the following warning when compiling the new code: lib/xmalloc.c: In function 'xpalloc': lib/xmalloc.c:132:64: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'idx_t' {aka 'long int'} [-Wsign-compare] 132 | = ((INT_MULTIPLY_WRAPV (n, ite

Re: [PATCH] hamt: New module.

2021-04-03 Thread Marc Nieper-Wißkirchen
Hi Bruno, thank you very much for all the helpful feedback. I have incorporated your suggestions, and you can find an updated diff below. Thanks, Marc diff --git a/doc/containers.texi b/doc/containers.texi index 15c915b93..9bc1ae43d 100644 --- a/doc/containers.texi +++ b/doc/containers.texi @@

Re: [PATCH] hamt: New module.

2021-04-03 Thread Marc Nieper-Wißkirchen
Hi Bruno, what do you think of the attempt attached below? Thanks, Marc diff --git a/doc/containers.texi b/doc/containers.texi index 15c915b93..35caf200c 100644 --- a/doc/containers.texi +++ b/doc/containers.texi @@ -35,6 +35,9 @@ log Gnulib provides several generic container data types. They

Re: Node to first or last element of a sequential list in module list/xlist

2021-04-03 Thread Marc Nieper-Wißkirchen
Hi Bruno, thank you very much! Am Sa., 3. Apr. 2021 um 18:28 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > For example, given a list of fruits, insert "pear" after each "apple" and > > "peach" before each "apple".

Re: Node to first or last element of a sequential list in module list/xlist

2021-04-03 Thread Marc Nieper-Wißkirchen
Am Sa., 3. Apr. 2021 um 12:14 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > > > > I don't understand. You want to use a list_node_t while adding > nodes to > > > > > the list? This is invalid, since the comments in gl_list.h say: >

Re: Autogenerated header files not included in .gitignore

2021-04-03 Thread Marc Nieper-Wißkirchen
Hi Bruno, Am Sa., 3. Apr. 2021 um 12:05 Uhr schrieb Bruno Haible : > Hi Marc, > > > If Gnulib is going to be extended to support the second option as well > > That's what I'm suggesting, because the second way to manage files appears > to be the majority one. > > > I am not yet sure how. The prob

Re: Node to first or last element of a sequential list in module list/xlist

2021-04-03 Thread Marc Nieper-Wißkirchen
Am Sa., 3. Apr. 2021 um 11:49 Uhr schrieb Bruno Haible : > Marc Nieper-Wißkirchen wrote: > > > I don't understand. You want to use a list_node_t while adding nodes to > > > the list? This is invalid, since the comments in gl_list.h say: > > > > > &g

[PATCH] hamt: New module.

2021-04-03 Thread Marc Nieper-Wißkirchen
From: Marc Nieper-Wißkirchen This module provides (persistent) hash array mapped tries. * MODULES.html.sh: Add hamt. * lib/hamt.c: New file. * lib/hamt.h: New file. * modules/hamt: New file. * modules/hamt-tests: New file. * tests/test-hamt.c: New file. --- ChangeLog | 11

Re: Non-opaque hamt type?

2021-04-03 Thread Marc Nieper-Wißkirchen
!= new_hamt" the element has been inserted and has now to eventually free "new_hamt" besides "old_hamt". After I have rebased my code to HEAD, I will commit the new module to Gnulib. Thank you for your patience. Marc Am So., 18. Okt. 2020 um 20:11 Uhr schrieb Marc Niepe

Re: Node to first or last element of a sequential list in module list/xlist

2021-04-03 Thread Marc Nieper-Wißkirchen
Hi, Am Sa., 3. Apr. 2021 um 00:49 Uhr schrieb Bruno Haible : > This is useful if the list has to be traversed while nodes are added > > because an iterator cannot be used here. > > I don't understand. You want to use a list_node_t while adding nodes to > the list? This is invalid, since the comme

Re: Autogenerated header files not included in .gitignore

2021-04-02 Thread Marc Nieper-Wißkirchen
Hi Bruno, thank you very much for your prompt reply. Am Sa., 3. Apr. 2021 um 01:00 Uhr schrieb Bruno Haible : As far as I know, there are two practices regarding .gitignore management: > > * Some developers want a very clean source directory at all times. > They always to VPATH builds. The

Autogenerated header files not included in .gitignore

2021-04-02 Thread Marc Nieper-Wißkirchen
A number of autogenerated header files are not added to ".gitignore" in "$source_base". For example, in a current project of mine, $ git status shows lib/alloca.h lib/fcntl.h lib/inttypes.h lib/langinfo.h lib/limits.h lib/locale.h lib/signal.h lib/stdio.h lib/stdlib.h lib/string.h lib/sys/ lib/

Node to first or last element of a sequential list in module list/xlist

2021-04-02 Thread Marc Nieper-Wißkirchen
Hi! At the moment, there does not seem to be an easy way to retrieve the node of the first or the last element in a list. This is useful if the list has to be traversed while nodes are added because an iterator cannot be used here. What is currently possible is to use get_first/set_first (and ge

Re: Non-opaque hamt type?

2020-10-18 Thread Marc Nieper-Wißkirchen
Okay, if you find the latter protocol better anyway, I will switch to this protocol, and hamts will be stack-allocated (just two words) and passed by value. Thanks, Marc Am So., 18. Okt. 2020 um 19:58 Uhr schrieb Bruno Haible : > > Marc Nieper-Wißkirchen wrote: > > The existing pr

Re: Non-opaque hamt type?

2020-10-18 Thread Marc Nieper-Wißkirchen
Am So., 18. Okt. 2020 um 16:39 Uhr schrieb Bruno Haible : > > Hi Marc, > > > At the moment, the header file exposes an opaque struct Hamt and > > communication with the code happens through (stack-allocated) pointers > > to a Hamt. In the implementation, however, each Hamt just consists of > > two

Re: Non-opaque hamt type?

2020-10-11 Thread Marc Nieper-Wißkirchen
One final issue (I hope): At the moment, the header file exposes an opaque struct Hamt and communication with the code happens through (stack-allocated) pointers to a Hamt. In the implementation, however, each Hamt just consists of two pointers (a pointer to a function table and a pointer to the r

Re: Draft #3 (with iterators)

2020-10-11 Thread Marc Nieper-Wißkirchen
compilers. * Implement purely non-pure hamts to replace ordinary hash tables. * Add _nx versions of the procedures that won't call xalloc_die. Many thanks to Bruno for his support, guidance and his great suggestions. Marc Am So., 11. Okt. 2020 um 19:32 Uhr schrieb Marc Nieper-Wißkirchen : >

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

2020-10-11 Thread Marc Nieper-Wißkirchen
Am So., 11. Okt. 2020 um 10:20 Uhr schrieb Marc Nieper-Wißkirchen : > > Am So., 11. Okt. 2020 um 03:28 Uhr schrieb Bruno Haible : [...] > > * hamt_lookup: If the caller is allowed to modify the payload stored in the > > returned entry, this function should return a &#x

Re: terminology

2020-10-11 Thread Marc Nieper-Wißkirchen
Am So., 11. Okt. 2020 um 16:14 Uhr schrieb Bruno Haible : > > Hi Marc, > > > I have attached an improved version of the HAMT module to this email. > > How about terminology: "delete" vs. "remove"? > In this sense, 'hamt_delete' is triggering the wrong associations. > How about renaming 'hamt_remov

Re: HAMT iterators

2020-10-11 Thread Marc Nieper-Wißkirchen
Am So., 11. Okt. 2020 um 12:29 Uhr schrieb Bruno Haible : > The recursion across hamt_do_while / entry_do_while / subtrie_do_while / > bucket_do_while builds up a stack whose essential contents is a set of > indices, each at most 5 bits large, with a total of SIZE_WIDTH bits. > In other words, the

Re: HAMT iterator

2020-10-11 Thread Marc Nieper-Wißkirchen
Am So., 11. Okt. 2020 um 14:04 Uhr schrieb Bruno Haible : > > Marc Nieper-Wißkirchen wrote: > > > > /* Return an independent copy of ITER that is initially in the same > > > >state. */ > > > > extern Hamt_iterator *hamt_iterator_copy (Hamt_iterator *

Re: HAMT iterator

2020-10-11 Thread Marc Nieper-Wißkirchen
Am So., 11. Okt. 2020 um 14:14 Uhr schrieb Bruno Haible : [...] > > > > /* Return an independent copy of ITER that is initially in the same > > > >state. */ > > > > extern Hamt_iterator *hamt_iterator_copy (Hamt_iterator *iter); > > > > > > Then a copy function is not needed, because the use

Re: out-of-memory handling

2020-10-11 Thread Marc Nieper-Wißkirchen
Am So., 11. Okt. 2020 um 13:56 Uhr schrieb Bruno Haible : > > Marc Nieper-Wißkirchen wrote: > > I am not so convinced of whether it makes sense to create a > > gl_set/gl_map frontend for this hamt implementation. > > Wikipedia [1] lists some advantages of HAMTs even

  1   2   >