Re: [musl] malloc.3: Clarify realloc(3) standards conformance

2025-06-18 Thread Rich Felker
On Thu, Jun 19, 2025 at 02:42:14AM +0200, Alejandro Colomar wrote: > Hi! > > I've applied a patch to document the conformance of realloc(3) and > reallocarray(3). See below, both the patch, and the formatted changes. > > BTW, Paul, Bruno, does gnulib also wrap reallocarray(3)? If not, it > shou

Re: string-desc: Fix a compiler warning

2025-06-18 Thread Collin Funk
Hi Bruno, Bruno Haible via Gnulib discussion list writes: > The AIX xlc compiler gives this warning: > > "../../../gettext-tools/gnulib-lib/string-desc.h", line 674.24: 1506-1332 (W) > A function with return type "void" may not return a value of type "void". > > Fixed like this: Do gcc and cla

Re: return void

2025-06-18 Thread Collin Funk
Bruno Haible writes: >> Do gcc and clang not warn about this? > > With option '-pedantic', they warn, yes: > > $ cat foo.c > extern void foobar (int); > void foo (int x) { return foobar (x); } > > $ gcc -Wall -S -pedantic foo.c > foo.c: In function ‘foo’: > foo.c:2:27: warning: ISO C forbids ‘ret

Re: return void

2025-06-18 Thread Bruno Haible via Gnulib discussion list
Collin Funk wrote: > > "../../../gettext-tools/gnulib-lib/string-desc.h", line 674.24: 1506-1332 > > (W) A function with return type "void" may not return a value of type > > "void". > > > > Fixed like this: > > Do gcc and clang not warn about this? With option '-pedantic', they warn, yes: $ c

Re: malloc.3: Clarify realloc(3) standards conformance

2025-06-18 Thread Alejandro Colomar
Hi Paul, On Wed, Jun 18, 2025 at 05:49:43PM -0700, Collin Funk wrote: > Alejandro Colomar writes: > > > BTW, Paul, Bruno, does gnulib also wrap reallocarray(3)? If not, it > > should. > > Yep, Gnulib has had it since 2017 after it was added to glibc. Thanks! Yep, now I revised the patch that

Re: malloc.3: Clarify realloc(3) standards conformance

2025-06-18 Thread Collin Funk
Alejandro Colomar writes: > BTW, Paul, Bruno, does gnulib also wrap reallocarray(3)? If not, it > should. Yep, Gnulib has had it since 2017 after it was added to glibc. Collin signature.asc Description: PGP signature

malloc.3: Clarify realloc(3) standards conformance

2025-06-18 Thread Alejandro Colomar
Hi! I've applied a patch to document the conformance of realloc(3) and reallocarray(3). See below, both the patch, and the formatted changes. BTW, Paul, Bruno, does gnulib also wrap reallocarray(3)? If not, it should. Have a lovely day! Alex --- commit 7279622113349f32428fa14467ba2aa

string-desc: Fix a compiler warning

2025-06-18 Thread Bruno Haible via Gnulib discussion list
The AIX xlc compiler gives this warning: "../../../gettext-tools/gnulib-lib/string-desc.h", line 674.24: 1506-1332 (W) A function with return type "void" may not return a value of type "void". Fixed like this: 2025-06-18 Bruno Haible string-desc: Fix a compiler warning. * l

Re: [musl] Re: BUG: realloc(p,0) should be consistent with malloc(0)

2025-06-18 Thread Alejandro Colomar
Hi Rich, Elliott, On Wed, Jun 18, 2025 at 12:35:50PM -0400, Rich Felker wrote: > On Wed, Jun 18, 2025 at 11:20:54AM -0400, enh wrote: > > On Tue, Jun 17, 2025 at 5:58 PM Alejandro Colomar wrote: > > > > > > Hi Elliott, Florian, > > > > > > glibc and Bionic are non-conforming to POSIX.1-2024. The

Re: BUG: realloc(p,0) should be consistent with malloc(0)

2025-06-18 Thread Alejandro Colomar
Hi Andreas, On Wed, Jun 18, 2025 at 05:42:40PM +0200, Andreas Schwab wrote: > On Jun 17 2025, Alejandro Colomar wrote: > > > RETURN VALUE > > > > If size is 0, > > ... > > either: > > > > - A null pointer shall be returned > >and, if ptr is not

Re: [musl] Re: BUG: realloc(p,0) should be consistent with malloc(0)

2025-06-18 Thread Rich Felker
On Wed, Jun 18, 2025 at 11:20:54AM -0400, enh wrote: > On Tue, Jun 17, 2025 at 5:58 PM Alejandro Colomar wrote: > > > > Hi Elliott, Florian, > > > > glibc and Bionic are non-conforming to POSIX.1-2024. The fix that we're > > proposing would make them conforming. Does conformance to POSIX.1-2024

Re: [musl] Re: BUG: realloc(p,0) should be consistent with malloc(0)

2025-06-18 Thread enh
On Wed, Jun 18, 2025 at 11:37 AM Thorsten Glaser wrote: > > On Wed, 18 Jun 2025, enh wrote: > > >not when POSIX screwed up and made a change that made most of the > >existing implementations non-conformant, no. that sounds like a POSIX > > “most of”? ...weighted by number of users (who could be n

Re: BUG: realloc(p,0) should be consistent with malloc(0)

2025-06-18 Thread Andreas Schwab
On Jun 17 2025, Alejandro Colomar wrote: > RETURN VALUE > > If size is 0, > ... > either: > > - A null pointer shall be returned >and, if ptr is not a null pointer, >errno shall be set to EINVAL. > > - A pointer to t

Re: [musl] Re: BUG: realloc(p,0) should be consistent with malloc(0)

2025-06-18 Thread Thorsten Glaser
On Wed, 18 Jun 2025, enh wrote: >not when POSIX screwed up and made a change that made most of the >existing implementations non-conformant, no. that sounds like a POSIX “most of”? Looks to me like most implementations already do the latter, and some might do the former, and only a minority (the

Re: [musl] Re: BUG: realloc(p,0) should be consistent with malloc(0)

2025-06-18 Thread enh
On Tue, Jun 17, 2025 at 5:58 PM Alejandro Colomar wrote: > > Hi Elliott, Florian, > > glibc and Bionic are non-conforming to POSIX.1-2024. The fix that we're > proposing would make them conforming. Does conformance to POSIX.1-2024 > mean something to you? not when POSIX screwed up and made a ch