[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/12] Fix broken configure with -Wunused-parameter
From: |
Paolo Bonzini |
Subject: |
[PULL 05/12] Fix broken configure with -Wunused-parameter |
Date: |
Sun, 6 Nov 2022 09:51:08 +0100 |
From: Stefan Weil <sw@weilnetz.de>
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.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-Id: <20221102202258.456359-1-sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 4275f5419fae..66928692b058 100755
--- a/configure
+++ b/configure
@@ -1258,7 +1258,7 @@ if test "$stack_protector" != "no"; then
cat > $TMPC << EOF
int main(int argc, char *argv[])
{
- char arr[64], *p = arr, *c = argv[0];
+ char arr[64], *p = arr, *c = argv[argc - 1];
while (*c) {
*p++ = *c++;
}
@@ -1607,7 +1607,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 +1629,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 +1675,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.38.1
- [PULL 00/12] Misc bugfix patches (+ improved module errors) for QEMU 7.2, Paolo Bonzini, 2022/11/06
- [PULL 01/12] util/main-loop: Fix maximum number of wait objects for win32, Paolo Bonzini, 2022/11/06
- [PULL 02/12] util/main-loop: Avoid adding the same HANDLE twice, Paolo Bonzini, 2022/11/06
- [PULL 04/12] gdb-xml: Fix size of EFER register on i386 architecture when debugged by GDB, Paolo Bonzini, 2022/11/06
- [PULL 03/12] util/aio-win32: Correct the event array size in aio_poll(), Paolo Bonzini, 2022/11/06
- [PULL 05/12] Fix broken configure with -Wunused-parameter,
Paolo Bonzini <=
- [PULL 06/12] meson: avoid unused arguments of main() in compiler tests, Paolo Bonzini, 2022/11/06
- [PULL 07/12] Add missing include statement for global xml_builtin, Paolo Bonzini, 2022/11/06
- [PULL 08/12] module: removed unused function argument "mayfail", Paolo Bonzini, 2022/11/06
- [PULL 09/12] module: rename module_load_one to module_load, Paolo Bonzini, 2022/11/06
- [PULL 10/12] module: add Error arguments to module_load and module_load_qom, Paolo Bonzini, 2022/11/06
- [PULL 11/12] dmg: warn when opening dmg images containing blocks of unknown type, Paolo Bonzini, 2022/11/06
- [PULL 12/12] accel: abort if we fail to load the accelerator plugin, Paolo Bonzini, 2022/11/06
- Re: [PULL 00/12] Misc bugfix patches (+ improved module errors) for QEMU 7.2, Stefan Hajnoczi, 2022/11/07