Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -276,6 +276,13 @@ #define _LIBCPP_UNUSED __attribute__((__unused__)) +#ifndef _LIBCPP_HAS_NO_NONNULL +#define _LIBCPP_NON_NULL __attribute__((__nonnull__)) +#define _LIBCPP_NON_NULL1(x) __attribute__((__nonnull__(x))) +#define _LIBCPP_NON_NULL2(x,y) __attribute__((__nonnull__(x,y))) +#define _LIBCPP_NON_NULL3(x,y,z) __attribute__((__nonnull__(x,y,z))) +#endif + #if !(__has_feature(cxx_defaulted_functions)) #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #endif // !(__has_feature(cxx_defaulted_functions)) @@ -408,6 +415,13 @@ #define _LIBCPP_UNUSED __attribute__((__unused__)) +#ifndef _LIBCPP_HAS_NO_NONNULL +#define _LIBCPP_NON_NULL __attribute__((__nonnull__)) +#define _LIBCPP_NON_NULL1(x) __attribute__((__nonnull__(x))) +#define _LIBCPP_NON_NULL2(x,y) __attribute__((__nonnull__(x,y))) +#define _LIBCPP_NON_NULL3(x,y,z) __attribute__((__nonnull__(x,y,z))) +#endif + #if _GNUC_VER >= 407 #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T) @@ -516,6 +530,7 @@ #define _LIBCPP_UNUSED #define _ALIGNAS(x) __declspec(align(x)) #define _LIBCPP_HAS_NO_VARIADICS +#define _LIBCPP_HAS_NO_NONNULL #define _NOEXCEPT throw () #define _NOEXCEPT_(x) @@ -552,6 +567,7 @@ #define _LIBCPP_HAS_IS_BASE_OF #define _LIBCPP_HAS_IS_FINAL #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES +#define _LIBCPP_HAS_NO_NONNULL #if defined(_AIX) #define __MULTILOCALE_API @@ -725,6 +741,13 @@ # define _LIBCPP_EXPLICIT_MOVE(x) (x) #endif +#ifdef _LIBCPP_HAS_NO_NONNULL +#define _LIBCPP_NON_NULL +#define _LIBCPP_NON_NULL1(x) +#define _LIBCPP_NON_NULL2(x,y) +#define _LIBCPP_NON_NULL3(x,y,z) +#endif + #ifndef _LIBCPP_HAS_NO_ASAN extern "C" void __sanitizer_annotate_contiguous_container( const void *, const void *, const void *, const void *); Index: include/cstring =================================================================== --- include/cstring +++ include/cstring @@ -67,15 +67,34 @@ _LIBCPP_BEGIN_NAMESPACE_STD using ::size_t; -using ::memcpy; -using ::memmove; + +// using ::memcpy; +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_NON_NULL2(1, 2) +void* memcpy(void* __s1, const void* __s2, size_t __n) +{ return ::memcpy(__s1, __s2, __n); } + +// using ::memmove; +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_NON_NULL2(1, 2) +void* memmove(void* __s1, const void* __s2, size_t __n) +{ return ::memmove(__s1, __s2, __n); } + using ::strcpy; using ::strncpy; using ::strcat; using ::strncat; -using ::memcmp; + +// using ::memcmp; +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_NON_NULL2(1, 2) +int memcmp(const void* __s1, const void* __s2, size_t __n) +{ return ::memcmp(__s1, __s2, __n); } + using ::strcmp; -using ::strncmp; + +// using ::strncmp; +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_NON_NULL2(1, 2) +int strncmp(const char* __s1, const char* __s2, size_t __n) +{ return ::strncmp(__s1, __s2, __n); } + using ::strcoll; using ::strxfrm;