Hi! On 2024-08-31T06:26:02+0000, "WHR" <[email protected]> wrote: > As GCC now treating implicit declaration of function as an error instead of > warning, compilation of libssp has been broken on some operating systems. > The following error is from an x86_64-unknown-freebsd11 system: > > libssp/ssp.c: In function 'fail': > libssp/ssp.c:134:17: error: implicit declaration of function 'alloca' > [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration^G-Wimplicit-function-declaration8;;^G] > 134 | p = buf = alloca (len); > | ^~~~~~ > > Most operating systems specifies that 'stdlib.h' should be included to get > the declaration of alloca(3).
> --- a/libssp/ssp.c > +++ b/libssp/ssp.c > @@ -39,6 +39,9 @@ > #ifdef HAVE_MALLOC_H > # include <malloc.h> > #endif > +#ifdef HAVE_STDLIB_H > +# include <stdlib.h> > +#endif > #ifdef HAVE_STRING_H > # include <string.h> > #endif While getting GCC to build on OpenBSD (cfarm220), I had just independently developed the same fix. Then, I found you had already submitted this patch here, thanks! I've now pushed this to trunk in commit 7c3add671b5deddb69b2fca3c489e2a06ddd4f90 "libssp: Include 'stdlib.h' for using alloca(3) [PR116547]", see attached. Grüße Thomas
>From 7c3add671b5deddb69b2fca3c489e2a06ddd4f90 Mon Sep 17 00:00:00 2001 From: WHR <[email protected]> Date: Sat, 31 Aug 2024 06:26:02 +0000 Subject: [PATCH] libssp: Include 'stdlib.h' for using alloca(3) [PR116547] As GCC now treating implicit declaration of function as an error instead of warning, compilation of libssp has been broken on some operating systems. The following error is from an x86_64-unknown-freebsd11 system: [...]/libssp/ssp.c: In function 'fail': [...]/libssp/ssp.c:134:17: error: implicit declaration of function 'alloca' [-Wimplicit-function-declaration] 134 | p = buf = alloca (len); | ^~~~~~ Similarly: amd64-unknown-openbsd7.9. Most operating systems specifies that 'stdlib.h' should be included to get the declaration of alloca(3). PR other/116547 * ssp.c: Include stdlib.h for alloca(3). Co-authored-by: Thomas Schwinge <[email protected]> --- libssp/ssp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libssp/ssp.c b/libssp/ssp.c index 47abdf4e13d..04c13e46cd7 100644 --- a/libssp/ssp.c +++ b/libssp/ssp.c @@ -39,6 +39,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #ifdef HAVE_MALLOC_H # include <malloc.h> #endif +#ifdef HAVE_STDLIB_H +# include <stdlib.h> +#endif #ifdef HAVE_STRING_H # include <string.h> #endif -- 2.53.0
