Skip to contentSkip to conversation

Trivial fixes for a bunch of compiler warnings

PATCH New Michael Moese 2 participants 12 messages Jan 25, 2018

lore
Share & tools
lore
#0 lore raw

cover Trivial fixes for a bunch of compiler warnings

Hi again,
I was able to remove some trivial compiler warnings again. Local build-testing succeeded.

Michael Moese (10):
fix old-style-definition in written.c
fix old-style-definition in readline.c
fix old-style-definition and unused parameter in pthcli.c fix old-style-definition and unused parameter in pthserv.c fix old-style-definition in hackbench.c
fix old-style-definition in ht_utils.c
fix old-style-definition in ht_utils.c
fix old-style-definition in ht_utils.c
fix old-style-definition and unused parameter in ht_affinity.c fix unused-parameter and old-style-definition in ht_interrupt.c

 testcases/kernel/sched/cfs-scheduler/hackbench.c               |  2 +-
 testcases/kernel/sched/clisrv/pthcli.c                         |  5 ++---
 testcases/kernel/sched/clisrv/pthserv.c                        |  4 ++--
 testcases/kernel/sched/clisrv/readline.c                       |  5 +----
 testcases/kernel/sched/clisrv/writen.c                         |  5 +----
 .../kernel/sched/hyperthreading/ht_affinity/ht_affinity.c      |  8 ++++----
 testcases/kernel/sched/hyperthreading/ht_affinity/ht_utils.c   |  6 +++---
 testcases/kernel/sched/hyperthreading/ht_enabled/ht_utils.c    |  6 +++---
 .../kernel/sched/hyperthreading/ht_interrupt/ht_interrupt.c    |  4 ++--
 testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.c  | 10 +++++-----
 10 files changed, 24 insertions(+), 31 deletions(-)
Signature · 1 line
2.13.6
#1 lore raw

PATCH 1/10 fix old-style-definition in written.c

---
 testcases/kernel/sched/clisrv/writen.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
testcases/kernel/sched/clisrv/writen.c +1 -4
index 43db4b2bd..7ab12cdbe 100644
@@ -25,10 +25,7 @@
 /* Write "n" bytes to a descriptor
    Use instead of write() when fd is a stream socket. */
 
