diff mbox series

sparse: Skip TCID and TST_TOTAL

Message ID 20211130114527.5942-1-chrubis@suse.cz
State Superseded
Headers show
Series sparse: Skip TCID and TST_TOTAL | expand

Commit Message

Cyril Hrubis Nov. 30, 2021, 11:45 a.m. UTC
Since these are part of the old library API.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 tools/sparse/sparse-ltp.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Richard Palethorpe Nov. 30, 2021, 1:56 p.m. UTC | #1
Hello,

Cyril Hrubis <chrubis@suse.cz> writes:

> Since these are part of the old library API.
>
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---
>  tools/sparse/sparse-ltp.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tools/sparse/sparse-ltp.c b/tools/sparse/sparse-ltp.c
> index b1677d336..1a3b4089a 100644
> --- a/tools/sparse/sparse-ltp.c
> +++ b/tools/sparse/sparse-ltp.c
> @@ -98,6 +98,9 @@ static void check_symbol_visibility(const struct symbol *const sym)
>  	if (!(mod & MOD_TOPLEVEL))
>  		return;
>  
> +	if (!strcmp(name, "TCID") || !strcmp(name, "TST_TOTAL"))
> +		return;

Would it be better to print a warning that old library crap has been
detected?

My expectation is that 'make check' will produce a lot of noise if ran
on tests which haven't even been converted to the new library. Also it's
possible someone may forget to remove TCID etc.

> +
>  	if (has_lib_prefix && (mod & MOD_STATIC) && !(mod & MOD_INLINE)) {
>  		warning(sym->pos,
>  			"LTP-003: Symbol '%s' has the LTP public library prefix, but is static (private).",
> -- 
> 2.32.0
Cyril Hrubis Nov. 30, 2021, 2:27 p.m. UTC | #2
Hi!
> > Since these are part of the old library API.
> >
> > Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> > ---
> >  tools/sparse/sparse-ltp.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/tools/sparse/sparse-ltp.c b/tools/sparse/sparse-ltp.c
> > index b1677d336..1a3b4089a 100644
> > --- a/tools/sparse/sparse-ltp.c
> > +++ b/tools/sparse/sparse-ltp.c
> > @@ -98,6 +98,9 @@ static void check_symbol_visibility(const struct symbol *const sym)
> >  	if (!(mod & MOD_TOPLEVEL))
> >  		return;
> >  
> > +	if (!strcmp(name, "TCID") || !strcmp(name, "TST_TOTAL"))
> > +		return;
> 
> Would it be better to print a warning that old library crap has been
> detected?

I guess so.

> My expectation is that 'make check' will produce a lot of noise if ran
> on tests which haven't even been converted to the new library. Also it's
> possible someone may forget to remove TCID etc.

Well we may as well print the warnings only if new library test is
detected. But I guess that is not an easy task since we would have to
look at the include directives even before we attempt to parse the
file..
Richard Palethorpe Dec. 1, 2021, 7:21 a.m. UTC | #3
Hello,

Cyril Hrubis <chrubis@suse.cz> writes:

> Hi!
>> > Since these are part of the old library API.
>> >
>> > Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
>> > ---
>> >  tools/sparse/sparse-ltp.c | 3 +++
>> >  1 file changed, 3 insertions(+)
>> >
>> > diff --git a/tools/sparse/sparse-ltp.c b/tools/sparse/sparse-ltp.c
>> > index b1677d336..1a3b4089a 100644
>> > --- a/tools/sparse/sparse-ltp.c
>> > +++ b/tools/sparse/sparse-ltp.c
>> > @@ -98,6 +98,9 @@ static void check_symbol_visibility(const struct symbol *const sym)
>> >  	if (!(mod & MOD_TOPLEVEL))
>> >  		return;
>> >  
>> > +	if (!strcmp(name, "TCID") || !strcmp(name, "TST_TOTAL"))
>> > +		return;
>> 
>> Would it be better to print a warning that old library crap has been
>> detected?
>
> I guess so.
>
>> My expectation is that 'make check' will produce a lot of noise if ran
>> on tests which haven't even been converted to the new library. Also it's
>> possible someone may forget to remove TCID etc.
>
> Well we may as well print the warnings only if new library test is
> detected. But I guess that is not an easy task since we would have to
> look at the include directives even before we attempt to parse the
> file..

Some checks may require detecting the type of translation unit in an
initial pass. At which point we will probably get this for free.
diff mbox series

Patch

diff --git a/tools/sparse/sparse-ltp.c b/tools/sparse/sparse-ltp.c
index b1677d336..1a3b4089a 100644
--- a/tools/sparse/sparse-ltp.c
+++ b/tools/sparse/sparse-ltp.c
@@ -98,6 +98,9 @@  static void check_symbol_visibility(const struct symbol *const sym)
 	if (!(mod & MOD_TOPLEVEL))
 		return;
 
+	if (!strcmp(name, "TCID") || !strcmp(name, "TST_TOTAL"))
+		return;
+
 	if (has_lib_prefix && (mod & MOD_STATIC) && !(mod & MOD_INLINE)) {
 		warning(sym->pos,
 			"LTP-003: Symbol '%s' has the LTP public library prefix, but is static (private).",