Fix many more comiler warnings

Most warnings were harmless, some real bugs. Test set should now compile
cleanly with ack, gcc, and clang.
This commit is contained in:
Thomas Veerman
2011-11-28 10:07:55 +00:00
parent b4fb061802
commit 92b61c816d
53 changed files with 120 additions and 125 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
GCC?=gcc
CFLAGS= -O0 -D_MINIX -D_POSIX_SOURCE -g -Wall -Werror
.if ${COMPILER_TYPE} == "gnu"
CFLAGS+= -D_NETBSD_SOURCE
CFLAGS+= -D_NETBSD_SOURCE -fno-builtin
LIBS+= -lm -lcompat_minix
.endif
CFLAGS-GCC= $(CFLAGS) -Wall -D_NETBSD_SOURCE
+5 -5
View File
@@ -38,22 +38,22 @@ int main()
if (getpid() == pid)
if (fork() == 0) {
execl("t10a", (char *) 0);
execl("t10a", "t10a", (char *) 0);
exit(0);
}
if (getpid() == pid)
if (fork() == 0) {
execl("t10b", (char *) 0);
execl("t10b", "t10b", (char *) 0);
exit(0);
}
if (getpid() == pid)
if (fork() == 0) {
execl("t10c", (char *) 0);
execl("t10c", "t10c", (char *) 0);
exit(0);
}
if (getpid() == pid)
if (fork() == 0) {
execl("t10d", (char *) 0);
execl("t10d", "t10d", (char *) 0);
exit(0);
}
@@ -77,7 +77,7 @@ int n;
if ((pid = fork()) != 0) {
wait(&n); /* wait for some child (any one) */
} else {
k = execl(name[n], (char *) 0);
k = execl(name[n], name[n], (char *) 0);
errct++;
printf("Child execl didn't take. file=%s errno=%d\n", name[n], errno);
rmfiles();
+1 -1
View File
@@ -88,7 +88,7 @@ void test11a()
* bits on. If a bug lets it unexpectedly succeed, the child
* will print an error message since the arguments are wrong.
*/
execl("t11a", (char *) 0, envp); /* should fail -- no X bits */
execl("t11a", "t11a", (char *) 0); /* should fail -- no X bits */
/* Control should come here after the failed execl(). */
chmod("t11a", 06555);
+2
View File
@@ -63,6 +63,8 @@ int main(int argc, char *argv[])
test20d();
}
quit();
return(-1); /* Unreachable */
}
void test20a()
+2
View File
@@ -65,6 +65,8 @@ char *argv[];
if (m & 020000) test21o();
}
quit();
return(-1); /* Unreachable */
}
void test21a()
+2
View File
@@ -37,6 +37,8 @@ int main(int argc, char *argv[])
}
quit();
return (-1); /* Unreachable */
}
void test22a()
+2
View File
@@ -52,6 +52,8 @@ int main(int argc, char *argv[])
if (m & 0004) test24c();
}
quit();
return(-1); /* Unreachable */
}
void test24a()
+2
View File
@@ -63,6 +63,8 @@ int main(int argc, char *argv[])
if (m & 020) test25e();
}
quit();
return(-1); /* Unreachable */
}
void test25a()
+2
View File
@@ -41,6 +41,8 @@ int main(int argc, char *argv[])
if (m & 0004) test26c();
}
quit();
return(-1); /* Unreachable */
}
void test26a()
+2
View File
@@ -47,6 +47,8 @@ int main(int argc, char *argv[])
if (m & 0004) test27c();
}
quit();
return(-1); /* Unreachable */
}
void test27a()
+2
View File
@@ -59,6 +59,8 @@ int main(int argc, char *argv[])
if (m & 0004) test28c();
}
quit();
return(-1); /* Unreachable */
}
void test28a()
+2
View File
@@ -58,6 +58,8 @@ int main(int argc, char *argv[])
if (m & 0004) test29c();
}
quit();
return(-1); /* Unreachable */
}
void test29a()
+2
View File
@@ -57,6 +57,8 @@ int main(int argc, char *argv[])
if (m & 0004) test30c();
}
quit();
return(-1); /* Unreachable */
}
void test30a()
+2
View File
@@ -49,6 +49,8 @@ int main(int argc, char *argv[])
if (m & 0004) test32c();
}
quit();
return(-1); /* Unreachable */
}
#define BUF_SIZE 1024
+2
View File
@@ -77,6 +77,8 @@ int main(int argc, char *argv[])
if (m & 0004) test34c();
}
quit();
return(-1); /* Unreachable */
}
void test34a()
+2
View File
@@ -102,6 +102,8 @@ char *argv[];
}
quit();
return(-1); /* Unreachable */
}
void test37a()
+2
View File
@@ -53,6 +53,8 @@ int main(int argc, char *argv[])
if (m & 0004) test38c();
}
quit();
return(-1); /* Unreachable */
}
void test38a()
+2
View File
@@ -10,7 +10,9 @@ _PROTOTYPE( void test39a, (void) );
int main(int argc, char *argv[])
{
start(39);
test39a();
quit();
return(-1); /* Unreachable */
}
void test39a()
+2
View File
@@ -60,6 +60,8 @@ int main(int argc, char *argv[])
group_test(); /* Perform some tests that mimic actual use */
quit();
return(-1); /* Unreachable */
}
void limit_test() {
+2
View File
@@ -276,4 +276,6 @@ int main(void)
/* this was all */
quit();
return(-1); /* Unreachable */
}
+1
View File
@@ -51,4 +51,5 @@ int main(void)
start(54);
do_test();
quit();
return(-1); /* Unreachable */
}
+1
View File
@@ -175,6 +175,7 @@ int main(int argc, char* argv[])
start(58);
do_test();
quit();
return(-1); /* Unreachable */
}
+5 -41
View File
@@ -18,7 +18,7 @@
#include <setjmp.h>
#define ITERATIONS 4
#define MAX_ERROR 4
#define MAX_ERROR 3
#define ITEMS 32
#define READ 10
#define WRITE 20
@@ -28,7 +28,9 @@
char buf[ITEMS] = {0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9};
int subtest, errct, xfd;
#include "common.c"
int subtes, xfd;
int whence = SEEK_SET, func_code = F_SETLK;
extern char **environ;
@@ -50,9 +52,7 @@ _PROTOTYPE(void test7j, (void));
_PROTOTYPE(void cloexec_test, (void));
_PROTOTYPE(int set, (int how, int first, int last));
_PROTOTYPE(int locked, (int b));
_PROTOTYPE(void e, (int n));
_PROTOTYPE(void sigfunc, (int s));
_PROTOTYPE(void quit, (void));
int main(argc, argv)
int argc;
@@ -61,15 +61,10 @@ char *argv[];
int i, m = 0xFFFF;
sync();
if (argc == 2) m = atoi(argv[1]);
if (m == 0) cloexec_test(); /* important; do not remove this! */
printf("Test 7 ");
fflush(stdout);
system("rm -rf DIR_07; mkdir DIR_07");
chdir("DIR_07");
start(7);
for (i = 0; i < ITERATIONS; i++) {
if (m & 00001) timed_test(test7a);
@@ -690,39 +685,8 @@ int b;
return(WEXITSTATUS(status));
}
void e(n)
int n;
{
int err_num = errno; /* save errno in case printf clobbers it */
printf("Subtest %d, error %d errno=%d ", subtest, n, errno);
fflush(stdout);
errno = err_num; /* restore errno, just in case */
perror("");
if (errct++ > MAX_ERROR) {
printf("Too many errors; test aborted\n");
chdir("..");
system("rm -rf DIR*");
exit(1);
}
}
void sigfunc(s)
int s; /* for ANSI */
{
}
void quit()
{
chdir("..");
system("rm -rf DIR*");
if (errct == 0) {
printf("ok\n");
exit(0);
} else {
printf("%d errors\n", errct);
exit(1);
}
}