-int writen(fd, ptr, nbytes)
-register int fd;
-register char *ptr;
-register int nbytes;
+int writen(int fd, char *ptr, int nbytes)
 {
 	int nleft, nwritten;
 
Signature · 1 line
2.13.6
#2 lore raw

PATCH 2/10 fix old-style-definition in readline.c

In reply to Michael Moese
---
 testcases/kernel/sched/clisrv/readline.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
testcases/kernel/sched/clisrv/readline.c +1 -4
index e65ef1840..0c3272999 100644
@@ -25,10 +25,7 @@
 /* Read line from a descriptor, byte at a time, return number of
    characters up to the null */
 
-int readline(fd, ptr, maxlen)
-register int fd;
-register char *ptr;
-register int maxlen;
+int readline(int fd, char *ptr, int maxlen)
 {
 	int n, rc;
 	char c;
Signature · 1 line
2.13.6
#3 lore raw

PATCH 3/10 fix old-style-definition and unused parameter in pthcli.c

In reply to Michael Moese
---
 testcases/kernel/sched/clisrv/pthcli.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
testcases/kernel/sched/clisrv/pthcli.c +2 -3
index 3bcd688f6..7833b86d1 100644
@@ -53,15 +53,14 @@
 
 void noprintf(char *string, ...)
 {
+	(void) string;
 }
 
 /* Read contents of FILE *fp. Write each line to socket, then
    read line back from socket and write to standard output.
    Return to caller when done */
 
-void str_cli(fp, sockfd)
-register FILE *fp;
-register int sockfd;
+void str_cli(FILE *fp, int sockfd)
 {
 	int n;
 	char sendline[MAXLINE], recvline[MAXLINE + 1];
Signature · 1 line
2.13.6
#4 lore raw

PATCH 4/10 fix old-style-definition and unused parameter in pthserv.c

In reply to Michael Moese
---
 testcases/kernel/sched/clisrv/pthserv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/sched/clisrv/pthserv.c +2 -2
index 7aeb63f6e..e3da52130 100644
@@ -53,8 +53,7 @@ int sockfd;
 /* Read a stream socket one line at a time and write each line back
    to sender. Return when connection is terminated */
 
-int str_echo(sockfd)
-int sockfd;
+int str_echo(int sockfd)
 {
 	int n, testint;
 	char line[MAXLINE];
@@ -95,6 +94,7 @@ int main(int argc, char *argv[])
 	struct sockaddr_in cli_addr, serv_addr;
 	pname = argv[0];
 
+	(void) argc;
 	prtln();
 	/* Open inet stream socket */
 	if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
Signature · 1 line
2.13.6
#5 lore raw

PATCH 5/10 fix old-style-definition in hackbench.c

In reply to Michael Moese
---
 testcases/kernel/sched/cfs-scheduler/hackbench.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/sched/cfs-scheduler/hackbench.c +1 -1
index c7b7e0c16..6f37060aa 100644
@@ -92,7 +92,7 @@ static void barf(const char *msg)
 	exit(1);
 }
 
-static void print_usage_exit()
+static void print_usage_exit(void)
 {
 	printf
 	    ("Usage: hackbench [-pipe] <num groups> [process|thread] [loops]\n");
Signature · 1 line
2.13.6
#6 lore raw

PATCH 6/10 fix old-style-definition in ht_utils.c

In reply to Michael Moese
---
 testcases/kernel/sched/hyperthreading/ht_affinity/ht_utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/sched/hyperthreading/ht_affinity/ht_utils.c +3 -3
index d6f3ef523..18f0862cb 100644
@@ -16,7 +16,7 @@
 
 char buffer[BUFF_SIZE];
 
-int is_ht_cpu()
+int is_ht_cpu(void)
 {
 	/*Number of logic processor in a physical processor */
 	int smp_num_siblings = -1;
@@ -39,7 +39,7 @@ int is_ht_cpu()
 
 /* return 0 means Pass,
  return 1 means ht is not enabled,*/
-int check_ht_capability()
+int check_ht_capability(void)
 {
 	int result;
 	if (is_ht_cpu())
@@ -57,7 +57,7 @@ int check_ht_capability()
 
 char buf[256];
 
-int get_cpu_count()
+int get_cpu_count(void)
 {
 	FILE *pfile;
 	int count;
Signature · 1 line
2.13.6
#7 lore raw

PATCH 7/10 fix old-style-definition in ht_utils.c

In reply to Michael Moese
---
 testcases/kernel/sched/hyperthreading/ht_enabled/ht_utils.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
testcases/kernel/sched/hyperthreading/ht_enabled/ht_utils.c +3 -3
index a996b6ddb..7644e352c 100644
@@ -19,7 +19,7 @@
 
 char buffer[BUFF_SIZE];
 
-int is_ht_cpu()
+int is_ht_cpu(void)
 {
 	/*Number of logic processor in a physical processor */
 	int smp_num_siblings = -1;
@@ -41,7 +41,7 @@ int is_ht_cpu()
 
 /*return 0 means Pass,
 return 1 means ht is not enabled*/
-int check_ht_capability()
+int check_ht_capability(void)
 {
 	int result;
 	if (is_ht_cpu()) {
@@ -61,7 +61,7 @@ int check_ht_capability()
 
 char buf[256];
 
-int get_cpu_count()
+int get_cpu_count(void)
 {
 	FILE *pfile;
 	int count;
Signature · 1 line
2.13.6
#8 lore raw

PATCH 8/10 fix old-style-definition in ht_utils.c

In reply to Michael Moese
---
 testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.c +5 -5
index bd2d373e5..66bf69212 100644
@@ -41,7 +41,7 @@ int is_cmdline_para(const char *para)
 	return 0;
 }
 
-int is_ht_kernel()
+int is_ht_kernel(void)
 {
 	FILE *fp;
 
@@ -59,7 +59,7 @@ int is_ht_kernel()
 	return 0;
 }
 
-int is_ht_cpu()
+int is_ht_cpu(void)
 {
 	/*Number of logic processor in a physical processor */
 	int smp_num_siblings = -1;
@@ -79,7 +79,7 @@ int is_ht_cpu()
 	}
 }
 
-int is_ht_enabled()
+int is_ht_enabled(void)
 {
 	int cpu_map[MAX_CPU_NUM];
 	/*A bit-map shows whether a 'logic' processor has ht flag */
@@ -176,7 +176,7 @@ int is_ht_enabled()
 // return 1 means ht is not enabled,
 // return 2 means CPU is not support ht,
 // return 3 mean kernel is not support ht.
-int check_ht_capability()
+int check_ht_capability(void)
 {
 	int result;
 
@@ -201,7 +201,7 @@ int check_ht_capability()
 
 char buf[256];
 
-int get_cpu_count()
+int get_cpu_count(void)
 {
 	FILE *pfile;
 	int count;
Signature · 1 line
2.13.6
#9 lore raw

PATCH 9/10 fix old-style-definition and unused parameter in ht_affinity.c

In reply to Michael Moese
---
 testcases/kernel/sched/hyperthreading/ht_affinity/ht_affinity.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
testcases/kernel/sched/hyperthreading/ht_affinity/ht_affinity.c +4 -4
index 5ac0fa23a..f6e9f2745 100644
@@ -46,7 +46,7 @@ len - length in bytes of the bitmask pointed to by user_mask_ptr.
 #define AFFINITY_NAME "affinity"
 #define PROCFS_PATH "/proc/"
 
-int HT_SetAffinity()
+int HT_SetAffinity(void)
 {
 	unsigned int mask;
 	pid_t pid;
@@ -145,7 +145,7 @@ unsigned long get_porc_affinity(pid_t pid)
 	return atol(buf);
 }
 
-int HT_GetAffinity()
+int HT_GetAffinity(void)
 {
 	unsigned int mask[2], mask1[2];
 	pid_t pid;
@@ -177,7 +177,7 @@ int HT_GetAffinity()
 		return 0;
 }
 
-int HT_InheritAffinity()
+int HT_InheritAffinity(void)
 {
 	unsigned int mask[2];
 	pid_t pid;
@@ -211,7 +211,7 @@ int HT_InheritAffinity()
 }
 
 // return 0 means Pass, return 1 means Fail
-int main(int argc, char *argv[])
+int main(void)
 {
 
 #if (!defined __i386__ && !defined __x86_64__)
Signature · 1 line
2.13.6
#10 lore raw

PATCH 10/10 fix unused-parameter and old-style-definition in ht_interrupt.c

In reply to Michael Moese
---
 testcases/kernel/sched/hyperthreading/ht_interrupt/ht_interrupt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/sched/hyperthreading/ht_interrupt/ht_interrupt.c +2 -2
index cab968c9f..38f235ec8 100644
@@ -24,7 +24,7 @@ int TST_TOTAL = 1;
 
 #define INTERRUPT_NAME	"/proc/interrupts"
 
-int HT_InterruptDistribution()
+int HT_InterruptDistribution(void)
 {
 	FILE *pFile;
 	int ci[32], cj[32];
@@ -91,7 +91,7 @@ int HT_InterruptDistribution()
 }
 
 // return 0 means Pass, return 1 means Fail.
-int main(int argc, char *argv[])
+int main(void)
 {
 	tst_resm(TINFO, "Begin: HyperThreading Interrupt");
 
Signature · 1 line
2.13.6