[LTP] [PATCH 1/1] sparse-ltp: Fix bogus warning

Petr Vorel pvorel@suse.cz
Tue May 28 14:17:15 CEST 2024


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



More information about the ltp mailing list