diff --git a/common/lib/libc/string/strcspn.c b/common/lib/libc/string/strcspn.c index eb11edec8f1c..b175b28f2dd8 100644 --- a/common/lib/libc/string/strcspn.c +++ b/common/lib/libc/string/strcspn.c @@ -1,4 +1,4 @@ -/* $NetBSD: strcspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $ */ +/* $NetBSD: strcspn.c,v 1.2 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 2008 Joerg Sonnenberger @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: strcspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $"); +__RCSID("$NetBSD: strcspn.c,v 1.2 2018/02/04 01:13:45 mrg Exp $"); #if !defined(_KERNEL) && !defined(_STANDALONE) #include @@ -48,9 +48,6 @@ strcspn(const char *s, const char *charset) uint8_t set[32]; #define UC(a) ((unsigned int)(unsigned char)(a)) - _DIAGASSERT(s != NULL); - _DIAGASSERT(charset != NULL); - if (charset[0] == '\0') return strlen(s); if (charset[1] == '\0') { diff --git a/common/lib/libc/string/strncat.c b/common/lib/libc/string/strncat.c index f0de7e3703da..12dcfda0bd3c 100644 --- a/common/lib/libc/string/strncat.c +++ b/common/lib/libc/string/strncat.c @@ -1,4 +1,4 @@ -/* $NetBSD: strncat.c,v 1.2 2013/12/27 20:26:53 christos Exp $ */ +/* $NetBSD: strncat.c,v 1.3 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)strncat.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: strncat.c,v 1.2 2013/12/27 20:26:53 christos Exp $"); +__RCSID("$NetBSD: strncat.c,v 1.3 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -60,9 +60,6 @@ char * strncat(char *dst, const char *src, size_t n) { - _DIAGASSERT(dst != NULL); - _DIAGASSERT(src != NULL); - if (n != 0) { char *d = dst; const char *s = src; diff --git a/common/lib/libc/string/strncpy.c b/common/lib/libc/string/strncpy.c index afed6c039ca8..f42cb890e0f9 100644 --- a/common/lib/libc/string/strncpy.c +++ b/common/lib/libc/string/strncpy.c @@ -1,4 +1,4 @@ -/* $NetBSD: strncpy.c,v 1.3 2007/06/04 18:19:28 christos Exp $ */ +/* $NetBSD: strncpy.c,v 1.4 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)strncpy.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: strncpy.c,v 1.3 2007/06/04 18:19:28 christos Exp $"); +__RCSID("$NetBSD: strncpy.c,v 1.4 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -60,9 +60,6 @@ char * strncpy(char *dst, const char *src, size_t n) { - _DIAGASSERT(dst != NULL); - _DIAGASSERT(src != NULL); - if (n != 0) { char *d = dst; const char *s = src; diff --git a/common/lib/libc/string/strpbrk.c b/common/lib/libc/string/strpbrk.c index c0531c4b0226..df900d1cc8e2 100644 --- a/common/lib/libc/string/strpbrk.c +++ b/common/lib/libc/string/strpbrk.c @@ -1,4 +1,4 @@ -/* $NetBSD: strpbrk.c,v 1.1 2014/07/19 18:38:33 lneto Exp $ */ +/* $NetBSD: strpbrk.c,v 1.2 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 2008 Joerg Sonnenberger @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: strpbrk.c,v 1.1 2014/07/19 18:38:33 lneto Exp $"); +__RCSID("$NetBSD: strpbrk.c,v 1.2 2018/02/04 01:13:45 mrg Exp $"); #if !defined(_KERNEL) && !defined(_STANDALONE) #include @@ -61,9 +61,6 @@ strpbrk(const char *s, const char *charset) (void)memset(set, 0, sizeof(set)); #endif - _DIAGASSERT(s != NULL); - _DIAGASSERT(charset != NULL); - if (charset[0] == '\0') return NULL; if (charset[1] == '\0') diff --git a/common/lib/libc/string/strspn.c b/common/lib/libc/string/strspn.c index fc6c7e79f586..2c2a07ec0d6e 100644 --- a/common/lib/libc/string/strspn.c +++ b/common/lib/libc/string/strspn.c @@ -1,4 +1,4 @@ -/* $NetBSD: strspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $ */ +/* $NetBSD: strspn.c,v 1.2 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 2008 Joerg Sonnenberger @@ -26,7 +26,7 @@ */ #include -__RCSID("$NetBSD: strspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $"); +__RCSID("$NetBSD: strspn.c,v 1.2 2018/02/04 01:13:45 mrg Exp $"); #if !defined(_KERNEL) && !defined(_STANDALONE) #include @@ -47,9 +47,6 @@ strspn(const char *s, const char *charset) const char *t; #define UC(a) ((unsigned int)(unsigned char)(a)) - _DIAGASSERT(s != NULL); - _DIAGASSERT(charset != NULL); - if (charset[0] == '\0') return 0; if (charset[1] == '\0') { diff --git a/common/lib/libc/string/strstr.c b/common/lib/libc/string/strstr.c index c2fa47d3e628..2d959ad693b8 100644 --- a/common/lib/libc/string/strstr.c +++ b/common/lib/libc/string/strstr.c @@ -1,4 +1,4 @@ -/* $NetBSD: strstr.c,v 1.2 2007/06/04 18:19:28 christos Exp $ */ +/* $NetBSD: strstr.c,v 1.3 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)strstr.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: strstr.c,v 1.2 2007/06/04 18:19:28 christos Exp $"); +__RCSID("$NetBSD: strstr.c,v 1.3 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -58,9 +58,6 @@ strstr(const char *s, const char *find) char c, sc; size_t len; - _DIAGASSERT(s != NULL); - _DIAGASSERT(find != NULL); - if ((c = *find++) != 0) { len = strlen(find); do { diff --git a/include/ucontext.h b/include/ucontext.h index 28bc2b6e81fb..12d640c26e6f 100644 --- a/include/ucontext.h +++ b/include/ucontext.h @@ -1,4 +1,4 @@ -/* $NetBSD: ucontext.h,v 1.10 2017/01/15 20:10:25 christos Exp $ */ +/* $NetBSD: ucontext.h,v 1.11 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -40,7 +40,9 @@ int getcontext(ucontext_t *) __returns_twice; int setcontext(const ucontext_t *); #pragma GCC diagnostic push +#ifndef __cplusplus #pragma GCC diagnostic ignored "-Wstrict-prototypes" +#endif void makecontext(ucontext_t *, void (*)(), int, ...); #pragma GCC diagnostic pop diff --git a/lib/libc/gmon/Makefile.inc b/lib/libc/gmon/Makefile.inc index eff0810d8962..956a325e8222 100644 --- a/lib/libc/gmon/Makefile.inc +++ b/lib/libc/gmon/Makefile.inc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.11 2014/09/17 11:37:28 joerg Exp $ +# $NetBSD: Makefile.inc,v 1.12 2018/02/04 01:13:45 mrg Exp $ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # gmon sources @@ -18,6 +18,11 @@ MLINKS+=moncontrol.3 monstartup.3 COPTS.mcount.c+=${${ACTIVE_CXX} == "gcc":? -Wa,--no-warn :} .endif +.if (${MACHINE_CPU} == "i386") && ${HAVE_GCC:U0} >= 6 +# The usage of __builtin_frame_address(1) should be OK. +COPTS.mcount.c+=${${ACTIVE_CXX} == "gcc":? -Wno-error=frame-address :} +.endif + # mcount and gmon cannot be compiled with profiling mcount.po: mcount.o diff --git a/lib/libc/stdio/fprintf.c b/lib/libc/stdio/fprintf.c index 9b00d7d0d004..c7c054e5384f 100644 --- a/lib/libc/stdio/fprintf.c +++ b/lib/libc/stdio/fprintf.c @@ -1,4 +1,4 @@ -/* $NetBSD: fprintf.c,v 1.13 2013/04/19 15:22:25 joerg Exp $ */ +/* $NetBSD: fprintf.c,v 1.14 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)fprintf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: fprintf.c,v 1.13 2013/04/19 15:22:25 joerg Exp $"); +__RCSID("$NetBSD: fprintf.c,v 1.14 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -54,7 +54,6 @@ fprintf(FILE *fp, const char *fmt, ...) va_list ap; _DIAGASSERT(fp != NULL); - _DIAGASSERT(fmt != NULL); va_start(ap, fmt); ret = vfprintf(fp, fmt, ap); diff --git a/lib/libc/stdio/fputc.c b/lib/libc/stdio/fputc.c index e077a5ccd366..ec48a9c13dff 100644 --- a/lib/libc/stdio/fputc.c +++ b/lib/libc/stdio/fputc.c @@ -1,4 +1,4 @@ -/* $NetBSD: fputc.c,v 1.13 2012/03/15 18:22:30 christos Exp $ */ +/* $NetBSD: fputc.c,v 1.14 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)fputc.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: fputc.c,v 1.13 2012/03/15 18:22:30 christos Exp $"); +__RCSID("$NetBSD: fputc.c,v 1.14 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -52,8 +52,6 @@ fputc(int c, FILE *fp) { int r; - _DIAGASSERT(fp != NULL); - FLOCKFILE(fp); r = __sputc(c, fp); FUNLOCKFILE(fp); diff --git a/lib/libc/stdio/fputs.c b/lib/libc/stdio/fputs.c index d8852caf4be9..7ad7f2f58d7a 100644 --- a/lib/libc/stdio/fputs.c +++ b/lib/libc/stdio/fputs.c @@ -1,4 +1,4 @@ -/* $NetBSD: fputs.c,v 1.15 2012/03/13 21:13:46 christos Exp $ */ +/* $NetBSD: fputs.c,v 1.16 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)fputs.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: fputs.c,v 1.15 2012/03/13 21:13:46 christos Exp $"); +__RCSID("$NetBSD: fputs.c,v 1.16 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -57,12 +57,11 @@ fputs(const char *s, FILE *fp) { struct __suio uio; struct __siov iov; + const void *vs = s; int r; - _DIAGASSERT(s != NULL); - _DIAGASSERT(fp != NULL); - - if (s == NULL) + /* This avoids -Werror=nonnull-compare. */ + if (vs == NULL) s = "(null)"; iov.iov_base = __UNCONST(s); diff --git a/lib/libc/stdio/fwrite.c b/lib/libc/stdio/fwrite.c index 0004eb990989..b3ecc187cf2e 100644 --- a/lib/libc/stdio/fwrite.c +++ b/lib/libc/stdio/fwrite.c @@ -1,4 +1,4 @@ -/* $NetBSD: fwrite.c,v 1.17 2012/03/15 18:22:30 christos Exp $ */ +/* $NetBSD: fwrite.c,v 1.18 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)fwrite.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: fwrite.c,v 1.17 2012/03/15 18:22:30 christos Exp $"); +__RCSID("$NetBSD: fwrite.c,v 1.18 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -59,13 +59,11 @@ fwrite(const void *buf, size_t size, size_t count, FILE *fp) struct __suio uio; struct __siov iov; - _DIAGASSERT(fp != NULL); /* * SUSv2 requires a return value of 0 for a count or a size of 0. */ if ((n = count * size) == 0) return 0; - _DIAGASSERT(buf != NULL); iov.iov_base = __UNCONST(buf); uio.uio_resid = iov.iov_len = n; diff --git a/lib/libc/stdio/putc.c b/lib/libc/stdio/putc.c index 858c76ce299c..ad57090e2fd4 100644 --- a/lib/libc/stdio/putc.c +++ b/lib/libc/stdio/putc.c @@ -1,4 +1,4 @@ -/* $NetBSD: putc.c,v 1.12 2012/03/15 18:22:30 christos Exp $ */ +/* $NetBSD: putc.c,v 1.13 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)putc.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: putc.c,v 1.12 2012/03/15 18:22:30 christos Exp $"); +__RCSID("$NetBSD: putc.c,v 1.13 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -58,8 +58,6 @@ putc(int c, FILE *fp) { int r; - _DIAGASSERT(fp != NULL); - FLOCKFILE(fp); r = __sputc(c, fp); FUNLOCKFILE(fp); @@ -70,7 +68,5 @@ int putc_unlocked(int c, FILE *fp) { - _DIAGASSERT(fp != NULL); - return __sputc(c, fp); } diff --git a/lib/libc/stdio/puts.c b/lib/libc/stdio/puts.c index 0ffa7d1cd2a5..25bef4058234 100644 --- a/lib/libc/stdio/puts.c +++ b/lib/libc/stdio/puts.c @@ -1,4 +1,4 @@ -/* $NetBSD: puts.c,v 1.16 2012/03/15 18:22:30 christos Exp $ */ +/* $NetBSD: puts.c,v 1.17 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)puts.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: puts.c,v 1.16 2012/03/15 18:22:30 christos Exp $"); +__RCSID("$NetBSD: puts.c,v 1.17 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -58,11 +58,11 @@ puts(char const *s) size_t c; struct __suio uio; struct __siov iov[2]; + const void *vs = s; int r; - _DIAGASSERT(s != NULL); - - if (s == NULL) + /* This avoids -Werror=nonnull-compare. */ + if (vs == NULL) s = "(null)"; c = strlen(s); diff --git a/lib/libc/stdio/scanf.c b/lib/libc/stdio/scanf.c index b2f7d9a53fcb..bc71a6758b12 100644 --- a/lib/libc/stdio/scanf.c +++ b/lib/libc/stdio/scanf.c @@ -1,4 +1,4 @@ -/* $NetBSD: scanf.c,v 1.14 2013/04/19 23:32:17 joerg Exp $ */ +/* $NetBSD: scanf.c,v 1.15 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)scanf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: scanf.c,v 1.14 2013/04/19 23:32:17 joerg Exp $"); +__RCSID("$NetBSD: scanf.c,v 1.15 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -59,8 +59,6 @@ scanf(char const *fmt, ...) int ret; va_list ap; - _DIAGASSERT(fmt != NULL); - va_start(ap, fmt); ret = __svfscanf(stdin, fmt, ap); va_end(ap); @@ -73,8 +71,6 @@ scanf_l(locale_t loc, char const *fmt, ...) int ret; va_list ap; - _DIAGASSERT(fmt != NULL); - va_start(ap, fmt); ret = __svfscanf_l(stdin, loc, fmt, ap); va_end(ap); diff --git a/lib/libc/stdio/sscanf.c b/lib/libc/stdio/sscanf.c index 6a995c342300..56f6c4961fb2 100644 --- a/lib/libc/stdio/sscanf.c +++ b/lib/libc/stdio/sscanf.c @@ -1,4 +1,4 @@ -/* $NetBSD: sscanf.c,v 1.21 2013/04/19 23:32:17 joerg Exp $ */ +/* $NetBSD: sscanf.c,v 1.22 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)sscanf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: sscanf.c,v 1.21 2013/04/19 23:32:17 joerg Exp $"); +__RCSID("$NetBSD: sscanf.c,v 1.22 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -60,8 +60,6 @@ sscanf(const char *str, char const *fmt, ...) int ret; va_list ap; - _DIAGASSERT(fmt != NULL); - va_start(ap, fmt); ret = vsscanf(str, fmt, ap); va_end(ap); @@ -74,8 +72,6 @@ sscanf_l(const char *str, locale_t loc, char const *fmt, ...) int ret; va_list ap; - _DIAGASSERT(fmt != NULL); - va_start(ap, fmt); ret = vsscanf_l(str, loc, fmt, ap); va_end(ap); diff --git a/lib/libc/stdio/vprintf.c b/lib/libc/stdio/vprintf.c index ccc789b429d9..d5b4e3d61969 100644 --- a/lib/libc/stdio/vprintf.c +++ b/lib/libc/stdio/vprintf.c @@ -1,4 +1,4 @@ -/* $NetBSD: vprintf.c,v 1.13 2013/04/19 15:22:25 joerg Exp $ */ +/* $NetBSD: vprintf.c,v 1.14 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)vprintf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: vprintf.c,v 1.13 2013/04/19 15:22:25 joerg Exp $"); +__RCSID("$NetBSD: vprintf.c,v 1.14 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -53,8 +53,6 @@ int vprintf(const char *fmt, va_list ap) { - _DIAGASSERT(fmt != NULL); - return vfprintf(stdout, fmt, ap); } diff --git a/lib/libc/stdio/vscanf.c b/lib/libc/stdio/vscanf.c index ac293fabb521..26a9b1b5c44b 100644 --- a/lib/libc/stdio/vscanf.c +++ b/lib/libc/stdio/vscanf.c @@ -1,4 +1,4 @@ -/* $NetBSD: vscanf.c,v 1.15 2013/04/19 23:32:17 joerg Exp $ */ +/* $NetBSD: vscanf.c,v 1.16 2018/02/04 01:13:45 mrg Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)vscanf.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: vscanf.c,v 1.15 2013/04/19 23:32:17 joerg Exp $"); +__RCSID("$NetBSD: vscanf.c,v 1.16 2018/02/04 01:13:45 mrg Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -56,8 +56,6 @@ int vscanf(const char *fmt, va_list ap) { - _DIAGASSERT(fmt != NULL); - return __svfscanf(stdin, fmt, ap); } @@ -65,7 +63,5 @@ int vscanf_l(locale_t loc, const char *fmt, va_list ap) { - _DIAGASSERT(fmt != NULL); - return __svfscanf_l(stdin, loc, fmt, ap); }