From bb97a3d43c2b7f2a5b4f05069e3bb12383a9e20d Mon Sep 17 00:00:00 2001 From: bdrewery Date: Fri, 4 Dec 2015 03:17:47 +0000 Subject: Fix LDADD/DPADD that should be LIBADD. Sponsored by: EMC / Isilon Storage Division --- lib/libc/tests/gen/Makefile | 18 ++++++------------ lib/libc/tests/hash/Makefile | 6 ++---- lib/libc/tests/net/Makefile | 3 +-- lib/libc/tests/regex/Makefile | 3 +-- lib/libc/tests/rpc/Makefile | 3 +-- lib/libc/tests/setjmp/Makefile | 3 +-- lib/libc/tests/ssp/Makefile | 3 +-- lib/libc/tests/stdio/Makefile | 7 ++----- lib/libc/tests/stdlib/Makefile | 6 ++---- lib/libc/tests/string/Makefile | 7 ++----- lib/libc/tests/sys/Makefile | 6 ++---- lib/libc/tests/tls/Makefile | 11 +++++------ lib/libc/tests/ttyio/Makefile | 3 +-- 13 files changed, 27 insertions(+), 52 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/tests/gen/Makefile b/lib/libc/tests/gen/Makefile index 476b5b7..b700312 100644 --- a/lib/libc/tests/gen/Makefile +++ b/lib/libc/tests/gen/Makefile @@ -45,20 +45,14 @@ NETBSD_ATF_TESTS_C+= vis_test .include "../Makefile.netbsd-tests" -LDADD.humanize_number_test+= -lutil -DPADD.humanize_number_test+= ${LIBUTIL} +LIBADD.humanize_number_test+= util -LDADD.fpclassify_test+= -lm -DPADD.fpclassify_test+= ${LIBM} -LDADD.fpsetround_test+= -lm -DPADD.fpsetround_test+= ${LIBM} -LDADD.siginfo_test+= -lm -DPADD.siginfo_test+= ${LIBM} +LIBADD.fpclassify_test+=m +LIBADD.fpsetround_test+=m +LIBADD.siginfo_test+= m -LDADD.nice_test+= -lpthread -DPADD.nice_test+= ${LIBPTHREAD} -LDADD.syslog_test+= -lpthread -DPADD.syslog_test+= ${LIBPTHREAD} +LIBADD.nice_test+= pthread +LIBADD.syslog_test+= pthread CFLAGS+= -I${.CURDIR} diff --git a/lib/libc/tests/hash/Makefile b/lib/libc/tests/hash/Makefile index 6887253..6facb5a 100644 --- a/lib/libc/tests/hash/Makefile +++ b/lib/libc/tests/hash/Makefile @@ -22,10 +22,8 @@ FILES+= data/sha1test-in FILES+= data/sha1test-out FILES+= data/sha1test2-out -DPADD+= ${LIBMD} -LDADD+= -lmd -DPADD.sha2_test+= ${LIBCRYPTO} -LDADD.sha2_test+= -lcrypto +LIBADD+= md +LIBADD.sha2_test+= crypto CFLAGS.sha2_test+= -I${SRCTOP}/crypto/openssh/openbsd-compat CFLAGS.sha2_test+= -I${SRCTOP}/crypto/openssh diff --git a/lib/libc/tests/net/Makefile b/lib/libc/tests/net/Makefile index 3e437a0..e126848 100644 --- a/lib/libc/tests/net/Makefile +++ b/lib/libc/tests/net/Makefile @@ -23,8 +23,7 @@ PROGS+= h_protoent PROGS+= h_servent PROGS+= h_dns_server -DPADD.h_nsd_recurse+= ${LIBPTHREAD} -LDADD.h_nsd_recurse+= -lpthread +LIBADD.h_nsd_recurse+= pthread CLEANFILES+= aton_ether_subr.c aton_ether_subr.c: gen_ether_subr ${SRCTOP}/sys/net/if_ethersubr.c diff --git a/lib/libc/tests/regex/Makefile b/lib/libc/tests/regex/Makefile index fa60f6e..946bc44 100644 --- a/lib/libc/tests/regex/Makefile +++ b/lib/libc/tests/regex/Makefile @@ -51,7 +51,6 @@ CFLAGS.$t+= -I${TESTSRC} ${IMPLEMENTATION} .include "../Makefile.netbsd-tests" -DPADD.regex_att_test+= ${LIBUTIL} -LDADD.regex_att_test+= -lutil +LIBADD.regex_att_test+= util .include diff --git a/lib/libc/tests/rpc/Makefile b/lib/libc/tests/rpc/Makefile index f9819d3..d7780ef 100644 --- a/lib/libc/tests/rpc/Makefile +++ b/lib/libc/tests/rpc/Makefile @@ -18,8 +18,7 @@ h_testbits_xdr.c: ${RPCSRC} h_testbits.h CLEANFILES+= ${RPCSRC:.x=.h} ${RPCSRC:.x=.c} h_testbits_xdr.c CFLAGS+= -I${.OBJDIR} -LDADD+= -lrpcsvc -lutil -DPADD+= ${LIBRPCSVC} ${LIBUTIL} +LIBADD+= rpcsvc util .include "../Makefile.netbsd-tests" diff --git a/lib/libc/tests/setjmp/Makefile b/lib/libc/tests/setjmp/Makefile index ac962c2..39b0a96 100644 --- a/lib/libc/tests/setjmp/Makefile +++ b/lib/libc/tests/setjmp/Makefile @@ -3,8 +3,7 @@ NETBSD_ATF_TESTS_C= setjmp_test NETBSD_ATF_TESTS_C+= threadjmp_test -DPADD.threadjmp_test+= ${LIBPTHREAD} -LDADD.threadjmp_test+= -lpthread +LIBADD.t_threadjmp+= pthread WARNS?= 4 diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile index dff1578..6055251 100644 --- a/lib/libc/tests/ssp/Makefile +++ b/lib/libc/tests/ssp/Makefile @@ -10,8 +10,7 @@ CFLAGS.h_raw+= -fstack-protector-all -Wstack-protector CFLAGS.h_raw+= -fsanitize=bounds .elif ${COMPILER_TYPE} == "gcc" CFLAGS.h_raw+= --param ssp-buffer-size=1 -DPADD+= ${LIBSSP} -LDADD+= -lssp +LIBADD+= ssp .endif NETBSD_ATF_TESTS_SH= ssp_test diff --git a/lib/libc/tests/stdio/Makefile b/lib/libc/tests/stdio/Makefile index 7896422..72685e0 100644 --- a/lib/libc/tests/stdio/Makefile +++ b/lib/libc/tests/stdio/Makefile @@ -28,11 +28,8 @@ NETBSD_ATF_TESTS_C+= popen_test NETBSD_ATF_TESTS_C+= printf_test NETBSD_ATF_TESTS_C+= scanf_test -DPADD.printfloat_test+= ${LIBM} -LDADD.printfloat_test+= -lm - -DPADD.scanfloat_test+= ${LIBM} -LDADD.scanfloat_test+= -lm +LIBADD.printfloat_test+= m +LIBADD.scanfloat_test+= m .if ${COMPILER_TYPE} == "gcc" # 90: use of assignment suppression and length modifier together in scanf format diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile index cd2c06e..4bc1354 100644 --- a/lib/libc/tests/stdlib/Makefile +++ b/lib/libc/tests/stdlib/Makefile @@ -36,11 +36,9 @@ CFLAGS+= -I${.CURDIR} CFLAGS.$t+= -I${LIBNETBSD_SRCDIR} -I${SRCTOP}/contrib/netbsd-tests LDFLAGS.$t+= -L${LIBNETBSD_OBJDIR} -DPADD.$t+= ${LIBNETBSD} ${LIBUTIL} -LDADD.$t+= -lnetbsd -lutil +LIBADD.${t}+= netbsd util .endfor -DPADD.strtod_test+= ${LIBM} -LDADD.strtod_test+= -lm +LIBADD.strtod_test+= m .include diff --git a/lib/libc/tests/string/Makefile b/lib/libc/tests/string/Makefile index 14044f4..9c677b7 100644 --- a/lib/libc/tests/string/Makefile +++ b/lib/libc/tests/string/Makefile @@ -27,10 +27,7 @@ SRCS.strerror2_test= strerror_test.c .include "../Makefile.netbsd-tests" -LDADD.memchr_test+= -lmd -DPADD.memchr_test+= ${LIBMD} - -LDADD.memcpy_test+= -lmd -DPADD.memcpy_test+= ${LIBMD} +LIBADD.memchr_test+= md +LIBADD.memcpy_test+= md .include diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile index 816b962..efc892c 100644 --- a/lib/libc/tests/sys/Makefile +++ b/lib/libc/tests/sys/Makefile @@ -57,10 +57,8 @@ NETBSD_ATF_TESTS_C+= umask_test NETBSD_ATF_TESTS_C+= unlink_test NETBSD_ATF_TESTS_C+= write_test -DPADD.getpid_test+= ${LIBPTHREAD} -LDADD.getpid_test+= -lpthread -DPADD.timer_create_test+= ${LIBRT} -LDADD.timer_create_test+= -lrt +LIBADD.getpid_test+= pthread +LIBADD.timer_create_test+= rt .include "../Makefile.netbsd-tests" diff --git a/lib/libc/tests/tls/Makefile b/lib/libc/tests/tls/Makefile index b6b6719..cbf441d 100644 --- a/lib/libc/tests/tls/Makefile +++ b/lib/libc/tests/tls/Makefile @@ -18,17 +18,16 @@ NETBSD_ATF_TESTS_C+= tls_dynamic_test DSODIR= ${.OBJDIR}/../tls_dso -DPADD.tls_static_test+= ${LIBPTHREAD} -LDADD.tls_static_test+= -lpthread +LIBADD.tls_static_test+= pthread LDFLAGS.tls_static_test+= -static SRCS.tls_static_test= t_tls_static.c t_tls_static_helper.c -DPADD.tls_dynamic_test+= ${LIBPTHREAD} ${DSODIR}/libh_tls_dynamic.so -LDADD.tls_dynamic_test+= -lpthread -lh_tls_dynamic +DPADD.tls_dynamic_test+= ${DSODIR}/libh_tls_dynamic.so +LDADD.tls_dynamic_test+= -lh_tls_dynamic LDFLAGS.tls_dynamic_test+= -Wl,-rpath,${TESTSDIR} -L${DSODIR} +LIBADD.tls_dynamic_test+= pthread -DPADD.tls_dlopen_test+= ${LIBPTHREAD} -LDADD.tls_dlopen_test+= -lpthread +LIBADD.tls_dlopen_test+= pthread LDFLAGS.tls_dlopen_test+= -Wl,-rpath,${TESTSDIR} -Wl,-export-dynamic .include diff --git a/lib/libc/tests/ttyio/Makefile b/lib/libc/tests/ttyio/Makefile index 242f332..d5b8f01 100644 --- a/lib/libc/tests/ttyio/Makefile +++ b/lib/libc/tests/ttyio/Makefile @@ -5,8 +5,7 @@ # TODO: ptm_test NETBSD_ATF_TESTS_C= ttyio_test -DPADD.ttyio_test+= ${LIBUTIL} -LDADD.ttyio_test+= -lutil +LIBADD.ttyio_test+= util .include "../Makefile.netbsd-tests" -- cgit v1.1 From d6f598ef531d9245efa669fe898542821a2b173f Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 5 Dec 2015 01:12:58 +0000 Subject: Fix -Wformat warnings by using the correct format qualifiers MFC after: 1 week Sponsored by: EMC / Isilon Storage Division --- lib/libc/regex/grot/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libc') diff --git a/lib/libc/regex/grot/debug.c b/lib/libc/regex/grot/debug.c index caa2ca3..af8e4f5 100644 --- a/lib/libc/regex/grot/debug.c +++ b/lib/libc/regex/grot/debug.c @@ -186,7 +186,7 @@ FILE *d; fprintf(d, ">"); break; default: - fprintf(d, "!%d(%d)!", OP(*s), opnd); + fprintf(d, "!%ld(%ld)!", OP(*s), (long)opnd); break; } if (!done) -- cgit v1.1 From ae11a85edd137c0ee3c69d1ad223bbde9b6117d3 Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 5 Dec 2015 01:13:18 +0000 Subject: - Use ANSI C function prototypes/definitions instead of K&R style ones - Add a missing return type for main(..) MFC after: 1 week Sponsored by: EMC / Isilon Storage Division --- lib/libc/regex/grot/main.c | 40 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/regex/grot/main.c b/lib/libc/regex/grot/main.c index 9563de4..72319f6 100644 --- a/lib/libc/regex/grot/main.c +++ b/lib/libc/regex/grot/main.c @@ -26,9 +26,8 @@ extern void regprint(); /* - main - do the simple case, hand off to regress() for regression */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { regex_t re; # define NS 10 @@ -126,8 +125,7 @@ char *argv[]; == void regress(FILE *in); */ void -regress(in) -FILE *in; +regress(FILE *in) { char inbuf[1000]; # define MAXF 10 @@ -201,15 +199,10 @@ FILE *in; /* - try - try it, and report on problems == void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts); + - opts: may not match f1 */ void -try(f0, f1, f2, f3, f4, opts) -char *f0; -char *f1; -char *f2; -char *f3; -char *f4; -int opts; /* may not match f1 */ +try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts) { regex_t re; # define NSUBS 10 @@ -311,12 +304,11 @@ int opts; /* may not match f1 */ /* - options - pick options out of a regression-test string + - type: 'c' - compile, 'e' - exec == int options(int type, char *s); */ int -options(type, s) -int type; /* 'c' compile, 'e' exec */ -char *s; +options(int type, char *s) { char *p; int o = (type == 'c') ? copts : eopts; @@ -371,9 +363,7 @@ char *s; == int opt(int c, char *s); */ int /* predicate */ -opt(c, s) -int c; -char *s; +opt(int c, char *s) { return(strchr(s, c) != NULL); } @@ -383,8 +373,7 @@ char *s; == void fixstr(char *p); */ void -fixstr(p) -char *p; +fixstr(char *p) { if (p == NULL) return; @@ -405,10 +394,7 @@ char *p; == char *check(char *str, regmatch_t sub, char *should); */ char * /* NULL or complaint */ -check(str, sub, should) -char *str; -regmatch_t sub; -char *should; +check(char *str, regmatch_t sub, char *should) { int len; int shlen; @@ -482,8 +468,7 @@ char *should; == static char *eprint(int err); */ static char * -eprint(err) -int err; +eprint(int err) { static char epbuf[100]; size_t len; @@ -498,8 +483,7 @@ int err; == static int efind(char *name); */ static int -efind(name) -char *name; +efind(char *name) { static char efbuf[100]; size_t n; -- cgit v1.1 From 1a9e649e9e64edf705a8b11cffb2a8f5a2b158f3 Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 5 Dec 2015 01:19:35 +0000 Subject: Add missing headers and sort #includes per style(9) MFC after: 1 week Sponsored by: EMC / Isilon Storage Division --- lib/libc/regex/grot/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/regex/grot/main.c b/lib/libc/regex/grot/main.c index 72319f6..880e69e 100644 --- a/lib/libc/regex/grot/main.c +++ b/lib/libc/regex/grot/main.c @@ -1,11 +1,13 @@ #include __FBSDID("$FreeBSD$"); -#include -#include #include -#include #include +#include +#include +#include +#include +#include #include "main.ih" -- cgit v1.1 From ac2d4b2c97dd73f41094adb476fc3f8a5b0118d3 Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 5 Dec 2015 02:07:55 +0000 Subject: Use ANSI C function prototypes/definitions instead of K&R style ones MFC after: 1 week Sponsored by: EMC / Isilon Storage Division --- lib/libc/regex/grot/split.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/regex/grot/split.c b/lib/libc/regex/grot/split.c index 70e0ec5..90739d1 100644 --- a/lib/libc/regex/grot/split.c +++ b/lib/libc/regex/grot/split.c @@ -7,13 +7,12 @@ __FBSDID("$FreeBSD$"); /* - split - divide a string into fields, like awk split() = int split(char *string, char *fields[], int nfields, char *sep); + - fields: list is not NULL-terminated + - nfields: number of entries available in fields[] + - sep: "" white, "c" single char, "ab" [ab]+ */ int /* number of fields, including overflow */ -split(string, fields, nfields, sep) -char *string; -char *fields[]; /* list is not NULL-terminated */ -int nfields; /* number of entries available in fields[] */ -char *sep; /* "" white, "c" single char, "ab" [ab]+ */ +split(char *string, char *fields[], int nfields, char *sep) { char *p = string; char c; /* latest character */ @@ -151,9 +150,7 @@ char *sep; /* "" white, "c" single char, "ab" [ab]+ */ * pgm str sep n splits str by sep n times */ int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char *argv[]) { char buf[512]; int n; @@ -182,9 +179,8 @@ char *argv[]; exit(0); } -dosplit(string, seps) -char *string; -char *seps; +void +dosplit(char *string, char *seps) { # define NF 5 char *fields[NF]; @@ -194,10 +190,8 @@ char *seps; print(nf, NF, fields); } -print(nf, nfp, fields) -int nf; -int nfp; -char *fields[]; +void +print(int nf, int nfp, char *fields[]) { int fn; int bound; @@ -277,7 +271,8 @@ struct { NULL, NULL, 0, { NULL }, }; -regress() +void +regress(void) { char buf[512]; int n; -- cgit v1.1 From 06d2ea67281a4f7640db2bee3afad963c8d74cb7 Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 5 Dec 2015 02:18:36 +0000 Subject: Use `==` instead of `=` in the function comment above split(..) so mkh -p exposes split(..). MFC after: 1 week Sponsored by: EMC / Isilon Storage Division --- lib/libc/regex/grot/split.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libc') diff --git a/lib/libc/regex/grot/split.c b/lib/libc/regex/grot/split.c index 90739d1..07ab8f1 100644 --- a/lib/libc/regex/grot/split.c +++ b/lib/libc/regex/grot/split.c @@ -6,7 +6,7 @@ __FBSDID("$FreeBSD$"); /* - split - divide a string into fields, like awk split() - = int split(char *string, char *fields[], int nfields, char *sep); + == int split(char *string, char *fields[], int nfields, char *sep); - fields: list is not NULL-terminated - nfields: number of entries available in fields[] - sep: "" white, "c" single char, "ab" [ab]+ -- cgit v1.1 From 9e66d95c5d014b6f37a110113c70ddb7781e386b Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 5 Dec 2015 02:23:44 +0000 Subject: split.ih: - Create automatically generated include header for split.c main.c: - Use function definitions from debug.ih and split.ih instead of externs Sponsored by: EMC / Isilon Storage Division --- lib/libc/regex/grot/Makefile | 3 ++- lib/libc/regex/grot/main.c | 5 ++--- lib/libc/regex/grot/split.c | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/regex/grot/Makefile b/lib/libc/regex/grot/Makefile index 3e41724..e715dd8 100644 --- a/lib/libc/regex/grot/Makefile +++ b/lib/libc/regex/grot/Makefile @@ -62,7 +62,8 @@ regexec.o: engine.c engine.ih regerror.o: regerror.ih regerror.o: utils.h debug.o: debug.ih -main.o: main.ih +main.o: debug.ih main.ih split.ih +split.o: split.ih r: re tests ./re #include +#include "debug.ih" #include "main.ih" +#include "split.ih" char *progname; int debug = 0; @@ -22,9 +24,6 @@ regoff_t startoff = 0; regoff_t endoff = 0; -extern int split(); -extern void regprint(); - /* - main - do the simple case, hand off to regress() for regression */ diff --git a/lib/libc/regex/grot/split.c b/lib/libc/regex/grot/split.c index 07ab8f1..c5d5264 100644 --- a/lib/libc/regex/grot/split.c +++ b/lib/libc/regex/grot/split.c @@ -4,6 +4,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "split.ih" + /* - split - divide a string into fields, like awk split() == int split(char *string, char *fields[], int nfields, char *sep); -- cgit v1.1 From 912c9a615dc676b9dae1a0596679f68ff3210257 Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 5 Dec 2015 02:25:20 +0000 Subject: Fix -Wformat issues and minor whitespace issues in surrounding areas MFC after: 1 week Sponsored by: EMC / Isilon Storage Division --- lib/libc/regex/grot/main.c | 54 +++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/regex/grot/main.c b/lib/libc/regex/grot/main.c index 4ce9d87..eee541b 100644 --- a/lib/libc/regex/grot/main.c +++ b/lib/libc/regex/grot/main.c @@ -80,43 +80,43 @@ main(int argc, char **argv) err = regcomp(&re, argv[optind++], copts); if (err) { len = regerror(err, &re, erbuf, sizeof(erbuf)); - fprintf(stderr, "error %s, %d/%d `%s'\n", - eprint(err), len, sizeof(erbuf), erbuf); + fprintf(stderr, "error %s, %zu/%zu `%s'\n", + eprint(err), len, sizeof(erbuf), erbuf); exit(status); } - regprint(&re, stdout); + regprint(&re, stdout); if (optind >= argc) { regfree(&re); exit(status); } - if (eopts®_STARTEND) { + if ((eopts & REG_STARTEND) != 0) { subs[0].rm_so = startoff; subs[0].rm_eo = strlen(argv[optind]) - endoff; } err = regexec(&re, argv[optind], (size_t)NS, subs, eopts); if (err) { len = regerror(err, &re, erbuf, sizeof(erbuf)); - fprintf(stderr, "error %s, %d/%d `%s'\n", - eprint(err), len, sizeof(erbuf), erbuf); + fprintf(stderr, "error %s, %zu/%zu `%s'\n", + eprint(err), len, sizeof(erbuf), erbuf); exit(status); } - if (!(copts®_NOSUB)) { + if ((copts & REG_NOSUB) == 0) { len = (int)(subs[0].rm_eo - subs[0].rm_so); if (subs[0].rm_so != -1) { if (len != 0) - printf("match `%.*s'\n", len, - argv[optind] + subs[0].rm_so); + printf("match `%.*s'\n", (int)len, + argv[optind] + subs[0].rm_so); else printf("match `'@%.1s\n", - argv[optind] + subs[0].rm_so); + argv[optind] + subs[0].rm_so); } for (i = 1; i < NS; i++) if (subs[i].rm_so != -1) printf("(%d) `%.*s'\n", i, - (int)(subs[i].rm_eo - subs[i].rm_so), - argv[optind] + subs[i].rm_so); + (int)(subs[i].rm_eo - subs[i].rm_so), + argv[optind] + subs[i].rm_so); } exit(status); } @@ -173,13 +173,13 @@ regress(FILE *in) } ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, (size_t)SHORT); if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' || - ne != strlen(badpat)+1) { + ne != strlen(badpat)+1) { fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n", erbuf, SHORT-1, badpat); status = 1; } ne = regerror(REG_ITOA|REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf)); - if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) { + if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname) + 1) { fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n", erbuf, bpname); status = 1; @@ -190,7 +190,7 @@ regress(FILE *in) fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n", erbuf, (long)REG_BADPAT); status = 1; - } else if (ne != strlen(erbuf)+1) { + } else if (ne != strlen(erbuf) + 1) { fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n", erbuf, (long)REG_BADPAT); status = 1; @@ -210,13 +210,11 @@ try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts) regmatch_t subs[NSUBS]; # define NSHOULD 15 char *should[NSHOULD]; - int nshould; char erbuf[100]; - int err; - int len; - char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE"; - int i; + size_t len; + int err, i, nshould; char *grump; + char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE"; char f0copy[1000]; char f2copy[1000]; @@ -227,9 +225,8 @@ try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts) if (err != 0 && (!opt('C', f1) || err != efind(f2))) { /* unexpected error or wrong error */ len = regerror(err, &re, erbuf, sizeof(erbuf)); - fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n", - line, type, eprint(err), len, - sizeof(erbuf), erbuf); + fprintf(stderr, "%d: %s error %s, %zu/%zu `%s'\n", + line, type, eprint(err), len, sizeof(erbuf), erbuf); status = 1; } else if (err == 0 && opt('C', f1)) { /* unexpected success */ @@ -258,16 +255,15 @@ try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts) if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) { /* unexpected error or wrong error */ len = regerror(err, &re, erbuf, sizeof(erbuf)); - fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n", - line, type, eprint(err), len, - sizeof(erbuf), erbuf); + fprintf(stderr, "%d: %s exec error %s, %zu/%zu `%s'\n", + line, type, eprint(err), len, sizeof(erbuf), erbuf); status = 1; } else if (err != 0) { /* nothing more to check */ } else if (f3 == NULL) { /* unexpected success */ fprintf(stderr, "%d: %s exec should have failed\n", - line, type); + line, type); status = 1; err = 1; /* just on principle */ } else if (opts®_NOSUB) { @@ -294,7 +290,7 @@ try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts) grump = check(f2, subs[i], should[i]); if (grump != NULL) { fprintf(stderr, "%d: %s $%d %s\n", line, - type, i, grump); + type, i, grump); status = 1; err = 1; } @@ -429,7 +425,7 @@ check(char *str, regmatch_t sub, char *should) /* check for in range */ if (sub.rm_eo > strlen(str)) { sprintf(grump, "start %ld end %ld, past end of string", - (long)sub.rm_so, (long)sub.rm_eo); + (long)sub.rm_so, (long)sub.rm_eo); return(grump); } -- cgit v1.1 From adde10383358a789372480ae5560aa1cd9fcfbf6 Mon Sep 17 00:00:00 2001 From: ngie Date: Sat, 5 Dec 2015 04:10:15 +0000 Subject: Initialize errno to 0 in the nul testcase before testing it For some odd reason stable/10 requires this, otherwise it always fails the errno == 0 check on line 196. Sponsored by: EMC / Isilon Storage Division --- lib/libc/tests/stdio/getdelim_test.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/libc') diff --git a/lib/libc/tests/stdio/getdelim_test.c b/lib/libc/tests/stdio/getdelim_test.c index ffc6810..b7596b3 100644 --- a/lib/libc/tests/stdio/getdelim_test.c +++ b/lib/libc/tests/stdio/getdelim_test.c @@ -177,6 +177,7 @@ ATF_TC_BODY(nul, tc) char *line; size_t linecap, n; + errno = 0; line = NULL; linecap = 0; /* Make sure a NUL delimiter works. */ -- cgit v1.1 From 69a946104cf7381bb4f352826c16e80357ae8142 Mon Sep 17 00:00:00 2001 From: bdrewery Date: Sat, 5 Dec 2015 18:56:21 +0000 Subject: Fix regression in r291738: This really wants -lssp. The normal LIBADD is ssp_nonshared. This also had a DPADD on LIBSSP which does not actually exist, it is blank. Sponsored by: EMC / Isilon Storage Division --- lib/libc/tests/ssp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libc') diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile index 6055251..61caced 100644 --- a/lib/libc/tests/ssp/Makefile +++ b/lib/libc/tests/ssp/Makefile @@ -10,7 +10,7 @@ CFLAGS.h_raw+= -fstack-protector-all -Wstack-protector CFLAGS.h_raw+= -fsanitize=bounds .elif ${COMPILER_TYPE} == "gcc" CFLAGS.h_raw+= --param ssp-buffer-size=1 -LIBADD+= ssp +LDADD+= -lssp .endif NETBSD_ATF_TESTS_SH= ssp_test -- cgit v1.1