Home | History | Annotate | Download | only in depr.c.headers
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <string.h>
     11 
     12 #include <string.h>
     13 #include <type_traits>
     14 
     15 #ifndef NULL
     16 #error NULL not defined
     17 #endif
     18 
     19 int main()
     20 {
     21     size_t s = 0;
     22     void* vp = 0;
     23     const void* vpc = 0;
     24     char* cp = 0;
     25     const char* cpc = 0;
     26     static_assert((std::is_same<decltype(memcpy(vp, vpc, s)), void*>::value), "");
     27     static_assert((std::is_same<decltype(memmove(vp, vpc, s)), void*>::value), "");
     28     static_assert((std::is_same<decltype(strcpy(cp, cpc)), char*>::value), "");
     29     static_assert((std::is_same<decltype(strncpy(cp, cpc, s)), char*>::value), "");
     30     static_assert((std::is_same<decltype(strcat(cp, cpc)), char*>::value), "");
     31     static_assert((std::is_same<decltype(strncat(cp, cpc, s)), char*>::value), "");
     32     static_assert((std::is_same<decltype(memcmp(vpc, vpc, s)), int>::value), "");
     33     static_assert((std::is_same<decltype(strcmp(cpc, cpc)), int>::value), "");
     34     static_assert((std::is_same<decltype(strncmp(cpc, cpc, s)), int>::value), "");
     35     static_assert((std::is_same<decltype(strcoll(cpc, cpc)), int>::value), "");
     36     static_assert((std::is_same<decltype(strxfrm(cp, cpc, s)), size_t>::value), "");
     37     static_assert((std::is_same<decltype(memchr(vp, 0, s)), void*>::value), "");
     38     static_assert((std::is_same<decltype(strchr(cp, 0)), char*>::value), "");
     39     static_assert((std::is_same<decltype(strcspn(cpc, cpc)), size_t>::value), "");
     40     static_assert((std::is_same<decltype(strpbrk(cp, cpc)), char*>::value), "");
     41     static_assert((std::is_same<decltype(strrchr(cp, 0)), char*>::value), "");
     42     static_assert((std::is_same<decltype(strspn(cpc, cpc)), size_t>::value), "");
     43     static_assert((std::is_same<decltype(strstr(cp, cpc)), char*>::value), "");
     44 #ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
     45     static_assert((std::is_same<decltype(strtok(cp, cpc)), char*>::value), "");
     46 #endif
     47     static_assert((std::is_same<decltype(memset(vp, 0, s)), void*>::value), "");
     48     static_assert((std::is_same<decltype(strerror(0)), char*>::value), "");
     49     static_assert((std::is_same<decltype(strlen(cpc)), size_t>::value), "");
     50 }
     51