summaryrefslogtreecommitdiff
path: root/common/lib/libc/string
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2018-02-04 01:13:45 +0000
committermrg <mrg@NetBSD.org>2018-02-04 01:13:45 +0000
commit8ca12eafd302fa1b84a7cb1791c4f721c48a71fd (patch)
tree4b66ad42afa64b81fe9a71da7c5cc5397adfd3b3 /common/lib/libc/string
parent60662d108045c74e964aa980e064cc09b426dc08 (diff)
fixes for GCC 6:
- -Wstrict-prototypes is not available for C++, so don't try to ignore it for C++. - remove many _DIAGASSERT() checks against not NULL for functions with arguments with nonnull attributes. in two cases, leave code behind that should set defaults to "(null)". - use -Wno-error=frame-address for i386 mcount, as it seems valid to assume the caller will have a frame.fair
Diffstat (limited to 'common/lib/libc/string')
-rw-r--r--common/lib/libc/string/strcspn.c7
-rw-r--r--common/lib/libc/string/strncat.c7
-rw-r--r--common/lib/libc/string/strncpy.c7
-rw-r--r--common/lib/libc/string/strpbrk.c7
-rw-r--r--common/lib/libc/string/strspn.c7
-rw-r--r--common/lib/libc/string/strstr.c7
6 files changed, 12 insertions, 30 deletions
diff --git a/common/lib/libc/string/strcspn.c b/common/lib/libc/string/strcspn.c
index eb11edec8f1..b175b28f2dd 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 <sys/cdefs.h>
-__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 <assert.h>
@@ -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 f0de7e3703d..12dcfda0bd3 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 afed6c039ca..f42cb890e0f 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 c0531c4b022..df900d1cc8e 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 <sys/cdefs.h>
-__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 <assert.h>
@@ -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 fc6c7e79f58..2c2a07ec0d6 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 <sys/cdefs.h>
-__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 <assert.h>
@@ -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 c2fa47d3e62..2d959ad693b 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 {