[LTP] [PATCH 1/3] tools/sparse: Add static check

Richard Palethorpe rpalethorpe@suse.de
Wed Nov 24 11:00:31 CET 2021


Hello,

Richard Palethorpe <rpalethorpe@suse.com> writes:

> This was adapted from Sparse's inbuilt check_duplicates (-Wdecl). The
> original check appears to print a warning whenever a symbol is
> non-static, but has no prototype. It appears to work because library
> symbols are usually declared first in a header file and then again
> with their definition in a source file.
>
> The LTP version also checks for the various library prefixes, but
> should otherwise be the same.
>
> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
> ---
>  tools/sparse/sparse-ltp.c | 53 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
>
> diff --git a/tools/sparse/sparse-ltp.c b/tools/sparse/sparse-ltp.c
> index 45874e8eb..73725d191 100644
> --- a/tools/sparse/sparse-ltp.c
> +++ b/tools/sparse/sparse-ltp.c
> @@ -82,6 +82,57 @@ static void do_entrypoint_checks(struct entrypoint *ep)
>  	} END_FOR_EACH_PTR(bb);
>  }
>  
> +/* Check for LTP-003 and LTP-004
> + *
> + * Try to find cases where the static keyword was forgotten.
> + */
> +static void check_symbol_visibility(struct symbol *sym)
> +{
> +	struct symbol *next = sym;

Ooops, we don't need next anymore.

-- 
Thank you,
Richard.


More information about the ltp mailing list