testsuite: Fix gcc 12 warnings

This commit is contained in:
Chris Johns
2022-06-21 10:21:13 +10:00
parent 775314d57f
commit 6b2c5b5da1
62 changed files with 96 additions and 89 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
int main(void)
{
struct iovec iov;
struct iovec iov = { 0 };
int count = 4;
ssize_t ret;
+1 -1
View File
@@ -14,7 +14,7 @@
int main(void)
{
sigset_t set;
sigset_t set = { 0 };
int status;
status = sigismember(&set, 21);
+2 -1
View File
@@ -15,7 +15,8 @@
int main(void)
{
int rc;
sigset_t set1, set2;
sigset_t set1 = { 0 };
sigset_t set2 = { 0 };
rc = sigprocmask(SIG_BLOCK, &set1, &set2);
(void) rc;
+1 -1
View File
@@ -14,7 +14,7 @@
int main(void)
{
struct iovec iov;
struct iovec iov = { 0 };
int count = 4;
ssize_t ret;
@@ -32,7 +32,7 @@ int test(void);
int test(void)
{
int af = 0;
struct in_addr addr;
struct in_addr addr = { 0 };
char *dst = "string";
const char *ret = inet_ntop(af, &addr, dst, sizeof(dst));
+2 -2
View File
@@ -5,7 +5,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
*
* Copyright (C) 2018, Zenon
*
* Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ int test(void);
int test(void){
int i0, i1;
char c;
char c = '\0';
i0 = 0;
i1 = 0;
@@ -43,7 +43,7 @@
int test( void )
{
struct hostent *host;
struct in_addr ipv4addr;
struct in_addr ipv4addr = { 0 };
host = gethostbyaddr( &ipv4addr, sizeof(ipv4addr), AF_INET );
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
pthread_attr_t attribute;
int state;
pthread_attr_t attribute = { 0 };
int state = 0;
int result;
result = pthread_attr_getdetachstate( &attribute, &state );
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
pthread_attr_t attribute;
size_t size;
pthread_attr_t attribute = { 0 };
size_t size = 0;
int result;
result = pthread_attr_getguardsize( &attribute, &size );
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
pthread_attr_t attr;
int inheritsched;
pthread_attr_t attr = { 0 };
int inheritsched = 0;
int result;
result = pthread_attr_getinheritsched( &attr, &inheritsched );
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
pthread_attr_t attr;
struct sched_param param;
pthread_attr_t attr = { 0 };
struct sched_param param = { 0 };
int result;
result = pthread_attr_getschedparam( &attr, &param );
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
pthread_attr_t attr;
int policy;
pthread_attr_t attr = { 0 };
int policy = 0;
int result;
result = pthread_attr_getschedpolicy( &attr, &policy );
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
pthread_attr_t attr;
int contentionscope;
pthread_attr_t attr = { 0 };
int contentionscope = 0;
int result;
result = pthread_attr_getscope( &attr, &contentionscope );
@@ -47,7 +47,7 @@ int test( void );
int test( void )
{
pthread_attr_t attribute;
pthread_attr_t attribute = { 0 };
void *stackaddr;
size_t stacksize;
int result;
@@ -47,7 +47,7 @@ int test( void );
int test( void )
{
pthread_attr_t attribute;
pthread_attr_t attribute = { 0 };
void *stackaddr;
int result;
@@ -46,8 +46,8 @@ int test( void );
int test( void )
{
pthread_attr_t attribute;
size_t size;
pthread_attr_t attribute = { 0 };
size_t size = 0;
int result;
result = pthread_attr_getstacksize( &attribute, &size );
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
pthread_attr_t attr;
struct sched_param param;
pthread_attr_t attr = { 0 };
struct sched_param param = { 0 };
int result;
result = pthread_attr_setschedparam( &attr, &param );
@@ -43,7 +43,7 @@ int test( void );
int test( void )
{
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
pthread_condattr_t attribute;
pthread_condattr_t attribute = { 0 };
int result;
result = pthread_cond_init( &cond, &attribute );
@@ -44,7 +44,7 @@ int test( void )
{
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
struct timespec abstime;
struct timespec abstime = { 0 };
int result;
result = pthread_cond_timedwait( &cond, &mutex, &abstime );
@@ -45,7 +45,7 @@ int test( void );
int test( void )
{
pthread_condattr_t attribute;
pthread_condattr_t attribute = { 0 };
int pshared;
int result;
@@ -53,7 +53,7 @@ void *test_task(
int test( void )
{
pthread_t thread;
pthread_attr_t attribute;
pthread_attr_t attribute = { 0 };
void *arg = NULL;
int result;
@@ -45,8 +45,8 @@ int test( void );
int test( void )
{
pthread_mutex_t mutex;
int prioceiling;
pthread_mutex_t mutex = { 0 };
int prioceiling = 0;
int result;
result = pthread_mutex_getprioceiling( &mutex, &prioceiling );
@@ -43,7 +43,7 @@ int test( void );
int test( void )
{
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutexattr_t attribute;
pthread_mutexattr_t attribute = { 0 };
int result;
result = pthread_mutex_init( &mutex, &attribute );
@@ -46,7 +46,7 @@ int test( void );
int test( void )
{
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
struct timespec timeout;
struct timespec timeout = { 0 };
int result;
result = pthread_mutex_timedlock( &mutex, &timeout );
@@ -45,7 +45,7 @@ int test( void );
int test( void )
{
pthread_mutexattr_t attribute;
pthread_mutexattr_t attribute = { 0 };
int prioceiling = 0;
int result;
@@ -45,8 +45,8 @@ int test( void );
int test( void )
{
pthread_mutexattr_t attribute;
int protocol;
pthread_mutexattr_t attribute = { 0 };
int protocol = 0;
int result;
result = pthread_mutexattr_getprotocol( &attribute, &protocol );
@@ -45,8 +45,8 @@ int test( void );
int test( void )
{
pthread_mutexattr_t attribute;
int pshared;
pthread_mutexattr_t attribute = { 0 };
int pshared = 0;
int result;
result = pthread_mutexattr_getpshared( &attribute, &pshared );
@@ -45,8 +45,8 @@ int test( void )
fd_set readfds;
fd_set writefds;
fd_set errorfds;
struct timespec timeout;
sigset_t sigmask;
struct timespec timeout = { 0 };
sigset_t sigmask = { 0 };
return_value = pselect(nfds, &readfds, &writefds, &errorfds, &timeout, &sigmask);
return return_value;
@@ -44,7 +44,7 @@ int test(void);
int test(void)
{
int sockfd = 4;
struct sockaddr addr;
struct sockaddr addr = { 0 };
socklen_t addrlen = sizeof(addr);
return bind(sockfd, &addr, addrlen);
@@ -43,9 +43,9 @@ int test(void);
int test(void)
{
int sockfd = 4;
struct sockaddr addr;
socklen_t addrlen = sizeof(addr);
int sockfd = 4;
struct sockaddr addr = { 0 };
socklen_t addrlen = sizeof(addr);
return connect(sockfd, &addr, addrlen);
}
@@ -48,7 +48,7 @@ int test(void)
int optname = 67;
int value;
void *optval = &value;
socklen_t optlen;
socklen_t optlen = { 0 };
return getsockopt(sockfd, level, optname, optval, &optlen);
}
@@ -44,7 +44,7 @@ ssize_t test(void);
ssize_t test(void)
{
int sockfd = 4;
int buffer;
int buffer = 0;
void *buf = &buffer;
size_t len = sizeof(buffer);
int flags = 7;
@@ -44,7 +44,7 @@ ssize_t test(void);
ssize_t test(void)
{
int sockfd = 4;
struct msghdr msg;
struct msghdr msg = { 0 };
int flags = 7;
@@ -44,11 +44,11 @@ ssize_t test(void);
ssize_t test(void)
{
int sockfd = 4;
int buffer;
int buffer = 0;
const void *buf = &buffer;
size_t len = sizeof(buffer);
int flags = 7;
struct sockaddr dest_addr;
struct sockaddr dest_addr = { 0 };
socklen_t addrlen = sizeof(dest_addr);
return sendto(sockfd, buf, len, flags, &dest_addr, addrlen);
@@ -46,7 +46,7 @@ int test(void)
int sockfd = 4;
int level = SOL_SOCKET;
int optname = 67;
int value;
int value = 0;
void *optval = &value;
socklen_t optlen = sizeof(value);
@@ -42,9 +42,9 @@ int test( void )
{
int return_value;
int fd = 1;
struct timespec times[2];
struct timespec times[2] = { 0 };
return_value = futimens(fd, times);
return (return_value != -1);
}
}
@@ -44,9 +44,9 @@ int test( void )
int return_value;
int fd = 1;
char *path = "/";
struct timespec times[2];
struct timespec times[2] = { 0 };
int flag = AT_SYMLINK_NOFOLLOW;
return_value = utimensat(fd, path, times, flag);
return (return_value != -1);
}
}
@@ -5,7 +5,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
*
* Copyright (C) 2018, Zenon
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,8 @@ int test(void);
int test(void)
{
int callback;
struct timeval tv;
callback = utimes(NULL, &tv);
struct timeval tv[2] = { 0 };
callback = utimes(NULL, &tv[0]);
return (callback == -1);
}
@@ -40,11 +40,11 @@ int test( void );
int test( void )
{
struct termios term;
struct termios term = { 0 };
speed_t rate;
rate = cfgetispeed(&term);
(void) rate;
return 0;
}
}
@@ -40,11 +40,11 @@ int test( void );
int test( void )
{
struct termios term;
struct termios term = { 0 };
speed_t rate;
rate = cfgetospeed(&term);
(void) rate;
return 0;
}
}
@@ -41,10 +41,10 @@ int test( void );
int test( void )
{
int result;
struct termios term;
struct termios term = { 0 };
speed_t speed = B0;
result = cfsetispeed(&term, speed);
return result;
}
}
@@ -41,10 +41,10 @@ int test( void );
int test( void )
{
int result;
struct termios term;
struct termios term = { 0 };
speed_t speed = B0;
result = cfsetospeed(&term, speed);
return result;
}
}
@@ -42,9 +42,9 @@ int test( void )
{
int result;
int fildes = 0;
struct termios term;
struct termios term = { 0 };
result = tcgetattr(fildes, &term);
return result;
}
}
@@ -43,9 +43,9 @@ int test( void )
int result;
int fildes = 0;
int optional_actions = 0;
struct termios term;
struct termios term = { 0 };
result = tcsetattr(fildes, optional_actions, &term);
return result;
}
}
+1 -1
View File
@@ -42,7 +42,7 @@ int test( void );
int test( void )
{
char *buffer;
struct tm timestruct;
struct tm timestruct = { 0 };
buffer = asctime( &timestruct );
+1 -1
View File
@@ -42,7 +42,7 @@ int test( void );
int test( void )
{
char *buffer_pointer;
struct tm timestruct;
struct tm timestruct = { 0 };
char buffer[ 80 ];
buffer_pointer = asctime_r( &timestruct, buffer );
@@ -46,7 +46,7 @@ int test( void );
int test( void )
{
clockid_t clock_id = 0;
struct timespec tp;
struct timespec tp = { 0 };
int result;
result = clock_settime( clock_id, &tp );
+1 -1
View File
@@ -42,7 +42,7 @@ int test( void );
int test( void )
{
char *buffer;
time_t time;
time_t time = { 0 };
buffer = ctime( &time );
+1 -1
View File
@@ -43,7 +43,7 @@ int test( void )
{
char *buffer_pointer;
char buffer[ 80 ];
time_t time;
time_t time = { 0 };
buffer_pointer = ctime_r( &time, buffer );
+1 -1
View File
@@ -41,7 +41,7 @@ int test( void );
int test( void )
{
time_t time;
time_t time = { 0 };
struct tm *timestruct;
timestruct = gmtime( &time );

Some files were not shown because too many files have changed in this diff Show More