[PATCH v2 8/8] tests/tcg: build tests with -Werror

Alex Bennée posted 8 patches 5 years, 2 months ago
[PATCH v2 8/8] tests/tcg: build tests with -Werror
Posted by Alex Bennée 5 years, 2 months ago
Hopefully this will guard against sloppy code getting into our tests.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/tcg/Makefile.target | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index 2ae86776cd..24d75a5801 100644
--- a/tests/tcg/Makefile.target
+++ b/tests/tcg/Makefile.target
@@ -94,7 +94,7 @@ ifdef CONFIG_USER_ONLY
 -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
 
 # Add the common build options
-CFLAGS+=-Wall -O0 -g -fno-strict-aliasing
+CFLAGS+=-Wall -Werror -O0 -g -fno-strict-aliasing
 ifeq ($(BUILD_STATIC),y)
 LDFLAGS+=-static
 endif
-- 
2.20.1


Re: [PATCH v2 8/8] tests/tcg: build tests with -Werror
Posted by Philippe Mathieu-Daudé 5 years, 2 months ago
On 12/10/20 8:04 PM, Alex Bennée wrote:
> Hopefully this will guard against sloppy code getting into our tests.
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/tcg/Makefile.target | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


Re: [PATCH v2 8/8] tests/tcg: build tests with -Werror
Posted by Thomas Huth 5 years, 2 months ago
On 10/12/2020 20.04, Alex Bennée wrote:
> Hopefully this will guard against sloppy code getting into our tests.
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/tcg/Makefile.target | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
> index 2ae86776cd..24d75a5801 100644
> --- a/tests/tcg/Makefile.target
> +++ b/tests/tcg/Makefile.target
> @@ -94,7 +94,7 @@ ifdef CONFIG_USER_ONLY
>  -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
>  
>  # Add the common build options
> -CFLAGS+=-Wall -O0 -g -fno-strict-aliasing
> +CFLAGS+=-Wall -Werror -O0 -g -fno-strict-aliasing
>  ifeq ($(BUILD_STATIC),y)
>  LDFLAGS+=-static
>  endif

I hope this works out as expected ... -Werror together with -O0 hopefully
does not trigger any false-positives since the compiler might not smart
enough in this case to determine e.g. whether certain variables are used or
not? Well, let's try and see.

Reviewed-by: Thomas Huth <thuth@redhat.com>