This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PING][PATCH][BZ #18265][v2] Updated attributes for wchar string and memory functions
- From: Daniel Marjamäki <Daniel dot Marjamaki at evidente dot se>
- To: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Cc: "vapier at gentoo dot org" <vapier at gentoo dot org>
- Date: Wed, 29 Apr 2015 09:21:23 +0000
- Subject: [PING][PATCH][BZ #18265][v2] Updated attributes for wchar string and memory functions
- Authentication-results: sourceware.org; auth=none
Hello!
Please review this patch that adds annotations.
These wchar.h annotations match the corresponding string.h annotations.
Best regards,
Daniel Marjamäki
..................................................................................................................
Daniel Marjamäki Senior Engineer
Evidente ES East AB Warfvinges väg 34 SE-112 51 Stockholm Sweden
Mobile: +46 (0)709 12 42 62
E-mail: Daniel.Marjamaki@evidente.se
www.evidente.se
diff --git a/ChangeLog b/ChangeLog
index 35106b5..2f542e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-29 Daniel Marjamäki <daniel.marjamaki@evidente.se>
+
+ [BZ #18265]
+ * wcsmbs/wchar.h: Add nonnull and pure annotations for string
+ and memory functions.
+
2015-04-28 Joseph Myers <joseph@codesourcery.com>
[BZ #18346]
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 9652f65..7b2e49d 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -145,45 +145,51 @@ __USING_NAMESPACE_STD(tm)
__BEGIN_NAMESPACE_STD
/* Copy SRC to DEST. */
extern wchar_t *wcscpy (wchar_t *__restrict __dest,
- const wchar_t *__restrict __src) __THROW;
+ const wchar_t *__restrict __src)
+ __THROW __nonnull ((1, 2));
/* Copy no more than N wide-characters of SRC to DEST. */
extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
const wchar_t *__restrict __src, size_t __n)
- __THROW;
+ __THROW __nonnull ((1, 2));
/* Append SRC onto DEST. */
extern wchar_t *wcscat (wchar_t *__restrict __dest,
- const wchar_t *__restrict __src) __THROW;
+ const wchar_t *__restrict __src)
+ __THROW __nonnull ((1, 2));
/* Append no more than N wide-characters of SRC onto DEST. */
extern wchar_t *wcsncat (wchar_t *__restrict __dest,
const wchar_t *__restrict __src, size_t __n)
- __THROW;
+ __THROW __nonnull ((1, 2));
/* Compare S1 and S2. */
extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Compare N wide-characters of S1 and S2. */
extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
__END_NAMESPACE_STD
#ifdef __USE_XOPEN2K8
/* Compare S1 and S2, ignoring case. */
-extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2) __THROW;
+extern int wcscasecmp (const wchar_t *__s1, const wchar_t *__s2)
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Compare no more than N chars of S1 and S2, ignoring case. */
extern int wcsncasecmp (const wchar_t *__s1, const wchar_t *__s2,
- size_t __n) __THROW;
+ size_t __n)
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Similar to the two functions above but take the information from
the provided locale and not the global locale. */
# include <xlocale.h>
extern int wcscasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
- __locale_t __loc) __THROW;
+ __locale_t __loc)
+ __THROW __attribute_pure__ __nonnull ((1, 2));
extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
- size_t __n, __locale_t __loc) __THROW;
+ size_t __n, __locale_t __loc)
+ __THROW __attribute_pure__ __nonnull ((1, 2));
#endif
__BEGIN_NAMESPACE_STD
@@ -220,22 +226,22 @@ __BEGIN_NAMESPACE_STD
/* Find the first occurrence of WC in WCS. */
#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc)
- __THROW __asm ("wcschr") __attribute_pure__;
+ __THROW __asm ("wcschr") __attribute_pure__ __nonnull ((1));
extern "C++" const wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
- __THROW __asm ("wcschr") __attribute_pure__;
+ __THROW __asm ("wcschr") __attribute_pure__ __nonnull ((1));
#else
extern wchar_t *wcschr (const wchar_t *__wcs, wchar_t __wc)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1));
#endif
/* Find the last occurrence of WC in WCS. */
#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
extern "C++" wchar_t *wcsrchr (wchar_t *__wcs, wchar_t __wc)
- __THROW __asm ("wcsrchr") __attribute_pure__;
+ __THROW __asm ("wcsrchr") __attribute_pure__ __nonnull ((1));
extern "C++" const wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
- __THROW __asm ("wcsrchr") __attribute_pure__;
+ __THROW __asm ("wcsrchr") __attribute_pure__ __nonnull ((1));
#else
extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1));
#endif
__END_NAMESPACE_STD
@@ -243,39 +249,39 @@ __END_NAMESPACE_STD
/* This function is similar to `wcschr'. But it returns a pointer to
the closing NUL wide character in case C is not found in S. */
extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1));
#endif
__BEGIN_NAMESPACE_STD
/* Return the length of the initial segmet of WCS which
consists entirely of wide characters not in REJECT. */
extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Return the length of the initial segmet of WCS which
consists entirely of wide characters in ACCEPT. */
extern size_t wcsspn (const wchar_t *__wcs, const wchar_t *__accept)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Find the first occurrence in WCS of any character in ACCEPT. */
#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
extern "C++" wchar_t *wcspbrk (wchar_t *__wcs, const wchar_t *__accept)
- __THROW __asm ("wcspbrk") __attribute_pure__;
+ __THROW __asm ("wcspbrk") __attribute_pure__ __nonnull ((1, 2));
extern "C++" const wchar_t *wcspbrk (const wchar_t *__wcs,
const wchar_t *__accept)
- __THROW __asm ("wcspbrk") __attribute_pure__;
+ __THROW __asm ("wcspbrk") __attribute_pure__ __nonnull ((1, 2));
#else
extern wchar_t *wcspbrk (const wchar_t *__wcs, const wchar_t *__accept)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
#endif
/* Find the first occurrence of NEEDLE in HAYSTACK. */
#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
extern "C++" wchar_t *wcsstr (wchar_t *__haystack, const wchar_t *__needle)
- __THROW __asm ("wcsstr") __attribute_pure__;
+ __THROW __asm ("wcsstr") __attribute_pure__ __nonnull ((1, 2));
extern "C++" const wchar_t *wcsstr (const wchar_t *__haystack,
const wchar_t *__needle)
- __THROW __asm ("wcsstr") __attribute_pure__;
+ __THROW __asm ("wcsstr") __attribute_pure__ __nonnull ((1, 2));
#else
extern wchar_t *wcsstr (const wchar_t *__haystack, const wchar_t *__needle)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
#endif
/* Divide WCS into tokens separated by characters in DELIM. */
@@ -284,7 +290,8 @@ extern wchar_t *wcstok (wchar_t *__restrict __s,
wchar_t **__restrict __ptr) __THROW;
/* Return the number of wide characters in S. */
-extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
+extern size_t wcslen (const wchar_t *__s)
+ __THROW __attribute_pure__ __nonnull ((1));
__END_NAMESPACE_STD
#ifdef __USE_XOPEN
@@ -304,7 +311,7 @@ extern wchar_t *wcswcs (const wchar_t *__haystack, const wchar_t *__needle)
#ifdef __USE_XOPEN2K8
/* Return the number of wide characters in S, but at most MAXLEN. */
extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1));
#endif
@@ -312,30 +319,32 @@ __BEGIN_NAMESPACE_STD
/* Search N wide characters of S for C. */
#ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n)
- __THROW __asm ("wmemchr") __attribute_pure__;
+ __THROW __asm ("wmemchr") __attribute_pure__ __nonnull ((1));
extern "C++" const wchar_t *wmemchr (const wchar_t *__s, wchar_t __c,
size_t __n)
- __THROW __asm ("wmemchr") __attribute_pure__;
+ __THROW __asm ("wmemchr") __attribute_pure__ __nonnull ((1));
#else
extern wchar_t *wmemchr (const wchar_t *__s, wchar_t __c, size_t __n)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1));
#endif
/* Compare N wide characters of S1 and S2. */
extern int wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
- __THROW __attribute_pure__;
+ __THROW __attribute_pure__ __nonnull ((1, 2));
/* Copy N wide characters of SRC to DEST. */
extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
- const wchar_t *__restrict __s2, size_t __n) __THROW;
+ const wchar_t *__restrict __s2, size_t __n)
+ __THROW __nonnull ((1, 2));
/* Copy N wide characters of SRC to DEST, guaranteeing
correct behavior for overlapping strings. */
extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)
- __THROW;
+ __THROW __nonnull ((1, 2));
/* Set N wide characters of S to C. */
-extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
+extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n)
+ __THROW __nonnull ((1));
__END_NAMESPACE_STD
#ifdef __USE_GNU
@@ -466,13 +475,14 @@ __BEGIN_NAMESPACE_STD
/* Convert initial portion of wide string NPTR to `long int'
representation. */
extern long int wcstol (const wchar_t *__restrict __nptr,
- wchar_t **__restrict __endptr, int __base) __THROW;
+ wchar_t **__restrict __endptr, int __base)
+ __THROW __nonnull ((1));
/* Convert initial portion of wide string NPTR to `unsigned long int'
representation. */
extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr, int __base)
- __THROW;
+ __THROW __nonnull ((1));
__END_NAMESPACE_STD
#ifdef __USE_ISOC99
@@ -482,14 +492,15 @@ __BEGIN_NAMESPACE_C99
__extension__
extern long long int wcstoll (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr, int __base)
- __THROW;
+ __THROW __nonnull ((1));
/* Convert initial portion of wide string NPTR to `unsigned long long int'
representation. */
__extension__
extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
wchar_t **__restrict __endptr,
- int __base) __THROW;
+ int __base)
+ __THROW __nonnull ((1));
__END_NAMESPACE_C99
#endif /* ISO C99. */