Skip to contentSkip to conversation

Two small fixes for LTP-003

PATCH In review Cyril Hrubis 4 participants 7 messages Nov 30, 2021 – Dec 1, 2021

lore
Share & tools
lore
#0 lore raw

cover Two small fixes for LTP-003

This fixes false possitives for tst_fuzzy_sync.h

Cyril Hrubis (2):
include/tst_fuzzy_sync.h: Add inline to static fucntions
sparse: Do not report static inline functions

 include/tst_fuzzy_sync.h  | 14 +++++++-------
 tools/sparse/sparse-ltp.c |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
Signature · 5 lines
2.32.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH 1/2 include/tst_fuzzy_sync.h: Add inline to static fucntions

---
 include/tst_fuzzy_sync.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
include/tst_fuzzy_sync.h +7 -7
index 8f97bb8f6..bc3450294 100644
@@ -210,7 +210,7 @@ struct tst_fzsync_pair {
  *
  * @sa tst_fzsync_pair_reset()
  */
-static void tst_fzsync_pair_init(struct tst_fzsync_pair *pair)
+static inline void tst_fzsync_pair_init(struct tst_fzsync_pair *pair)
 {
 	CHK(avg_alpha, 0, 1, 0.25);
 	CHK(min_samples, 20, INT_MAX, 1024);
@@ -230,7 +230,7 @@ static void tst_fzsync_pair_init(struct tst_fzsync_pair *pair)
  *
  * Call this from your cleanup function.
  */
-static void tst_fzsync_pair_cleanup(struct tst_fzsync_pair *pair)
+static inline void tst_fzsync_pair_cleanup(struct tst_fzsync_pair *pair)
 {
 	if (pair->thread_b) {
 		/* Revoke thread B if parent hits accidental break */
@@ -254,7 +254,7 @@ struct tst_fzsync_run_thread {
  * Wrap run_b for tst_fzsync_pair_reset to enable pthread cancel
  * at the start of the thread B.
  */
-static void *tst_fzsync_thread_wrapper(void *run_thread)
+static inline void *tst_fzsync_thread_wrapper(void *run_thread)
 {
        struct tst_fzsync_run_thread t = *(struct tst_fzsync_run_thread *)run_thread;
 
@@ -268,7 +268,7 @@ static void *tst_fzsync_thread_wrapper(void *run_thread)
  *
  * @relates tst_fzsync_stat
  */
-static void tst_init_stat(struct tst_fzsync_stat *s)
+static inline void tst_init_stat(struct tst_fzsync_stat *s)
 {
 	s->avg = 0;
 	s->avg_dev = 0;
@@ -292,7 +292,7 @@ static void tst_init_stat(struct tst_fzsync_stat *s)
  *
  * @sa tst_fzsync_pair_init()
  */
-static void tst_fzsync_pair_reset(struct tst_fzsync_pair *pair,
+static inline void tst_fzsync_pair_reset(struct tst_fzsync_pair *pair,
 				  void *(*run_b)(void *))
 {
 	tst_fzsync_pair_cleanup(pair);
@@ -340,7 +340,7 @@ static inline void tst_fzsync_stat_info(struct tst_fzsync_stat stat,
  *
  * @relates tst_fzsync_pair
  */
-static void tst_fzsync_pair_info(struct tst_fzsync_pair *pair)
+static inline void tst_fzsync_pair_info(struct tst_fzsync_pair *pair)
 {
 	tst_res(TINFO, "loop = %d, delay_bias = %d",
 		pair->exec_loop, pair->delay_bias);
@@ -493,7 +493,7 @@ static inline void tst_upd_diff_stat(struct tst_fzsync_stat *s,
  *
  * @relates tst_fzsync_pair
  */
-static void tst_fzsync_pair_update(struct tst_fzsync_pair *pair)
+static inline void tst_fzsync_pair_update(struct tst_fzsync_pair *pair)
 {
 	float alpha = pair->avg_alpha;
 	float per_spin_time, time_delay;
Signature · 5 lines
2.32.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/2
#2 lore raw

Re: [LTP] [PATCH 1/2] include/tst_fuzzy_sync.h: Add inline to static fucntions

Hi Cyril,

obviously correct, thanks!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

PATCH 2/2 sparse: Do not report static inline functions

In reply to Cyril Hrubis

Since these are part of the library API and can be prefixed with tst_

---
 tools/sparse/sparse-ltp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/sparse/sparse-ltp.c +1 -1
index 2f32bfa38..b1677d336 100644
@@ -98,7 +98,7 @@ static void check_symbol_visibility(const struct symbol *const sym)
 	if (!(mod & MOD_TOPLEVEL))
 		return;
 
-	if (has_lib_prefix && (mod & MOD_STATIC)) {
+	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).",
 			name);
Signature · 5 lines
2.32.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 2/2
#5 lore raw

Re: [LTP] [PATCH 2/2] sparse: Do not report static inline functions

Hi Cyril, Richie,

Quoted 1 line

Since these are part of the library API and can be prefixed with tst_

Make sense, thanks!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw
In reply to Cyril Hrubis

Hello,

Pushed, Thanks!

Quoted 12 lines · Cyril Hrubis

This fixes false possitives for tst_fuzzy_sync.h

Cyril Hrubis (2):
include/tst_fuzzy_sync.h: Add inline to static fucntions
sparse: Do not report static inline functions

 include/tst_fuzzy_sync.h  | 14 +++++++-------
 tools/sparse/sparse-ltp.c |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
2.32.0
Signature · 5 lines
Thank you,
Richard.

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