All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH for 7.2] Fix broken configure with -Wunused-parameter
Date: Thu, 3 Nov 2022 08:58:48 +0000	[thread overview]
Message-ID: <Y2OCyLSw2hurfemT@redhat.com> (raw)
In-Reply-To: <20221102202258.456359-1-sw@weilnetz.de>

On Wed, Nov 02, 2022 at 09:22:58PM +0100, Stefan Weil via wrote:
> The configure script fails because it tries to compile small C programs
> with a main function which is declared with arguments argc and argv
> although those arguments are unused.
> 
> Running `configure -extra-cflags=-Wunused-parameter` triggers the problem.
> configure for a native build does abort but shows the error in config.log.
> A cross build configure for Windows with Debian stable aborts with an
> error.
> 
> Avoiding unused arguments fixes this.

I'm not convinced that we should allow -extra-cflags to influence
the configure compile checks at all, as there are likely more cases
where arbitrary -W$warn flag will impact the checks, potentially
causing configure to silently take the wrong action.

> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> 
> See https://gitlab.com/qemu-project/qemu/-/issues/1295.
> 
> I noticed the problem because I often compile with -Wextra.
> 
> Stefan
> 
>  configure | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index 4275f5419f..1106c04fea 100755
> --- a/configure
> +++ b/configure
> @@ -1258,6 +1258,7 @@ if test "$stack_protector" != "no"; then
>    cat > $TMPC << EOF
>  int main(int argc, char *argv[])
>  {
> +    (void)argc;
>      char arr[64], *p = arr, *c = argv[0];
>      while (*c) {
>          *p++ = *c++;
> @@ -1607,7 +1608,7 @@ fi
>  
>  if test "$safe_stack" = "yes"; then
>  cat > $TMPC << EOF
> -int main(int argc, char *argv[])
> +int main(void)
>  {
>  #if ! __has_feature(safe_stack)
>  #error SafeStack Disabled
> @@ -1629,7 +1630,7 @@ EOF
>    fi
>  else
>  cat > $TMPC << EOF
> -int main(int argc, char *argv[])
> +int main(void)
>  {
>  #if defined(__has_feature)
>  #if __has_feature(safe_stack)
> @@ -1675,7 +1676,7 @@ static const int Z = 1;
>  #define TAUT(X) ((X) == Z)
>  #define PAREN(X, Y) (X == Y)
>  #define ID(X) (X)
> -int main(int argc, char *argv[])
> +int main(void)
>  {
>      int x = 0, y = 0;
>      x = ID(x);
> -- 
> 2.30.2
> 
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2022-11-03  8:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 20:22 [PATCH for 7.2] Fix broken configure with -Wunused-parameter Stefan Weil
2022-11-02 20:22 ` Stefan Weil via
2022-11-03  8:58 ` Daniel P. Berrangé [this message]
2022-11-03  9:19   ` Stefan Weil
2022-11-03  9:19     ` Stefan Weil via
2022-11-03 17:16   ` Paolo Bonzini
2022-11-03 11:48 ` Peter Maydell
2022-11-03 12:08   ` Stefan Weil
2022-11-03 12:08     ` Stefan Weil via
2022-11-03 17:22 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y2OCyLSw2hurfemT@redhat.com \
    --to=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.