public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] sparse-ltp: Fix bogus warning
@ 2024-05-28 12:17 Petr Vorel
  2024-06-04 11:44 ` Cyril Hrubis
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Vorel @ 2024-05-28 12:17 UTC (permalink / raw)
  To: ltp

tst_tmpdir.c:347:6: warning: Symbol 'tst_purge_dir' has no prototype or
library ('tst_') prefix. Should it be static?

Fixes: abe9b1792 ("tools/sparse: Add static check")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 tools/sparse/sparse-ltp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/sparse/sparse-ltp.c b/tools/sparse/sparse-ltp.c
index d649ee7b7..fff4bd4e6 100644
--- a/tools/sparse/sparse-ltp.c
+++ b/tools/sparse/sparse-ltp.c
@@ -148,9 +148,11 @@ static void check_symbol_visibility(const struct symbol *const sym)
 	if (sym->ident == &main_ident)
 		return;
 
-	warning(sym->pos,
-		"Symbol '%s' has no prototype or library ('tst_') prefix. Should it be static?",
-		name);
+	if (!has_lib_prefix) {
+		warning(sym->pos,
+			"Symbol '%s' has no prototype or library ('tst_') prefix. Should it be static?",
+			name);
+	}
 }
 
 /* See base_type() in dissect.c */
-- 
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [LTP] [PATCH 1/1] sparse-ltp: Fix bogus warning
  2024-05-28 12:17 [LTP] [PATCH 1/1] sparse-ltp: Fix bogus warning Petr Vorel
@ 2024-06-04 11:44 ` Cyril Hrubis
  0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2024-06-04 11:44 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Hi!
> tst_tmpdir.c:347:6: warning: Symbol 'tst_purge_dir' has no prototype or
> library ('tst_') prefix. Should it be static?

Actually this is a correct check. The idea is a bit different, we are
trying to make sure that there is a prototype in the headers for the
function. If that is true, the sym->same_symbol points to that symbol
instance and the check exists before it reaches that warning.

So the actuall problem here is that the prototype is in a strange place,
i.e. tst_device.h which is not included into tst_tmpdir.c.

Obvious fix would be including tst_device.h into tst_tmpdir.c however
I'm not sure that the function to purge the directory belongs to the
tst_device.h to begin with. Maybe we should add just tst_tmpdir.h with
that function and include it into right places, i.e. tst_test.h and
tst_tmpdir.c.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-04 11:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-28 12:17 [LTP] [PATCH 1/1] sparse-ltp: Fix bogus warning Petr Vorel
2024-06-04 11:44 ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox