> From: "Timothy Redaelli" <[email protected]>
> To: [email protected]
> Sent: Thursday, 13 July, 2017 10:29:33 AM
> Subject: [ovs-dev] [PATCH] tests: Disable no-format-truncation warnings
> 
> test_snprintf function (tests/test-util.c) tests snprintf with shorter
> length,
> but this emit a warning on GCC 7.0 or later.
> 
> This commit disables that warning on tests only.
> 
> Signed-off-by: Timothy Redaelli <[email protected]>
> ---
>  configure.ac      | 1 +
>  tests/automake.mk | 5 +++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 9ef6aad3a..256a3b83d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -169,6 +169,7 @@ OVS_ENABLE_OPTION([-Wduplicated-cond])
>  OVS_ENABLE_OPTION([-Qunused-arguments])
>  OVS_CONDITIONAL_CC_OPTION([-Wno-unused], [HAVE_WNO_UNUSED])
>  OVS_CONDITIONAL_CC_OPTION([-Wno-unused-parameter],
>  [HAVE_WNO_UNUSED_PARAMETER])
> +OVS_CONDITIONAL_CC_OPTION([-Wno-format-truncation],
> [HAVE_WNO_FORMAT_TRUNCATION])
>  OVS_ENABLE_WERROR
>  OVS_ENABLE_SPARSE
>  
> diff --git a/tests/automake.mk b/tests/automake.mk
> index 3118bbc27..1011acf65 100644
> --- a/tests/automake.mk
> +++ b/tests/automake.mk
> @@ -364,6 +364,11 @@ tests_ovstest_SOURCES += \
>  endif
>  
>  tests_ovstest_LDADD = lib/libopenvswitch.la ovn/lib/libovn.la
> +tests_ovstest_CFLAGS = $(AM_CFLAGS)
> +if HAVE_WNO_FORMAT_TRUNCATION
> +tests_ovstest_CFLAGS += -Wno-format-truncation
> +endif
> +
>  dist_check_SCRIPTS = tests/flowgen.pl
>  
>  noinst_PROGRAMS += tests/test-strtok_r
> --
> 2.13.0
> 

I've run into this as well after upgrading to F26. I dislike suppressing
warnings, but I think this is about as good as we'll be able to do. I do
like the fact that the warning is suppressed only for a single file.

So:
Acked-by: Lance Richardson <[email protected]>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to