diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-07-27 15:08:38 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-07-27 15:08:38 +0000 |
commit | 170d4a2551cd751f6a93566dacbf635566774305 (patch) | |
tree | cfcd17bd15df2b381615d05fabb0bed184dd3d20 | |
parent | c295f38b62b37923b9774ea461ee26796bf279c8 (diff) |
Fix all clang warnings in libc regress and cleanup some make files.
-rw-r--r-- | regress/lib/libc/atexit/Makefile | 13 | ||||
-rw-r--r-- | regress/lib/libc/atexit/atexit_test.c | 5 | ||||
-rw-r--r-- | regress/lib/libc/cephes/ieetst.c | 3 | ||||
-rw-r--r-- | regress/lib/libc/cephes/mconf.h | 4 | ||||
-rw-r--r-- | regress/lib/libc/db/dbtest.c | 28 | ||||
-rw-r--r-- | regress/lib/libc/locale/Makefile | 10 | ||||
-rw-r--r-- | regress/lib/libc/locale/check_isw/Makefile | 7 | ||||
-rw-r--r-- | regress/lib/libc/locale/check_isw/check_isw.c | 4 | ||||
-rw-r--r-- | regress/lib/libc/locale/mbrtowc/Makefile | 10 | ||||
-rw-r--r-- | regress/lib/libc/locale/mbrtowc/test_mbrtowc.c | 7 | ||||
-rw-r--r-- | regress/lib/libc/locale/setlocale/Makefile | 5 | ||||
-rw-r--r-- | regress/lib/libc/locale/wcrtomb/Makefile | 10 | ||||
-rw-r--r-- | regress/lib/libc/locale/wcrtomb/test_wcrtomb.c | 7 | ||||
-rw-r--r-- | regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c | 3 | ||||
-rw-r--r-- | regress/lib/libc/malloc/malloc_ulimit2/malloc_ulimit2.c | 3 | ||||
-rw-r--r-- | regress/lib/libc/sprintf/Makefile | 11 | ||||
-rw-r--r-- | regress/lib/libc/telldir/utils.c | 4 | ||||
-rw-r--r-- | regress/lib/libc/vis/vis_test.c | 8 |
18 files changed, 67 insertions, 75 deletions
diff --git a/regress/lib/libc/atexit/Makefile b/regress/lib/libc/atexit/Makefile index 057844d767f..eb8c55e91ec 100644 --- a/regress/lib/libc/atexit/Makefile +++ b/regress/lib/libc/atexit/Makefile @@ -1,12 +1,11 @@ -# $OpenBSD: Makefile,v 1.6 2015/10/25 18:01:24 guenther Exp $ +# $OpenBSD: Makefile,v 1.7 2017/07/27 15:08:37 bluhm Exp $ -NOMAN= -PROG=atexit_test -CPPFLAGS+=-I${.CURDIR}/../../../../lib/libc -D'PROTO_NORMAL(x)=__asm("")' -CLEANFILES+= invalid.out valid.out -LDADD=-static +PROG = atexit_test +CPPFLAGS = -I${.CURDIR}/../../../../lib/libc +CLEANFILES = invalid.out valid.out +LDADD = -static -run-regress-atexit_test: ${PROG} +run-regress-${PROG}: ${PROG} ./${PROG} -valid 2>${.OBJDIR}/valid.out cmp -s ${.OBJDIR}/valid.out ${.CURDIR}/valid.ok ./${PROG} -invalid-atexit 2>${.OBJDIR}/invalid.out diff --git a/regress/lib/libc/atexit/atexit_test.c b/regress/lib/libc/atexit/atexit_test.c index e1ea82f827b..b060a9b341f 100644 --- a/regress/lib/libc/atexit/atexit_test.c +++ b/regress/lib/libc/atexit/atexit_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atexit_test.c,v 1.8 2015/10/25 04:11:00 guenther Exp $ */ +/* $OpenBSD: atexit_test.c,v 1.9 2017/07/27 15:08:37 bluhm Exp $ */ /* * Copyright (c) 2002 Daniel Hartmeier @@ -39,6 +39,9 @@ #include <string.h> #include <signal.h> #include <unistd.h> + +#include "include/namespace.h" +#include "hidden/stdlib.h" #include "stdlib/atexit.h" void handle_first(void); diff --git a/regress/lib/libc/cephes/ieetst.c b/regress/lib/libc/cephes/ieetst.c index 41dfd6a96e5..974fb65c137 100644 --- a/regress/lib/libc/cephes/ieetst.c +++ b/regress/lib/libc/cephes/ieetst.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieetst.c,v 1.2 2011/07/03 13:39:07 martynas Exp $ */ +/* $OpenBSD: ieetst.c,v 1.3 2017/07/27 15:08:37 bluhm Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net> @@ -94,6 +94,7 @@ static int etrflag; void chkit(), printerr(), mnrand(), etrand(), shownoncrit(); void chkid(), pvec(); +int main() { int i, iprec, retval = 0; diff --git a/regress/lib/libc/cephes/mconf.h b/regress/lib/libc/cephes/mconf.h index 7527193e2ac..410849c3551 100644 --- a/regress/lib/libc/cephes/mconf.h +++ b/regress/lib/libc/cephes/mconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mconf.h,v 1.2 2014/07/21 01:51:11 guenther Exp $ */ +/* $OpenBSD: mconf.h,v 1.3 2017/07/27 15:08:37 bluhm Exp $ */ /* * Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net> @@ -185,3 +185,5 @@ int mtherr(); /* Variable for error reporting. See mtherr.c. */ extern int merror; + +int drand(double *); diff --git a/regress/lib/libc/db/dbtest.c b/regress/lib/libc/db/dbtest.c index 5087f0a025a..6a79e4c1875 100644 --- a/regress/lib/libc/db/dbtest.c +++ b/regress/lib/libc/db/dbtest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dbtest.c,v 1.15 2017/04/16 16:04:48 kettenis Exp $ */ +/* $OpenBSD: dbtest.c,v 1.16 2017/07/27 15:08:37 bluhm Exp $ */ /* $NetBSD: dbtest.c,v 1.8 1996/05/03 21:57:48 cgd Exp $ */ /*- @@ -50,7 +50,7 @@ enum S { COMMAND, COMPARE, GET, PUT, REMOVE, SEQ, SEQFLAG, KEY, DATA }; void compare(DBT *, DBT *); DBTYPE dbtype(char *); void dump(DB *, int); -void dberr(const char *, ...); +void __dead dberr(const char *, ...); void get(DB *, DBT *); void getdata(DB *, DBT *, DBT *); void put(DB *, DBT *, DBT *); @@ -61,7 +61,7 @@ void *rfile(char *, size_t *); void seq(DB *, DBT *); u_int setflags(char *); void *setinfo(DBTYPE, char *); -void usage(void); +void __dead usage(void); void *xmalloc(char *, size_t); DBTYPE type; /* Database type. */ @@ -345,7 +345,7 @@ compare(db1, db2) len = MIN(db1->size, db2->size); for (p1 = db1->data, p2 = db2->data; len--;) if (*p1++ != *p2++) { - printf("compare failed at offset %d\n", + printf("compare failed at offset %ld\n", p1 - (u_char *)db1->data); break; } @@ -372,8 +372,8 @@ get(dbp, kp) if (ofd != STDOUT_FILENO) (void)write(ofd, NOSUCHKEY, sizeof(NOSUCHKEY) - 1); else - (void)fprintf(stderr, "%d: %.*s: %s", - lineno, MIN(kp->size, 20), kp->data, NOSUCHKEY); + (void)fprintf(stderr, "%lu: %.*s: %s", lineno, + MIN((int)kp->size, 20), kp->data, NOSUCHKEY); #undef NOSUCHKEY break; } @@ -429,11 +429,11 @@ rem(dbp, kp) if (ofd != STDOUT_FILENO) (void)write(ofd, NOSUCHKEY, sizeof(NOSUCHKEY) - 1); else if (flags != R_CURSOR) - (void)fprintf(stderr, "%d: %.*s: %s", - lineno, MIN(kp->size, 20), kp->data, NOSUCHKEY); + (void)fprintf(stderr, "%lu: %.*s: %s", lineno, + MIN((int)kp->size, 20), kp->data, NOSUCHKEY); else (void)fprintf(stderr, - "%d: rem of cursor failed\n", lineno); + "%lu: rem of cursor failed\n", lineno); #undef NOSUCHKEY break; } @@ -473,11 +473,11 @@ seq(dbp, kp) if (ofd != STDOUT_FILENO) (void)write(ofd, NOSUCHKEY, sizeof(NOSUCHKEY) - 1); else if (flags == R_CURSOR) - (void)fprintf(stderr, "%d: %.*s: %s", - lineno, MIN(kp->size, 20), kp->data, NOSUCHKEY); + (void)fprintf(stderr, "%lu: %.*s: %s", lineno, + MIN((int)kp->size, 20), kp->data, NOSUCHKEY); else (void)fprintf(stderr, - "%d: seq (%s) failed\n", lineno, sflags(flags)); + "%lu: seq (%s) failed\n", lineno, sflags(flags)); #undef NOSUCHKEY break; } @@ -708,7 +708,7 @@ xmalloc(text, len) return (p); } -void +void __dead usage() { (void)fprintf(stderr, @@ -716,7 +716,7 @@ usage() exit(1); } -void +void __dead dberr(const char *fmt, ...) { va_list ap; diff --git a/regress/lib/libc/locale/Makefile b/regress/lib/libc/locale/Makefile index b8d046c6780..b3ca6bad857 100644 --- a/regress/lib/libc/locale/Makefile +++ b/regress/lib/libc/locale/Makefile @@ -1,11 +1,5 @@ -# $OpenBSD: Makefile,v 1.5 2016/09/05 09:53:53 schwarze Exp $ +# $OpenBSD: Makefile,v 1.6 2017/07/27 15:08:37 bluhm Exp $ -.if defined(REGRESS_FULL) || make(clean) || make(cleandir) || make(obj) -SUBDIR+= check_isw -.endif - -SUBDIR += mbrtowc setlocale wcrtomb - -install: +SUBDIR = check_isw mbrtowc setlocale wcrtomb .include <bsd.subdir.mk> diff --git a/regress/lib/libc/locale/check_isw/Makefile b/regress/lib/libc/locale/check_isw/Makefile index 0885968fd1a..cd79d6cb7fe 100644 --- a/regress/lib/libc/locale/check_isw/Makefile +++ b/regress/lib/libc/locale/check_isw/Makefile @@ -1,9 +1,8 @@ -# $OpenBSD: Makefile,v 1.1 2005/08/11 21:57:02 espie Exp $ +# $OpenBSD: Makefile,v 1.2 2017/07/27 15:08:37 bluhm Exp $ -NOMAN= -PROG=check_isw +PROG = check_isw -run-regress-check_isw: ${PROG} +run-regress-${PROG}: ${PROG} ./${PROG} >/dev/null .include <bsd.regress.mk> diff --git a/regress/lib/libc/locale/check_isw/check_isw.c b/regress/lib/libc/locale/check_isw/check_isw.c index 9386267f611..718f3878833 100644 --- a/regress/lib/libc/locale/check_isw/check_isw.c +++ b/regress/lib/libc/locale/check_isw/check_isw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: check_isw.c,v 1.1 2005/08/11 21:57:02 espie Exp $ */ +/* $OpenBSD: check_isw.c,v 1.2 2017/07/27 15:08:37 bluhm Exp $ */ /* * Copyright (c) 2005 Marc Espie <espie@openbsd.org> * @@ -69,7 +69,7 @@ test1() if (i % 8 == 7) printf("\n"); } - printf("%\n"); + printf("\n"); } void diff --git a/regress/lib/libc/locale/mbrtowc/Makefile b/regress/lib/libc/locale/mbrtowc/Makefile index 0aa1026e0a9..54363839114 100644 --- a/regress/lib/libc/locale/mbrtowc/Makefile +++ b/regress/lib/libc/locale/mbrtowc/Makefile @@ -1,9 +1,5 @@ -# $OpenBSD: Makefile,v 1.1 2016/09/03 18:14:18 schwarze Exp $ +# $OpenBSD: Makefile,v 1.2 2017/07/27 15:08:37 bluhm Exp $ -PROG = test_mbrtowc -NOMAN = +PROG = test_mbrtowc -regress: ${PROG} - ./${PROG} - -.include <bsd.prog.mk> +.include <bsd.regress.mk> diff --git a/regress/lib/libc/locale/mbrtowc/test_mbrtowc.c b/regress/lib/libc/locale/mbrtowc/test_mbrtowc.c index 5794791ffbe..5926d25fd00 100644 --- a/regress/lib/libc/locale/mbrtowc/test_mbrtowc.c +++ b/regress/lib/libc/locale/mbrtowc/test_mbrtowc.c @@ -1,3 +1,4 @@ +/* $OpenBSD: test_mbrtowc.c,v 1.2 2017/07/27 15:08:37 bluhm Exp $ */ /* * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> * @@ -33,12 +34,12 @@ onetest(const char *name, const char *in, size_t insz, sz = mbrtowc(&wc, in, insz, &mbs); if (errno != outerr) - err(1, "%d %s(%zd)", MB_CUR_MAX, name, insz); + err(1, "%zu %s(%zd)", MB_CUR_MAX, name, insz); if (sz != outsz || (out != WEOF && wc != out)) - errx(1, "%d %s(%zd) = (%zd, %d) != (%zd, %d)", + errx(1, "%zu %s(%zd) = (%zd, %d) != (%zd, %d)", MB_CUR_MAX, name, insz, sz, wc, outsz, out); if (mbsinit(&mbs) == (insz && outsz == (size_t)-2)) - errx(1, "%d %s(%zd) mbsinit", MB_CUR_MAX, name, insz); + errx(1, "%zu %s(%zd) mbsinit", MB_CUR_MAX, name, insz); if (errno == 0 && outerr == 0) return; errno = 0; diff --git a/regress/lib/libc/locale/setlocale/Makefile b/regress/lib/libc/locale/setlocale/Makefile index d0e7f07770d..966f7926e56 100644 --- a/regress/lib/libc/locale/setlocale/Makefile +++ b/regress/lib/libc/locale/setlocale/Makefile @@ -1,9 +1,8 @@ -# $OpenBSD: Makefile,v 1.1 2015/07/07 17:38:53 semarie Exp $ +# $OpenBSD: Makefile,v 1.2 2017/07/27 15:08:37 bluhm Exp $ -NOMAN = PROG = setlocale -run-regress-setlocale: ${PROG} +run-regress-${PROG}: ${PROG} env -i LC_ALL=fr_FR.UTF-8 ./${PROG} .include <bsd.regress.mk> diff --git a/regress/lib/libc/locale/wcrtomb/Makefile b/regress/lib/libc/locale/wcrtomb/Makefile index 5179cd56689..b09cecc454b 100644 --- a/regress/lib/libc/locale/wcrtomb/Makefile +++ b/regress/lib/libc/locale/wcrtomb/Makefile @@ -1,9 +1,5 @@ -# $OpenBSD: Makefile,v 1.1 2016/09/04 09:38:02 schwarze Exp $ +# $OpenBSD: Makefile,v 1.2 2017/07/27 15:08:37 bluhm Exp $ -PROG = test_wcrtomb -NOMAN = +PROG = test_wcrtomb -regress: ${PROG} - ./${PROG} - -.include <bsd.prog.mk> +.include <bsd.regress.mk> diff --git a/regress/lib/libc/locale/wcrtomb/test_wcrtomb.c b/regress/lib/libc/locale/wcrtomb/test_wcrtomb.c index 6539d9f1bd1..26b21fdd5bf 100644 --- a/regress/lib/libc/locale/wcrtomb/test_wcrtomb.c +++ b/regress/lib/libc/locale/wcrtomb/test_wcrtomb.c @@ -1,3 +1,4 @@ +/* $OpenBSD: test_wcrtomb.c,v 1.2 2017/07/27 15:08:37 bluhm Exp $ */ /* * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> * @@ -35,13 +36,13 @@ onetest(const char *name, const wchar_t wcin, int outerr, const char *out) outsz = out == NULL ? (size_t)-1 : *out == '\0' ? 1 : strlen(out); sz = wcrtomb(buf, wcin, &mbs); if (errno != outerr) - err(1, "%d %s U+%04X", MB_CUR_MAX, name, wcin); + err(1, "%zu %s U+%04X", MB_CUR_MAX, name, wcin); if (sz != outsz || (out != NULL && strncmp(buf, out, sz))) - errx(1, "%d %s U+%04X: %4.4s(%zd) != %4.4s(%zd)", + errx(1, "%zu %s U+%04X: %4.4s(%zd) != %4.4s(%zd)", MB_CUR_MAX, name, wcin, buf, sz, out == NULL ? "(NULL)" : out, outsz); if (mbsinit(&mbs) == 0) - errx(1, "%d %s U+%04X mbsinit", MB_CUR_MAX, name, wcin); + errx(1, "%zu %s U+%04X mbsinit", MB_CUR_MAX, name, wcin); if (errno == 0 && outerr == 0) return; errno = 0; diff --git a/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c b/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c index 99e805e8e18..94f7eb16b56 100644 --- a/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c +++ b/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc_ulimit1.c,v 1.2 2006/05/16 05:47:13 otto Exp $ */ +/* $OpenBSD: malloc_ulimit1.c,v 1.3 2017/07/27 15:08:37 bluhm Exp $ */ /* Public Domain, 2006, Otto Moerbeek <otto@drijf.net> */ @@ -22,6 +22,7 @@ #define STARTI 1300 #define FACTOR 1024 +int main() { struct rlimit lim; diff --git a/regress/lib/libc/malloc/malloc_ulimit2/malloc_ulimit2.c b/regress/lib/libc/malloc/malloc_ulimit2/malloc_ulimit2.c index ca8e8f438a2..95106490904 100644 --- a/regress/lib/libc/malloc/malloc_ulimit2/malloc_ulimit2.c +++ b/regress/lib/libc/malloc/malloc_ulimit2/malloc_ulimit2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc_ulimit2.c,v 1.2 2006/05/16 05:47:13 otto Exp $ */ +/* $OpenBSD: malloc_ulimit2.c,v 1.3 2017/07/27 15:08:37 bluhm Exp $ */ /* Public Domain, 2006, Otto Moerbeek <otto@drijf.net> */ @@ -11,6 +11,7 @@ #define FACTOR 1024 +int main() { struct rlimit lim; diff --git a/regress/lib/libc/sprintf/Makefile b/regress/lib/libc/sprintf/Makefile index 47bab9cdd36..514d795f2f5 100644 --- a/regress/lib/libc/sprintf/Makefile +++ b/regress/lib/libc/sprintf/Makefile @@ -1,10 +1,7 @@ -# $OpenBSD: Makefile,v 1.1 2003/05/15 04:23:49 deraadt Exp $ +# $OpenBSD: Makefile,v 1.2 2017/07/27 15:08:37 bluhm Exp $ -NOMAN= -PROG=sprintf_test -CPPFLAGS+=-I${.CURDIR}/../../../../lib/libc - -run-regress-atexit_test: ${PROG} - ./${PROG} +PROG = sprintf_test +CFLAGS = -Wno-format +CPPFLAGS = -I${.CURDIR}/../../../../lib/libc .include <bsd.regress.mk> diff --git a/regress/lib/libc/telldir/utils.c b/regress/lib/libc/telldir/utils.c index 6a4101aba3f..7fb0401d70e 100644 --- a/regress/lib/libc/telldir/utils.c +++ b/regress/lib/libc/telldir/utils.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utils.c,v 1.1 2013/11/03 00:20:24 schwarze Exp $ */ +/* $OpenBSD: utils.c,v 1.2 2017/07/27 15:08:37 bluhm Exp $ */ /* Written by Otto Moerbeek, 2006, Public domain. */ @@ -39,7 +39,7 @@ delfiles(void) dp = opendir("d"); if (dp == NULL) err(1, "opendir"); - while (f = readdir(dp)) { + while ((f = readdir(dp))) { if (strcmp(f->d_name, ".") == 0 || strcmp(f->d_name, "..") == 0) continue; diff --git a/regress/lib/libc/vis/vis_test.c b/regress/lib/libc/vis/vis_test.c index 61c6edbd37f..92f2cee32d9 100644 --- a/regress/lib/libc/vis/vis_test.c +++ b/regress/lib/libc/vis/vis_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vis_test.c,v 1.4 2015/07/20 01:52:28 millert Exp $ */ +/* $OpenBSD: vis_test.c,v 1.5 2017/07/27 15:08:37 bluhm Exp $ */ /* Public domain. 2005, Otto Moerbeek */ @@ -81,7 +81,8 @@ main(int argc, char *argv[]) } } else if (o > strlen(ibuf) * 4) { dotitle(i, j); - printf("wants too much %d %d\n", o, strlen(ibuf) * 4); + printf("wants too much %zd %zu\n", + o, strlen(ibuf) * 4); continue; } @@ -94,7 +95,8 @@ main(int argc, char *argv[]) fail = 1; } else if (r != strlen(ibuf)) { dotitle(i, j); - printf("rlen %d != inlen %d\n", r, strlen(ibuf)); + printf("rlen %zd != inlen %zu\n", + r, strlen(ibuf)); printf("%s\n", obuf); printf("%s\n", rbuf); fail = 1; |