rt-tests: cyclictest: Remove warnings due different signedness in comparison
PATCH 1/17 rt-tests: cyclictest: Remove warnings due different signedness in comparison
From: Eder Zulian <[email protected]>
Type casting used to remove compiler warnings due to comparison of integer expressions of different signedness.
--- src/cyclictest/cyclictest.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
src/cyclictest/cyclictest.c +4 -2
@@ -317,8 +317,10 @@ static int raise_soft_prio(int policy, const struct sched_param *param)return err; } - soft_max = (rlim.rlim_cur ==RLIM_INFINITY ) ? policy_max : rlim.rlim_cur; - hard_max = (rlim.rlim_max ==RLIM_INFINITY ) ? policy_max : rlim.rlim_max; + soft_max = (rlim.rlim_cur ==RLIM_INFINITY ) ? (unsigned int )policy_max + : rlim.rlim_cur; + hard_max = (rlim.rlim_max ==RLIM_INFINITY ) ? (unsigned int )policy_max + : rlim.rlim_max;if (prio > soft_max && prio <= hard_max) { rlim.rlim_cur = prio;
Signature · 1 line
2.40.1
PATCH 2/17 rt-tests: cyclictest: Suppress unused parameters warning
Suppress unused parameters warning in cyclictest with __attribute__ ((unused))
--- src/cyclictest/cyclictest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
src/cyclictest/cyclictest.c +2 -2
@@ -1616,7 +1616,7 @@ static void rstat_print_stat(struct thread_param *par, int index, int verbose, i* thread that creates a named fifo and hands out run stats when someone * reads from the fifo. */ -static void *fifothread (void *param) +static void *fifothread (void *param __attribute__ ((unused))) {int ret;int fd;
@@ -1797,7 +1797,7 @@ rstat_err:return ; } -static void write_stats (FILE *f,void *data) +static void write_stats (FILE *f,void *data __attribute__ ((unused))) {struct thread_param **par = parameters;unsigned int i, j, comma;
Signature · 1 line
2.40.1
PATCH 3/17 rt-tests: ssdd: Suppress unused parameters warning
In reply to John KacurSuppress unused parameters warning in ssdd with __attribute__ ((unused))
--- src/ssdd/ssdd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
src/ssdd/ssdd.c +1 -3
@@ -64,8 +64,6 @@ static const char *get_state_name(int state)return state_name[state]; } -#define unused __attribute__((unused)) -static int quiet;static char jsonfile[MAX_PATH ];
@@ -154,7 +152,7 @@ static pid_t parent;static int nforks =10 ;static int nsteps =10000 ; -static void sigchld(int sig, unused siginfo_t *info, unused void *arg) +static void sigchld (int sig __attribute__ ((unused)),siginfo_t *info __attribute__ ((unused)),void *arg __attribute__ ((unused))) { got_sigchld =1 ; }
Signature · 1 line
2.40.1
PATCH 4/17 rt-tests: queuelat: Suppress unused parameters warning
In reply to John KacurSuppress unused paramters warning in queuelat
--- src/queuelat/queuelat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/queuelat/queuelat.c +1 -1
@@ -519,7 +519,7 @@ void main_loop(void)free (src); } -void sig_handler (int sig) +void sig_handler (int sig __attribute__ ((unused))) {print_exit_info ();exit (0 );
Signature · 1 line
2.40.1
PATCH 5/17 rt-tests: cyclicdeadline: Suppress unused parameter warning
In reply to John KacurSuppress unused parameter warning in cyclicdeadline
--- src/sched_deadline/cyclicdeadline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/sched_deadline/cyclicdeadline.c +1 -1
@@ -1030,7 +1030,7 @@ static int calc_nr_cpus(const char *setcpu, char **buf)return -1 ; } -static void sighand (int sig) +static void sighand (int sig __attribute__ ((unused))) { shutdown =1 ; }
Signature · 1 line
2.40.1
PATCH 6/17 rt-tests: svsematest: Suppress unused paramters warning
In reply to John KacurSuppress unused paramters warnings in svsematest
--- src/svsematest/svsematest.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
src/svsematest/svsematest.c +3 -4
@@ -416,7 +416,7 @@ static void process_options(int argc, char *argv[])static int volatile mustshutdown; -static void sighand (int sig) +static void sighand (int sig __attribute__ ((unused))) { mustshutdown =1 ; }
@@ -430,7 +430,7 @@ static void write_stats(FILE *f, void *data) {struct params_stats *ps = data;struct params *s, *r; -unsigned int i; +int i;fprintf (f," \"num_threads\": %d,\n" , num_threads);fprintf (f," \"thread\": {\n" );
@@ -456,8 +456,7 @@ static void write_stats(FILE *f, void *data)fprintf (f," }\n" ); } -static void print_stat (FILE *fp,struct params *receiver,struct params *sender, -int verbose,int quiet) +static void print_stat (FILE *fp __attribute__ ((unused)),struct params *receiver,struct params *sender,int verbose __attribute__ ((unused)),int quiet) {int i;
Signature · 1 line
2.40.1
PATCH 7/17 rt-tests: pip_stress: Removed unused parameter
In reply to John KacurRemoved unused parameter in pip_stress
--- src/include/pip_stress.h | 2 +- src/pi_tests/pip_stress.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
src/include/pip_stress.h +1 -1
@@ -32,7 +32,7 @@ void Pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr);void Pthread_mutex_lock (pthread_mutex_t *mutex);void Pthread_mutex_unlock (pthread_mutex_t *mutex); -void init_shared_pthread_mutex (pthread_mutex_t *mutex,int protocol,int policy); +void init_shared_pthread_mutex (pthread_mutex_t *mutex,int protocol);int set_rt_prio (pid_t pid,int prio,int policy);int get_rt_prio (pid_t pid);
src/pi_tests/pip_stress.c +3 -3
@@ -114,7 +114,7 @@ int main(int argc, char *argv[]) mptr +=sizeof (pthread_mutex_t);/* advance the memory pointer */ /* Initialize our mutex via the resource pointer */ -init_shared_pthread_mutex (resource,PTHREAD_PRIO_INHERIT , policy); +init_shared_pthread_mutex (resource,PTHREAD_PRIO_INHERIT ); statep = (struct State *)mptr; mptr +=sizeof (struct State );
@@ -125,7 +125,7 @@ int main(int argc, char *argv[]) mptr +=sizeof (pthread_mutex_t);/* advance the memory pointer */ /* Initialize our State mutex */ -init_shared_pthread_mutex (statep->mutex,PTHREAD_PRIO_NONE , policy); +init_shared_pthread_mutex (statep->mutex,PTHREAD_PRIO_NONE );set_rt_prio (0 , prio_min, policy);
@@ -323,7 +323,7 @@ void Pthread_mutex_unlock(pthread_mutex_t *mutex) } } -void init_shared_pthread_mutex (pthread_mutex_t *mutex,int protocol,int policy) +void init_shared_pthread_mutex (pthread_mutex_t *mutex,int protocol) {pthread_mutexattr_t attr;
Signature · 1 line
2.40.1
PATCH 8/17 rt-tests: sigwaittest: Fix some warnings
In reply to John KacurFix some warnings about unused parameters and comparisons of integers of different signedness
--- src/sigwaittest/sigwaittest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
src/sigwaittest/sigwaittest.c +3 -3
@@ -384,13 +384,13 @@ static void process_options(int argc, char *argv[])static int volatile mustshutdown; -static void sighand (int sig) +static void sighand (int sig __attribute__ ((unused))) { mustshutdown =1 ; }static void print_stat (FILE *fp,struct params *receiver,struct params *sender, -int verbose,int quiet) +int verbose __attribute__ ((unused)),int quiet) {int i;
@@ -435,7 +435,7 @@ static void write_stats(FILE *f, void *data) {struct params_stats *ps = data;struct params *s, *r; -unsigned int i; +int i;fprintf (f," \"num_threads\": %d,\n" , num_threads);fprintf (f," \"thread\": {\n" );
Signature · 1 line
2.40.1
PATCH 9/17 rt-tests: rt-migrate-test: Fix some warnings
In reply to John Kacur- Use attribute unused where appropriate
- Change unsigned int to int for comparision
--- src/rt-migrate-test/rt-migrate-test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
src/rt-migrate-test/rt-migrate-test.c +3 -3
@@ -44,7 +44,7 @@ static void setup_ftrace_marker(void) "/debugfs/tracing/trace_marker", };int ret; -int i; +unsigned int i;for (i =0 ; i < (sizeof (files) /sizeof (char *)); i++) { ret =stat (files[i], &st);
@@ -354,7 +354,7 @@ static void print_results(void) } } -static void write_stats (FILE *f,void *data) +static void write_stats (FILE *f,void *data __attribute__ ((unused))) {int i;int t;
@@ -489,7 +489,7 @@ static int check_times(int l)return 0 ; } -static void stop_log (int sig) +static void stop_log (int sig __attribute__ ((unused))) { stop =1 ; }
Signature · 1 line
2.40.1
PATCH 10/17 rt-tests: signaltest Fix unused parameter warning
In reply to John KacurFix unused parameter warning in signal handler
--- src/signaltest/signaltest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
src/signaltest/signaltest.c +2 -2
@@ -357,7 +357,7 @@ static void process_options(int argc, char *argv[], unsigned int max_cpus) } } -static void sighand (int sig) +static void sighand (int sig __attribute__ ((unused))) { shutdown =1 ; }
@@ -388,7 +388,7 @@ static void write_stats(FILE *f, void *data) {struct thread_param *par = data;struct thread_stat *s; -unsigned int i; +int i;fprintf (f," \"num_threads\": %d,\n" , num_threads);fprintf (f," \"thread\": {\n" );
Signature · 1 line
2.40.1
PATCH 11/17 rt-tests: cyclicdeadline: Fix comparison of different signedness
In reply to John KacurFix comparison of integer expressions of different signedness
--- src/sched_deadline/cyclicdeadline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/sched_deadline/cyclicdeadline.c +1 -1
@@ -1067,7 +1067,7 @@ static void write_stats(FILE *f, void *data) {struct sched_data *sd = data;struct thread_stat *s; -unsigned int i; +int i;fprintf (f," \"num_threads\": %d,\n" , nr_threads);fprintf (f," \"resolution_in_ns\": %u,\n" , use_nsecs);
Signature · 1 line
2.40.1
PATCH 12/17 rt-tests: cyclictest: Fix comparison of different signedness
In reply to John KacurFix comparison of integer expressions of different signedness
--- src/cyclictest/cyclictest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
src/cyclictest/cyclictest.c +2 -1
@@ -1800,7 +1800,8 @@ rstat_err:static void write_stats (FILE *f,void *data __attribute__ ((unused))) {struct thread_param **par = parameters; -unsigned int i, j, comma; +int i, j; +unsigned comma;struct thread_stat *s;fprintf (f," \"num_threads\": %d,\n" , num_threads);
Signature · 1 line
2.40.1
PATCH 13/17 rt-tests: rt-utils: Suppress warnings about fallthrough
In reply to John KacurSuppress warnings about fallthrough in a case statement where this is intended.
--- src/lib/rt-utils.c | 3 +++ 1 file changed, 3 insertions(+)
src/lib/rt-utils.c +3 -0
@@ -382,12 +382,15 @@ int parse_mem_string(char *str, uint64_t *val)case 'g' :case 'G' : v *=1024 ; + __attribute__ ((fallthrough));case 'm' :case 'M' : v *=1024 ; + __attribute__ ((fallthrough));case 'k' :case 'K' : v *=1024 ; + __attribute__ ((fallthrough));case 'b' :case 'B' :break ;
Signature · 1 line
2.40.1
PATCH 14/17 rt-tests: rt-numa: Fix comparison of different signedness
In reply to John KacurFix comparison of integer expressions of different signedness
--- src/lib/rt-numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/lib/rt-numa.c +1 -1
@@ -52,7 +52,7 @@ int get_available_cpus(struct bitmask *cpumask)int cpu_for_thread_sp (int thread_num,int max_cpus,struct bitmask *cpumask) { -unsigned int m, cpu, i, num_cpus; +int m, cpu, i, num_cpus; num_cpus =numa_bitmask_weight (cpumask);
Signature · 1 line
2.40.1
PATCH 15/17 rt-tests: pi_stress: Fix various warnings
In reply to John KacurFix unused parameter
Fix comparison of integer expressions of different signedness with casts that are safe because the parameters are first tested to see if they are less than zero
--- src/pi_tests/pi_stress.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
src/pi_tests/pi_stress.c +5 -5
@@ -505,7 +505,7 @@ int pending_interrupt(void)* 1. report progress * 2. check for deadlocks */ -void *reporter (void *arg) +void *reporter (void *arg __attribute__ ((unused))) {int status;int end =0 ;
@@ -637,7 +637,7 @@ void *low_priority(void *arg)We can't set the 'loop' boolean here, because some flags may have already reached the loop_barr */ -if (!unbounded && (p->total >= p->inversions)) { +if (!unbounded && (p->total >= (unsigned )p->inversions)) {set_shutdown_flag (); }
@@ -766,7 +766,7 @@ void *med_priority(void *arg)pi_debug ("med_priority[%d]: starting inversion loop\n" , p->id);for (;;) { -if (!unbounded && (p->total >= p->inversions)) { +if (!unbounded && (p->total >= (unsigned )p->inversions)) {set_shutdown_flag (); }/* Either all threads go through the loop_barr, or none do */
@@ -891,7 +891,7 @@ void *high_priority(void *arg) unbounded = (p->inversions <0 );pi_debug ("high_priority[%d]: starting inversion loop\n" , p->id);for (;;) { -if (!unbounded && (p->total >= p->inversions)) { +if (!unbounded && (p->total >= (unsigned )p->inversions)) {set_shutdown_flag (); }
@@ -1449,7 +1449,7 @@ void summary(void) t->tm_yday, t->tm_hour, t->tm_min, t->tm_sec); } -void write_stats (FILE *f,void *data) +void write_stats (FILE *f,void *data __attribute__ ((unused))) {fprintf (f," \"inversion\": %lu\n" ,total_inversions ()); }
Signature · 1 line
2.40.1
PATCH 16/17 rt-tests: pmqtest: Fix various warnings
In reply to John KacurFix unused parameter warnings
Fix comparison of integer expressions of different signedness
--- src/pmqtest/pmqtest.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
src/pmqtest/pmqtest.c +5 -4
@@ -418,13 +418,14 @@ static void process_options(int argc, char *argv[])static int volatile shutdown; -static void sighand (int sig) +static void sighand (int sig __attribute__ ((unused))) { shutdown =1 ; } -static void print_stat (FILE *fp,struct params *receiver,struct params *sender, -int verbose,int quiet) +static void print_stat (FILE *fp __attribute__ ((unused)), +struct params *receiver,struct params *sender, +int verbose __attribute__ ((unused)),int quiet) {int i;
@@ -456,7 +457,7 @@ static void write_stats(FILE *f, void *data) {struct params_stats *ps = data;struct params *s, *r; -unsigned int i; +int i;fprintf (f," \"num_threads\": %d,\n" , num_threads);fprintf (f," \"thread\": {\n" );
Signature · 1 line
2.40.1
PATCH 17/17 rt-tests: ptsematest: Fix unused paramter warnings
In reply to John KacurFix unused paramter warnings
--- src/ptsematest/ptsematest.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
src/ptsematest/ptsematest.c +5 -4
@@ -321,13 +321,14 @@ static void process_options(int argc, char *argv[])static int volatile shutdown; -static void sighand (int sig) +static void sighand (int sig __attribute__ ((unused))) { shutdown =1 ; } -static void print_stat (FILE *fp,struct params *receiver,struct params *sender, -int verbose,int quiet) +static void print_stat (FILE *fp __attribute__ ((unused)), +struct params *receiver,struct params *sender, +int verbose __attribute__ ((unused)),int quiet) {int i;
@@ -359,7 +360,7 @@ static void write_stats(FILE *f, void *data) {struct params_stats *ps = data;struct params *s, *r; -unsigned int i; +int i;fprintf (f," \"num_threads\": %d,\n" , num_threads);fprintf (f," \"thread\": {\n" );
Signature · 1 line
2.40.1