On 2/8/26 5:27 PM, Dmitry Mityugov wrote:
> This patch enables two compiler options, -Wmissing-declarations and
> -Wmissing-variable-declarations, to help minimize visibility of symbols
> used inside a single module, and catch other possible problems like
> unused functions and variables. It also adjusts `_OVS_CHECK_CC_OPTION`
> macro to work correctly with -Wmissing-variable-declarations option.
> 
> This patch also declares `impl_set_masked_funcs` array in
> lib/odp-execute-avx512.c as `static`, because it isn't used anywhere
> else.
> 
> Signed-off-by: Dmitry Mityugov <[email protected]>
> ---
>  acinclude.m4             | 2 +-
>  configure.ac             | 2 ++
>  lib/odp-execute-avx512.c | 2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/acinclude.m4 b/acinclude.m4
> index 586163ef3..599179a31 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -614,7 +614,7 @@ AC_DEFUN([_OVS_CHECK_CC_OPTION], [dnl
>       dnl instead of testing for -Wno-<foo>, test for the positive version.
>       CFLAGS="$CFLAGS $WERROR m4_bpatsubst([$1], [-Wno-], [-W])"
>       AC_COMPILE_IFELSE(
> -       [AC_LANG_SOURCE([int x;])],
> +       [AC_LANG_SOURCE([static int x;])],

Unfortunately, this breaks detection of -Werror:

configure:24439: checking whether clang accepts -Werror
configure:24451: clang -c -g -O2 -Wall  -Werror  conftest.c >&5
conftest.c:73:12: error: unused variable 'x' [-Werror,-Wunused-variable]
   73 | static int x;
      |            ^
1 error generated.
configure:24451: $? = 1
configure:24467: result: no

And without -Werror all other checks are pointless.  Hence the
reason FreeBSD CI fails in Cirrus.

We need a minimal and fully correct program that does not
produce any warnings.  The AC_LANG_PROGRAM([], []) might
work, I suppose.  But we need to make sure that detection
of other things is not broken as well...

Best regards, Ilya Maximets.

>         [if test -s conftest.err && grep "unrecognized option" conftest.err
>          then
>            ovs_cv_name[]=no
> diff --git a/configure.ac b/configure.ac
> index 6f28360a1..56eacbbc7 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -168,6 +168,8 @@ OVS_ENABLE_OPTION([-Wstrict-prototypes])
>  OVS_ENABLE_OPTION([-Wold-style-definition])
>  OVS_ENABLE_OPTION([-Wmissing-prototypes])
>  OVS_ENABLE_OPTION([-Wmissing-field-initializers])
> +OVS_ENABLE_OPTION([-Wmissing-declarations])
> +OVS_ENABLE_OPTION([-Wmissing-variable-declarations])
>  OVS_ENABLE_OPTION([-Wthread-safety])
>  OVS_ENABLE_OPTION([-fno-strict-aliasing])
>  OVS_ENABLE_OPTION([-Wswitch-bool])
> diff --git a/lib/odp-execute-avx512.c b/lib/odp-execute-avx512.c
> index 13afe0c79..55af58737 100644
> --- a/lib/odp-execute-avx512.c
> +++ b/lib/odp-execute-avx512.c
> @@ -108,7 +108,7 @@ BUILD_ASSERT_DECL(offsetof(struct ovs_key_ipv6, 
> ipv6_tclass) +
>                    offsetof(struct ovs_key_ipv6, ipv6_hlimit));
>  
>  /* Array of callback functions, one for each masked operation. */
> -odp_execute_action_cb impl_set_masked_funcs[__OVS_KEY_ATTR_MAX];
> +static odp_execute_action_cb impl_set_masked_funcs[__OVS_KEY_ATTR_MAX];
>  
>  static inline void ALWAYS_INLINE
>  avx512_dp_packet_resize_l2(struct dp_packet *b, int resize_by_bytes)

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to