* [kvm-unit-tests PATCH] Allow to compile without -Werror
@ 2022-03-22 17:15 Thomas Huth
2022-03-22 17:22 ` Paolo Bonzini
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Thomas Huth @ 2022-03-22 17:15 UTC (permalink / raw)
To: kvm; +Cc: Paolo Bonzini, Andrew Jones, Janosch Frank, Claudio Imbrenda
Newer compiler versions sometimes introduce new warnings - and compiling
with -Werror will fail there, of course. Thus users of the kvm-unit-tests
like the buildroot project have to disable the "-Werror" in the Makefile
with an additional patch, which is cumbersome.
Thus let's add a switch to the configure script that allows to explicitly
turn the -Werror switch on or off. And enable it only by default for
developer builds (i.e. in checked-out git repositories) ... and for
tarball releases, it's nicer if it is disabled by default, so that the
end users do not have to worry about this.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
See also the patch from the buildroot project:
https://git.busybox.net/buildroot/tree/package/kvm-unit-tests/0001-Makefile-remove-Werror-to-avoid-build-failures.patch
Makefile | 2 +-
configure | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 24686dd..6ed5dea 100644
--- a/Makefile
+++ b/Makefile
@@ -62,7 +62,7 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile
COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing -fno-common
COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized
-COMMON_CFLAGS += -Wignored-qualifiers -Werror -Wno-missing-braces
+COMMON_CFLAGS += -Wignored-qualifiers -Wno-missing-braces $(CONFIG_WERROR)
frame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer
fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "")
diff --git a/configure b/configure
index c4fb4a2..86c3095 100755
--- a/configure
+++ b/configure
@@ -31,6 +31,13 @@ page_size=
earlycon=
efi=
+# Enable -Werror by default for git repositories only (i.e. developer builds)
+if [ -e "$srcdir"/.git ]; then
+ werror=-Werror
+else
+ werror=
+fi
+
usage() {
cat <<-EOF
Usage: $0 [options]
@@ -75,6 +82,8 @@ usage() {
Specify a PL011 compatible UART at address ADDR. Supported
register stride is 32 bit only.
--[enable|disable]-efi Boot and run from UEFI (disabled by default, x86_64 only)
+ --[enable|disable]-werror
+ Select whether to compile with the -Werror compiler flag
EOF
exit 1
}
@@ -148,6 +157,12 @@ while [[ "$1" = -* ]]; do
--disable-efi)
efi=n
;;
+ --enable-werror)
+ werror=-Werror
+ ;;
+ --disable-werror)
+ werror=
+ ;;
--help)
usage
;;
@@ -371,6 +386,7 @@ WA_DIVIDE=$wa_divide
GENPROTIMG=${GENPROTIMG-genprotimg}
HOST_KEY_DOCUMENT=$host_key_document
CONFIG_EFI=$efi
+CONFIG_WERROR=$werror
GEN_SE_HEADER=$gen_se_header
EOF
if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH] Allow to compile without -Werror
2022-03-22 17:15 [kvm-unit-tests PATCH] Allow to compile without -Werror Thomas Huth
@ 2022-03-22 17:22 ` Paolo Bonzini
2022-03-22 19:44 ` Claudio Imbrenda
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2022-03-22 17:22 UTC (permalink / raw)
To: Thomas Huth, kvm; +Cc: Andrew Jones, Janosch Frank, Claudio Imbrenda
On 3/22/22 18:15, Thomas Huth wrote:
> Newer compiler versions sometimes introduce new warnings - and compiling
> with -Werror will fail there, of course. Thus users of the kvm-unit-tests
> like the buildroot project have to disable the "-Werror" in the Makefile
> with an additional patch, which is cumbersome.
> Thus let's add a switch to the configure script that allows to explicitly
> turn the -Werror switch on or off. And enable it only by default for
> developer builds (i.e. in checked-out git repositories) ... and for
> tarball releases, it's nicer if it is disabled by default, so that the
> end users do not have to worry about this.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> See also the patch from the buildroot project:
> https://git.busybox.net/buildroot/tree/package/kvm-unit-tests/0001-Makefile-remove-Werror-to-avoid-build-failures.patch
>
> Makefile | 2 +-
> configure | 16 ++++++++++++++++
> 2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 24686dd..6ed5dea 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -62,7 +62,7 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile
>
> COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing -fno-common
> COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized
> -COMMON_CFLAGS += -Wignored-qualifiers -Werror -Wno-missing-braces
> +COMMON_CFLAGS += -Wignored-qualifiers -Wno-missing-braces $(CONFIG_WERROR)
>
> frame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer
> fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "")
> diff --git a/configure b/configure
> index c4fb4a2..86c3095 100755
> --- a/configure
> +++ b/configure
> @@ -31,6 +31,13 @@ page_size=
> earlycon=
> efi=
>
> +# Enable -Werror by default for git repositories only (i.e. developer builds)
> +if [ -e "$srcdir"/.git ]; then
> + werror=-Werror
> +else
> + werror=
> +fi
> +
> usage() {
> cat <<-EOF
> Usage: $0 [options]
> @@ -75,6 +82,8 @@ usage() {
> Specify a PL011 compatible UART at address ADDR. Supported
> register stride is 32 bit only.
> --[enable|disable]-efi Boot and run from UEFI (disabled by default, x86_64 only)
> + --[enable|disable]-werror
> + Select whether to compile with the -Werror compiler flag
> EOF
> exit 1
> }
> @@ -148,6 +157,12 @@ while [[ "$1" = -* ]]; do
> --disable-efi)
> efi=n
> ;;
> + --enable-werror)
> + werror=-Werror
> + ;;
> + --disable-werror)
> + werror=
> + ;;
> --help)
> usage
> ;;
> @@ -371,6 +386,7 @@ WA_DIVIDE=$wa_divide
> GENPROTIMG=${GENPROTIMG-genprotimg}
> HOST_KEY_DOCUMENT=$host_key_document
> CONFIG_EFI=$efi
> +CONFIG_WERROR=$werror
> GEN_SE_HEADER=$gen_se_header
> EOF
> if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Thanks,
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH] Allow to compile without -Werror
2022-03-22 17:15 [kvm-unit-tests PATCH] Allow to compile without -Werror Thomas Huth
2022-03-22 17:22 ` Paolo Bonzini
@ 2022-03-22 19:44 ` Claudio Imbrenda
2022-03-23 7:45 ` Andrew Jones
2022-03-23 8:05 ` Janosch Frank
3 siblings, 0 replies; 5+ messages in thread
From: Claudio Imbrenda @ 2022-03-22 19:44 UTC (permalink / raw)
To: Thomas Huth; +Cc: kvm, Paolo Bonzini, Andrew Jones, Janosch Frank
On Tue, 22 Mar 2022 18:15:04 +0100
Thomas Huth <thuth@redhat.com> wrote:
> Newer compiler versions sometimes introduce new warnings - and compiling
> with -Werror will fail there, of course. Thus users of the kvm-unit-tests
> like the buildroot project have to disable the "-Werror" in the Makefile
> with an additional patch, which is cumbersome.
> Thus let's add a switch to the configure script that allows to explicitly
> turn the -Werror switch on or off. And enable it only by default for
> developer builds (i.e. in checked-out git repositories) ... and for
> tarball releases, it's nicer if it is disabled by default, so that the
> end users do not have to worry about this.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
makes sense
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
> See also the patch from the buildroot project:
> https://git.busybox.net/buildroot/tree/package/kvm-unit-tests/0001-Makefile-remove-Werror-to-avoid-build-failures.patch
>
> Makefile | 2 +-
> configure | 16 ++++++++++++++++
> 2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 24686dd..6ed5dea 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -62,7 +62,7 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile
>
> COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing -fno-common
> COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized
> -COMMON_CFLAGS += -Wignored-qualifiers -Werror -Wno-missing-braces
> +COMMON_CFLAGS += -Wignored-qualifiers -Wno-missing-braces $(CONFIG_WERROR)
>
> frame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer
> fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "")
> diff --git a/configure b/configure
> index c4fb4a2..86c3095 100755
> --- a/configure
> +++ b/configure
> @@ -31,6 +31,13 @@ page_size=
> earlycon=
> efi=
>
> +# Enable -Werror by default for git repositories only (i.e. developer builds)
> +if [ -e "$srcdir"/.git ]; then
> + werror=-Werror
> +else
> + werror=
> +fi
> +
> usage() {
> cat <<-EOF
> Usage: $0 [options]
> @@ -75,6 +82,8 @@ usage() {
> Specify a PL011 compatible UART at address ADDR. Supported
> register stride is 32 bit only.
> --[enable|disable]-efi Boot and run from UEFI (disabled by default, x86_64 only)
> + --[enable|disable]-werror
> + Select whether to compile with the -Werror compiler flag
> EOF
> exit 1
> }
> @@ -148,6 +157,12 @@ while [[ "$1" = -* ]]; do
> --disable-efi)
> efi=n
> ;;
> + --enable-werror)
> + werror=-Werror
> + ;;
> + --disable-werror)
> + werror=
> + ;;
> --help)
> usage
> ;;
> @@ -371,6 +386,7 @@ WA_DIVIDE=$wa_divide
> GENPROTIMG=${GENPROTIMG-genprotimg}
> HOST_KEY_DOCUMENT=$host_key_document
> CONFIG_EFI=$efi
> +CONFIG_WERROR=$werror
> GEN_SE_HEADER=$gen_se_header
> EOF
> if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH] Allow to compile without -Werror
2022-03-22 17:15 [kvm-unit-tests PATCH] Allow to compile without -Werror Thomas Huth
2022-03-22 17:22 ` Paolo Bonzini
2022-03-22 19:44 ` Claudio Imbrenda
@ 2022-03-23 7:45 ` Andrew Jones
2022-03-23 8:05 ` Janosch Frank
3 siblings, 0 replies; 5+ messages in thread
From: Andrew Jones @ 2022-03-23 7:45 UTC (permalink / raw)
To: Thomas Huth; +Cc: kvm, Paolo Bonzini, Janosch Frank, Claudio Imbrenda
On Tue, Mar 22, 2022 at 06:15:04PM +0100, Thomas Huth wrote:
> Newer compiler versions sometimes introduce new warnings - and compiling
> with -Werror will fail there, of course. Thus users of the kvm-unit-tests
> like the buildroot project have to disable the "-Werror" in the Makefile
> with an additional patch, which is cumbersome.
> Thus let's add a switch to the configure script that allows to explicitly
> turn the -Werror switch on or off. And enable it only by default for
> developer builds (i.e. in checked-out git repositories) ... and for
> tarball releases, it's nicer if it is disabled by default, so that the
> end users do not have to worry about this.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> See also the patch from the buildroot project:
> https://git.busybox.net/buildroot/tree/package/kvm-unit-tests/0001-Makefile-remove-Werror-to-avoid-build-failures.patch
>
> Makefile | 2 +-
> configure | 16 ++++++++++++++++
> 2 files changed, 17 insertions(+), 1 deletion(-)
>
Reviewed-by: Andrew Jones <drjones@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH] Allow to compile without -Werror
2022-03-22 17:15 [kvm-unit-tests PATCH] Allow to compile without -Werror Thomas Huth
` (2 preceding siblings ...)
2022-03-23 7:45 ` Andrew Jones
@ 2022-03-23 8:05 ` Janosch Frank
3 siblings, 0 replies; 5+ messages in thread
From: Janosch Frank @ 2022-03-23 8:05 UTC (permalink / raw)
To: Thomas Huth, kvm; +Cc: Paolo Bonzini, Andrew Jones, Claudio Imbrenda
On 3/22/22 18:15, Thomas Huth wrote:
> Newer compiler versions sometimes introduce new warnings - and compiling
> with -Werror will fail there, of course. Thus users of the kvm-unit-tests
> like the buildroot project have to disable the "-Werror" in the Makefile
> with an additional patch, which is cumbersome.
> Thus let's add a switch to the configure script that allows to explicitly
> turn the -Werror switch on or off. And enable it only by default for
> developer builds (i.e. in checked-out git repositories) ... and for
> tarball releases, it's nicer if it is disabled by default, so that the
> end users do not have to worry about this.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
I'm tempted to introduce a -W-unused-* switch so the compiler doesn't
annoy me anymore when I'm working on new things. But on the other hand
I'd forget to disable it before submission :-)
Anyway:
Acked-by: Janosch Frank <frankja@linux.ibm.com>
> ---
> See also the patch from the buildroot project:
> https://git.busybox.net/buildroot/tree/package/kvm-unit-tests/0001-Makefile-remove-Werror-to-avoid-build-failures.patch
>
> Makefile | 2 +-
> configure | 16 ++++++++++++++++
> 2 files changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 24686dd..6ed5dea 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -62,7 +62,7 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile
>
> COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing -fno-common
> COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized
> -COMMON_CFLAGS += -Wignored-qualifiers -Werror -Wno-missing-braces
> +COMMON_CFLAGS += -Wignored-qualifiers -Wno-missing-braces $(CONFIG_WERROR)
>
> frame-pointer-flag=-f$(if $(KEEP_FRAME_POINTER),no-,)omit-frame-pointer
> fomit_frame_pointer := $(call cc-option, $(frame-pointer-flag), "")
> diff --git a/configure b/configure
> index c4fb4a2..86c3095 100755
> --- a/configure
> +++ b/configure
> @@ -31,6 +31,13 @@ page_size=
> earlycon=
> efi=
>
> +# Enable -Werror by default for git repositories only (i.e. developer builds)
> +if [ -e "$srcdir"/.git ]; then
> + werror=-Werror
> +else
> + werror=
> +fi
> +
> usage() {
> cat <<-EOF
> Usage: $0 [options]
> @@ -75,6 +82,8 @@ usage() {
> Specify a PL011 compatible UART at address ADDR. Supported
> register stride is 32 bit only.
> --[enable|disable]-efi Boot and run from UEFI (disabled by default, x86_64 only)
> + --[enable|disable]-werror
> + Select whether to compile with the -Werror compiler flag
> EOF
> exit 1
> }
> @@ -148,6 +157,12 @@ while [[ "$1" = -* ]]; do
> --disable-efi)
> efi=n
> ;;
> + --enable-werror)
> + werror=-Werror
> + ;;
> + --disable-werror)
> + werror=
> + ;;
> --help)
> usage
> ;;
> @@ -371,6 +386,7 @@ WA_DIVIDE=$wa_divide
> GENPROTIMG=${GENPROTIMG-genprotimg}
> HOST_KEY_DOCUMENT=$host_key_document
> CONFIG_EFI=$efi
> +CONFIG_WERROR=$werror
> GEN_SE_HEADER=$gen_se_header
> EOF
> if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-23 8:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 17:15 [kvm-unit-tests PATCH] Allow to compile without -Werror Thomas Huth
2022-03-22 17:22 ` Paolo Bonzini
2022-03-22 19:44 ` Claudio Imbrenda
2022-03-23 7:45 ` Andrew Jones
2022-03-23 8:05 ` Janosch Frank
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.