qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 16/17] configure: Prohibit alloca() by using -Walloca CPPF


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v3 16/17] configure: Prohibit alloca() by using -Walloca CPPFLAG
Date: Fri, 7 May 2021 19:14:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 5/7/21 4:43 PM, Philippe Mathieu-Daudé wrote:
> Now that we removed all alloca() calls in the repository, add the
> -Walloca CPPFLAG to trigger a build failure if such stack allocation
> is used.
> 
> Rationale: The ALLOCA(3) man-page mentions its "use is discouraged".
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> As there is an alloca() call in libslirp, this patch is pending
> on the following libslirp patch to be merged:
> https://lists.freedesktop.org/archives/slirp/2021-May/000150.html
> (and the submodule updated).
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 4f374b48890..67cb6d5421c 100755
> --- a/configure
> +++ b/configure
> @@ -552,7 +552,7 @@ ARFLAGS="${ARFLAGS-rv}"
>  # provides these semantics.)
>  QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
>  QEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
> -QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
> +QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls -Walloca $QEMU_CFLAGS"
>  QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
> $QEMU_CFLAGS"

Sigh I forgot one Clang version (7.0.1) doesn't recognize this warning.

I'll replace this patch by:

-- >8 --
diff --git a/configure b/configure
index 4f374b48890..4330245fa1f 100755
--- a/configure
+++ b/configure
@@ -2083,2 +2083,3 @@ add_to warn_flags -Wexpansion-to-defined
 add_to warn_flags -Wimplicit-fallthrough=2
+add_to warn_flags -Walloca

---

Regards,

Phil.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]