Resolve a number of GCC-generated warnings
The warnings in test47 seem to be a symptom of a larger problem, i.e., not an issue with the test set code but rather with the GCC configuration. Hopefully the switch to LLVM will resolve those. Change-Id: Ic9fa3b8bc9b728947c993f2e1ed49d9a3b731344
This commit is contained in:
parent
82de0a47ea
commit
3083d603ba
@ -376,7 +376,7 @@ void distribute(void)
|
||||
if (base > pe->lowsec) {
|
||||
fprintf(stderr,
|
||||
"%s: fixed partition %u is preceded by too big partitions/holes\n",
|
||||
arg0, ((pe - table) - 1) / 2);
|
||||
arg0, ((unsigned int)(pe - table) - 1) / 2);
|
||||
exit(1);
|
||||
}
|
||||
exp= nil; /* XXX - Extend before? */
|
||||
|
@ -495,7 +495,7 @@ static int buflens[] = { 0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 255 };
|
||||
static void test_getnameinfo_all(void)
|
||||
{
|
||||
int flag_NUMERICHOST, flag_NAMEREQD, flag_NUMERICSERV, flag_DGRAM;
|
||||
int exp_results, flagcount, flags, i, j, k, l, socktypemismatch;
|
||||
int exp_results, flagcount, flags, i, j, k, l;
|
||||
const char *nodename, *servname;
|
||||
|
||||
/* set ports servent structs */
|
||||
@ -555,10 +555,6 @@ static void test_getnameinfo_all(void)
|
||||
if (buflens[k] > 0 && buflens[k] <= strlen(nodename))
|
||||
exp_results |= (1 << EAI_OVERFLOW) | (1 << EAI_MEMORY);
|
||||
|
||||
socktypemismatch =
|
||||
(flag_DGRAM && ports[j].socktype == SOCK_STREAM) ||
|
||||
(!flag_DGRAM && ports[j].socktype == SOCK_DGRAM);
|
||||
|
||||
struct servent *se = flag_DGRAM ? ports[j].se_udp : ports[j].se_tcp;
|
||||
|
||||
servname = (flag_NUMERICSERV) ?
|
||||
|
@ -166,6 +166,13 @@ static void testmul(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void do_not_optimize_away(volatile u64_t * ptr)
|
||||
{
|
||||
|
||||
/* TODO: does this actually do the job? */
|
||||
*ptr ^= 1;
|
||||
}
|
||||
|
||||
static void testdiv0(void)
|
||||
{
|
||||
int funcidx;
|
||||
@ -187,6 +194,8 @@ static void testdiv0(void)
|
||||
default: assert(0); ERR; break;
|
||||
}
|
||||
|
||||
do_not_optimize_away((volatile u64_t *)&res);
|
||||
|
||||
/* if we reach this point there was no signal and an
|
||||
* error has been recorded
|
||||
*/
|
||||
|
@ -171,7 +171,7 @@ start_socket_server(int port)
|
||||
#if !defined(__minix)
|
||||
int yes = 1;
|
||||
#endif
|
||||
int fd_sock, fd_new, r;
|
||||
int fd_sock, fd_new;
|
||||
struct sockaddr_in my_addr;
|
||||
struct sockaddr_in other_addr;
|
||||
socklen_t other_size;
|
||||
@ -220,7 +220,7 @@ start_socket_server(int port)
|
||||
e(5);
|
||||
}
|
||||
|
||||
r = read(fd_new, buf, sizeof(buf));
|
||||
(void)read(fd_new, buf, sizeof(buf));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -201,16 +201,14 @@ static void do_readlink2(void *buf, int fd, int writable)
|
||||
|
||||
static void do_symlink1(void *buf, int fd, int writable)
|
||||
{
|
||||
int r;
|
||||
/* the system call just has to fail gracefully */
|
||||
r = symlink(buf, NODENAME);
|
||||
(void)symlink(buf, NODENAME);
|
||||
}
|
||||
|
||||
static void do_symlink2(void *buf, int fd, int writable)
|
||||
{
|
||||
int r;
|
||||
/* the system call just has to fail gracefully */
|
||||
r = symlink(NODENAME, buf);
|
||||
(void)symlink(NODENAME, buf);
|
||||
}
|
||||
|
||||
static void do_open(void *buf, int fd, int writable)
|
||||
@ -223,26 +221,23 @@ static void do_open(void *buf, int fd, int writable)
|
||||
|
||||
static void do_select1(void *buf, int fd, int writable)
|
||||
{
|
||||
int r;
|
||||
struct timeval timeout = { 0, 200000 }; /* 0.2 sec */
|
||||
/* the system call just has to fail gracefully */
|
||||
r = select(1, buf, NULL, NULL, &timeout);
|
||||
(void)select(1, buf, NULL, NULL, &timeout);
|
||||
}
|
||||
|
||||
static void do_select2(void *buf, int fd, int writable)
|
||||
{
|
||||
int r;
|
||||
struct timeval timeout = { 0, 200000 }; /* 1 sec */
|
||||
/* the system call just has to fail gracefully */
|
||||
r = select(1, NULL, buf, NULL, &timeout);
|
||||
(void)select(1, NULL, buf, NULL, &timeout);
|
||||
}
|
||||
|
||||
static void do_select3(void *buf, int fd, int writable)
|
||||
{
|
||||
int r;
|
||||
struct timeval timeout = { 0, 200000 }; /* 1 sec */
|
||||
/* the system call just has to fail gracefully */
|
||||
r = select(1, NULL, NULL, buf, &timeout);
|
||||
(void)select(1, NULL, NULL, buf, &timeout);
|
||||
}
|
||||
|
||||
static void fillfile(int fd, int size)
|
||||
|
@ -150,7 +150,7 @@ test87a(void)
|
||||
pid_t pid;
|
||||
u_quad_t q;
|
||||
bool b, b2;
|
||||
int i, va[2], lastva, mib[CTL_MAXNAME + 1];
|
||||
int i, va[2], lastva = -1 /*gcc*/, mib[CTL_MAXNAME + 1];
|
||||
|
||||
subtest = 0;
|
||||
|
||||
@ -1668,7 +1668,7 @@ test87c(void)
|
||||
if (errno != EINVAL) e(0);
|
||||
|
||||
memcpy(&scn, &tmpscn, sizeof(scn));
|
||||
scn.sysctl_size = SSIZE_MAX + 1;
|
||||
scn.sysctl_size = (size_t)SSIZE_MAX + 1;
|
||||
if (sysctl(mib, 3, NULL, NULL, &scn, sizeof(scn)) != -1) e(0);
|
||||
if (errno != EINVAL) e(0);
|
||||
|
||||
@ -1806,7 +1806,7 @@ test87c(void)
|
||||
if (errno != EINVAL) e(0);
|
||||
|
||||
memcpy(&scn, &tmpscn, sizeof(scn));
|
||||
scn.sysctl_size = SSIZE_MAX + 1;
|
||||
scn.sysctl_size = (size_t)SSIZE_MAX + 1;
|
||||
if (sysctl(mib, 3, NULL, NULL, &scn, sizeof(scn)) != -1) e(0);
|
||||
if (errno != EINVAL) e(0);
|
||||
|
||||
@ -2950,14 +2950,17 @@ test87f(void)
|
||||
* contents match expectations, or -1 if they do not.
|
||||
*/
|
||||
static int
|
||||
test_buf(unsigned char * buf, unsigned char c, size_t size, int set)
|
||||
test_buf(char * buf, unsigned char c, size_t size, int set)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
int step;
|
||||
|
||||
ptr = (unsigned char *)buf;
|
||||
|
||||
for (step = 1; size > 0; size--) {
|
||||
if (set)
|
||||
*buf++ = c;
|
||||
else if (*buf++ != c)
|
||||
*ptr++ = c;
|
||||
else if (*ptr++ != c)
|
||||
return -1;
|
||||
|
||||
c += step;
|
||||
|
@ -68,7 +68,7 @@ static void *bad_ptr;
|
||||
* Drop user and group privileges in the child process if requested.
|
||||
*/
|
||||
static void
|
||||
spawn(struct link * link, void (* proc)(), int drop)
|
||||
spawn(struct link * link, void (* proc)(struct link *), int drop)
|
||||
{
|
||||
struct passwd *pw;
|
||||
struct group *gr;
|
||||
@ -1592,7 +1592,7 @@ test88c_perm1(struct link * parent)
|
||||
*/
|
||||
memset(val, 0, sizeof(val));
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
cmd = GETALL;
|
||||
@ -1609,6 +1609,8 @@ test88c_perm1(struct link * parent)
|
||||
ptr = &semds;
|
||||
bit = 4;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
r = semctl(id[0], 0, cmd, ptr);
|
||||
|
@ -298,6 +298,9 @@ test_one_uid(int setnum, int sub)
|
||||
sub89b(setnum);
|
||||
|
||||
return;
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
if (res != 0 && (res != -1 || errno != EPERM)) e(setnum);
|
||||
@ -635,6 +638,9 @@ test_one_gid(int setnum, int sub)
|
||||
sub89d(setnum);
|
||||
|
||||
return;
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
if (res != 0 && (res != -1 || errno != EPERM)) e(setnum);
|
||||
|
Loading…
x
Reference in New Issue
Block a user