Blame SOURCES/memstomp-rh1093173.patch

44c1bd
*** a/Makefile.am	2014-05-29 10:40:14.997714171 -0600
44c1bd
--- b/Makefile.am	2014-05-29 12:42:18.358166208 -0600
44c1bd
*************** libmemstomp_la_LIBADD = \
44c1bd
*** 53,58 ****
44c1bd
--- 53,60 ----
44c1bd
  	-ldl
44c1bd
  libmemstomp_la_CFLAGS = \
44c1bd
  	$(PTHREAD_CFLAGS) \
44c1bd
+ 	-fno-tree-vrp \
44c1bd
+ 	-fno-delete-null-pointer-checks \
44c1bd
  	-DSONAME=\"libmemstomp.so\"
44c1bd
  
44c1bd
  libmemstomp_backtrace_symbols_la_SOURCES = \
44c1bd
*************** libmemstomp_backtrace_symbols_la_LIBADD
44c1bd
*** 68,74 ****
44c1bd
  	-lrt \
44c1bd
  	-ldl
44c1bd
  libmemstomp_backtrace_symbols_la_CFLAGS = \
44c1bd
! 	$(PTHREAD_CFLAGS)
44c1bd
  
44c1bd
  memstomp: memstomp.in Makefile
44c1bd
  	sed -e 's,@PACKAGE_STRING\@,$(PACKAGE_STRING),g' \
44c1bd
--- 70,76 ----
44c1bd
  	-lrt \
44c1bd
  	-ldl
44c1bd
  libmemstomp_backtrace_symbols_la_CFLAGS = \
44c1bd
! 	$(PTHREAD_CFLAGS) 
44c1bd
  
44c1bd
  memstomp: memstomp.in Makefile
44c1bd
  	sed -e 's,@PACKAGE_STRING\@,$(PACKAGE_STRING),g' \
44c1bd
*** a/memstomp.c	2014-05-29 10:40:15.016714123 -0600
44c1bd
--- b/memstomp.c	2014-05-29 13:59:20.314343481 -0600
44c1bd
***************
44c1bd
*** 62,67 ****
44c1bd
--- 62,79 ----
44c1bd
  #define likely(x)	__builtin_expect(!!(x), 1)
44c1bd
  #define unlikely(x)	__builtin_expect(!!(x), 0)
44c1bd
  
44c1bd
+ #undef strcmp
44c1bd
+ #undef strncmp
44c1bd
+ #undef strdup
44c1bd
+ #undef strndup
44c1bd
+ #undef strchr
44c1bd
+ #undef strrchr
44c1bd
+ #undef strcspn
44c1bd
+ #undef strspn
44c1bd
+ #undef strpbrk
44c1bd
+ #undef strtok_r
44c1bd
+ #undef memcmp
44c1bd
+ 
44c1bd
  static bool abrt_trap = false;
44c1bd
  
44c1bd
  static bool quiet_mode = false;
44c1bd
*************** static void warn_copylap(void * dest, co
44c1bd
*** 316,321 ****
44c1bd
--- 328,356 ----
44c1bd
  	free(info);
44c1bd
  }
44c1bd
  
44c1bd
+ static void warn_null(char const *name)
44c1bd
+ {
44c1bd
+ 	char prname[17];
44c1bd
+ 	char buf[160];
44c1bd
+ 
44c1bd
+ /* Avoid fprintf which is not async signal safe.  fprintf may call malloc,
44c1bd
+  * which may experience trouble if the bad memcpy was called from a signal
44c1bd
+  * handler whose invoking signal interrupted malloc.
44c1bd
+  */
44c1bd
+ 	int const j = snprintf(buf, sizeof(buf),
44c1bd
+ 		"\n\n%s NULL pointer %s(%d)\n",
44c1bd
+ 		name, get_prname(prname), getpid());
44c1bd
+ 	write(STDERR_FILENO, buf, umin(j, sizeof(buf)));
44c1bd
+ 	
44c1bd
+ /* If generate_stacktrace() indirectly invokes malloc (such as via libbfd),
44c1bd
+  * then this is not async signal safe.  But the write() above will produce
44c1bd
+  * some evidence before any possible trouble below.
44c1bd
+  */
44c1bd
+ 	char *const info = generate_stacktrace();
44c1bd
+ 	fprintf(stderr, "%s", info);
44c1bd
+ 	free(info);
44c1bd
+ }
44c1bd
+ 
44c1bd
  static void *copy(void *dest, void const *src, size_t count, char const *name)
44c1bd
  {
44c1bd
  	size_t d = (char *)dest - (char *)src;
44c1bd
*************** static void *copy(void *dest, void const
44c1bd
*** 326,331 ****
44c1bd
--- 361,367 ----
44c1bd
  		/* report the overlap */
44c1bd
  		warn_copylap(dest, src, count, name);
44c1bd
  	}
44c1bd
+ 
44c1bd
  	/* be safe use memmove */
44c1bd
  	return memmove(dest, src, count);
44c1bd
  }
44c1bd
*************** char *stpncpy(char *dst, char const *src
44c1bd
*** 496,498 ****
44c1bd
--- 532,956 ----
44c1bd
  
44c1bd
  /* XXX wcstok: Ugly! */
44c1bd
  
44c1bd
+ /* All the interposition routines below are just checking for NULL
44c1bd
+    arguments when ISO demands they be non-null.  */
44c1bd
+ 
44c1bd
+ void *memmove (void *dest, const void *src, size_t n)
44c1bd
+ {
44c1bd
+   static void * (*real_memmove)(void *, const void *, size_t) = NULL;
44c1bd
+   if (!real_memmove)
44c1bd
+ 	real_memmove = dlsym(RTLD_NEXT, "memmove");
44c1bd
+ 
44c1bd
+   if (unlikely (dest == NULL || src == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("memmove");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_memmove (dest, src, n);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ int memcmp (const void *__s1, const void *__s2, size_t __n)
44c1bd
+ {
44c1bd
+   static int (*real_memcmp)(const void *, const void *, size_t) = NULL;
44c1bd
+   if (!real_memcmp)
44c1bd
+ 	real_memcmp = dlsym(RTLD_NEXT, "memcmp");
44c1bd
+ 
44c1bd
+   if (unlikely (__s1 == NULL || __s2 == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("memcmp");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_memcmp (__s1, __s2, __n);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ int strcmp (const char *__s1, const char *__s2)
44c1bd
+ {
44c1bd
+   static int (*real_strcmp)(const char *, const char *) = NULL;
44c1bd
+   if (!real_strcmp)
44c1bd
+ 	real_strcmp = dlsym(RTLD_NEXT, "strcmp");
44c1bd
+ 
44c1bd
+   if (unlikely (__s1 == NULL || __s2 == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strcmp");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strcmp (__s1, __s2);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ int strncmp (const char *__s1, const char *__s2, size_t __n)
44c1bd
+ {
44c1bd
+   static int (*real_strncmp)(const char *, const char *, size_t) = NULL;
44c1bd
+   if (!real_strncmp)
44c1bd
+ 	real_strncmp = dlsym(RTLD_NEXT, "strncmp");
44c1bd
+ 
44c1bd
+   if (unlikely (__s1 == NULL || __s2 == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strncmp");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strncmp (__s1, __s2, __n);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ int strcoll (const char *__s1, const char *__s2)
44c1bd
+ {
44c1bd
+   static int (*real_strcoll)(const char *, const char *) = NULL;
44c1bd
+   if (!real_strcoll)
44c1bd
+ 	real_strcoll = dlsym(RTLD_NEXT, "strcoll");
44c1bd
+ 
44c1bd
+   if (unlikely (__s1 == NULL || __s2 == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strcoll");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strcoll (__s1, __s2);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ int strcoll_l (const char *__s1, const char *__s2, __locale_t __l)
44c1bd
+ {
44c1bd
+   static int (*real_strcoll_l)(const char *, const char *, __locale_t) = NULL;
44c1bd
+   if (!real_strcoll_l)
44c1bd
+ 	real_strcoll_l = dlsym(RTLD_NEXT, "strcoll_l");
44c1bd
+ 
44c1bd
+   if (unlikely (__s1 == NULL || __s2 == NULL || __l == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strcoll_l");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strcoll_l (__s1, __s2, __l);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ size_t strxfrm (char *__dest, const char *__src, size_t __n)
44c1bd
+ {
44c1bd
+   static size_t (*real_strxfrm)(char *, const char *, size_t) = NULL;
44c1bd
+   if (!real_strxfrm)
44c1bd
+ 	real_strxfrm = dlsym(RTLD_NEXT, "strxfrm");
44c1bd
+ 
44c1bd
+   if (unlikely (__src == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strxfrm");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strxfrm (__dest, __src, __n);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ size_t strxfrm_l (char *__dest, const char *__src, size_t __n, __locale_t __l)
44c1bd
+ {
44c1bd
+   static size_t (*real_strxfrm_l)(char *, const char *, size_t, __locale_t) = NULL;
44c1bd
+   if (!real_strxfrm_l)
44c1bd
+ 	real_strxfrm_l = dlsym(RTLD_NEXT, "strxfrm_l");
44c1bd
+ 
44c1bd
+   if (unlikely (__src == NULL || __l == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strxfrm_l");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strxfrm_l (__dest, __src, __n, __l);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ 
44c1bd
+ void *memset (void *__s, int __c, size_t __n)
44c1bd
+ {
44c1bd
+   static void * (*real_memset)(void *, int, size_t) = NULL;
44c1bd
+   if (!real_memset)
44c1bd
+ 	real_memset = dlsym(RTLD_NEXT, "memset");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("memset");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_memset (__s, __c, __n);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ void *memchr (const void *__s, int __c, size_t __n)
44c1bd
+ {
44c1bd
+   static void * (*real_memchr)(const void *, int, size_t) = NULL;
44c1bd
+   if (!real_memchr)
44c1bd
+ 	real_memchr = dlsym(RTLD_NEXT, "memchr");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("memchr");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_memchr (__s, __c, __n);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ void *memrchr (const void *__s, int __c, size_t __n)
44c1bd
+ {
44c1bd
+   static void * (*real_memrchr)(const void *, int, size_t) = NULL;
44c1bd
+   if (!real_memrchr)
44c1bd
+ 	real_memrchr = dlsym(RTLD_NEXT, "memrchr");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("memrchr");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_memrchr (__s, __c, __n);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ void *rawmemchr (const void *__s, int __c)
44c1bd
+ {
44c1bd
+   static void * (*real_rawmemchr)(const void *, int, size_t) = NULL;
44c1bd
+   if (!real_rawmemchr)
44c1bd
+ 	real_rawmemchr = dlsym(RTLD_NEXT, "rawmemchr");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("rawmemchr");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_rawmemchr (__s, __c, __c);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ size_t strlen (const char *__s)
44c1bd
+ {
44c1bd
+   static size_t (*real_strlen)(const char *) = NULL;
44c1bd
+   if (!real_strlen)
44c1bd
+ 	real_strlen = dlsym(RTLD_NEXT, "strlen");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strlen");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strlen (__s);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ char *strdup (const char *__s)
44c1bd
+ {
44c1bd
+   static char *(*real_strdup)(const char *) = NULL;
44c1bd
+   if (!real_strdup)
44c1bd
+ 	real_strdup = dlsym(RTLD_NEXT, "strdup");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strdup");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strdup (__s);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ char *strndup (const char *__s, size_t __n)
44c1bd
+ {
44c1bd
+   static char *(*real_strndup)(const char *, size_t) = NULL;
44c1bd
+   if (!real_strndup)
44c1bd
+ 	real_strndup = dlsym(RTLD_NEXT, "strndup");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strndup");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strndup (__s, __n);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ char *strchr (const char *__s, int __c)
44c1bd
+ {
44c1bd
+   static char * (*real_strchr)(const void *, int) = NULL;
44c1bd
+   if (!real_strchr)
44c1bd
+ 	real_strchr = dlsym(RTLD_NEXT, "strchr");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strchr");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strchr (__s, __c);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ char *strrchr (const char *__s, int __c)
44c1bd
+ {
44c1bd
+   static char * (*real_strrchr)(const void *, int) = NULL;
44c1bd
+   if (!real_strrchr)
44c1bd
+ 	real_strrchr = dlsym(RTLD_NEXT, "strrchr");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strrchr");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strrchr (__s, __c);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ char *strchrnul (const char *__s, int __c)
44c1bd
+ {
44c1bd
+   static char * (*real_strchrnul)(const void *, int) = NULL;
44c1bd
+   if (!real_strchrnul)
44c1bd
+ 	real_strchrnul = dlsym(RTLD_NEXT, "strchrnul");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strchrnul");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strchrnul (__s, __c);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ size_t strcspn (const char *__s, const char *__reject)
44c1bd
+ {
44c1bd
+   static size_t (*real_strcspn)(const void *, const char *) = NULL;
44c1bd
+   if (!real_strcspn)
44c1bd
+ 	real_strcspn = dlsym(RTLD_NEXT, "strcspn");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL || __reject == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strcspn");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strcspn (__s, __reject);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ size_t strspn (const char *__s, const char *__accept)
44c1bd
+ {
44c1bd
+   static size_t (*real_strspn)(const void *, const char *) = NULL;
44c1bd
+   if (!real_strspn)
44c1bd
+ 	real_strspn = dlsym(RTLD_NEXT, "strspn");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL || __accept == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strspn");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strspn (__s, __accept);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ char * strpbrk (const char *__s, const char *__accept)
44c1bd
+ {
44c1bd
+   static char * (*real_strpbrk)(const void *, const char *) = NULL;
44c1bd
+   if (!real_strpbrk)
44c1bd
+ 	real_strpbrk = dlsym(RTLD_NEXT, "strpbrk");
44c1bd
+ 
44c1bd
+   if (unlikely (__s == NULL || __accept == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strpbrk");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strpbrk (__s, __accept);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ char * strstr (const char *__haystack, const char *__needle)
44c1bd
+ {
44c1bd
+   static char * (*real_strstr)(const void *, const char *) = NULL;
44c1bd
+   if (!real_strstr)
44c1bd
+ 	real_strstr = dlsym(RTLD_NEXT, "strstr");
44c1bd
+ 
44c1bd
+   if (unlikely (__haystack == NULL || __needle == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strstr");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strstr (__haystack, __needle);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ char *strcasestr (const char *__haystack, const char *__needle)
44c1bd
+ {
44c1bd
+   static char * (*real_strcasestr)(const void *, const char *) = NULL;
44c1bd
+   if (!real_strcasestr)
44c1bd
+ 	real_strcasestr = dlsym(RTLD_NEXT, "strcasestr");
44c1bd
+ 
44c1bd
+   if (unlikely (__haystack == NULL || __needle == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strcasestr");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strcasestr (__haystack, __needle);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ void *memmem (const void *__haystack, size_t __haystacklen,
44c1bd
+ 	      const void *__needle, size_t __needlelen)
44c1bd
+ {
44c1bd
+   static char * (*real_memmem)(const void *, size_t, const char *, size_t) = NULL;
44c1bd
+   if (!real_memmem)
44c1bd
+ 	real_memmem = dlsym(RTLD_NEXT, "memmem");
44c1bd
+ 
44c1bd
+   if (unlikely (__haystack == NULL || __needle == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("memmem");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_memmem (__haystack, __haystacklen, __needle, __needlelen);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ char * strtok (char *__s, const char *__delim)
44c1bd
+ {
44c1bd
+   static char * (*real_strtok)(void *, const char *) = NULL;
44c1bd
+   if (!real_strtok)
44c1bd
+ 	real_strtok = dlsym(RTLD_NEXT, "strtok");
44c1bd
+ 
44c1bd
+   if (unlikely (__delim == NULL)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strtok");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strtok (__s, __delim);
44c1bd
+ }
44c1bd
+ 
44c1bd
+ 
44c1bd
+ char * strtok_r (char *__s, const char *__delim, char **__save_ptr)
44c1bd
+ {
44c1bd
+   static char * (*real_strtok_r)(void *, const char *, char **) = NULL;
44c1bd
+   if (!real_strtok_r)
44c1bd
+ 	real_strtok_r = dlsym(RTLD_NEXT, "strtok_r");
44c1bd
+ 
44c1bd
+   if (unlikely (__delim == NULL || __save_ptr)) {
44c1bd
+ 	if (abrt_trap) ABRT_TRAP;
44c1bd
+ 	/* report the NULL pointer */
44c1bd
+ 	warn_null("strtok_r");
44c1bd
+ 	return 0;
44c1bd
+   }
44c1bd
+ 
44c1bd
+   return real_strtok_r (__s, __delim, __save_ptr);
44c1bd
+ }
44c1bd
+ 
44c1bd
diff -Nrup a/testsuite/memstomp.null/memccpy.c b/testsuite/memstomp.null/memccpy.c
44c1bd
--- a/testsuite/memstomp.null/memccpy.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/memccpy.c	2014-05-29 12:42:18.358166208 -0600
44c1bd
@@ -0,0 +1,20 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef MEMCCPY
44c1bd
+#define MEMCCPY memccpy
44c1bd
+#define TYPE char
44c1bd
+#endif
44c1bd
+
44c1bd
+TYPE arr1[10] = {0};
44c1bd
+TYPE arr2[10] = {0};
44c1bd
+TYPE *p1 = &arr1[0];
44c1bd
+TYPE *p2 = &arr2[1];
44c1bd
+size_t count = 9;
44c1bd
+main ()
44c1bd
+{
44c1bd
+  MEMCCPY (NULL, NULL, -1, 0);
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/memchr.c b/testsuite/memstomp.null/memchr.c
44c1bd
--- a/testsuite/memstomp.null/memchr.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/memchr.c	2014-05-29 14:09:04.667841941 -0600
44c1bd
@@ -0,0 +1,4 @@
44c1bd
+#define MEMSET memchr
44c1bd
+#define TYPE char
44c1bd
+#include "memset.c"
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/memcmp.c b/testsuite/memstomp.null/memcmp.c
44c1bd
--- a/testsuite/memstomp.null/memcmp.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/memcmp.c	2014-05-29 13:57:53.098567650 -0600
44c1bd
@@ -0,0 +1,3 @@
44c1bd
+#define MEMCPY memcmp
44c1bd
+#define TYPE char
44c1bd
+#include "memcpy.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/memcpy.c b/testsuite/memstomp.null/memcpy.c
44c1bd
--- a/testsuite/memstomp.null/memcpy.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/memcpy.c	2014-05-29 14:01:34.002999896 -0600
44c1bd
@@ -0,0 +1,20 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef MEMCPY
44c1bd
+#define MEMCPY memcpy
44c1bd
+#define TYPE char
44c1bd
+#endif
44c1bd
+
44c1bd
+TYPE arr1[10] = {0};
44c1bd
+TYPE arr2[10] = {0};
44c1bd
+TYPE *p1 = &arr1[0];
44c1bd
+TYPE *p2 = &arr2[1];
44c1bd
+size_t count = 9;
44c1bd
+main ()
44c1bd
+{
44c1bd
+  return MEMCPY (NULL, NULL, 0) == 0 ;
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/memmem.c b/testsuite/memstomp.null/memmem.c
44c1bd
--- a/testsuite/memstomp.null/memmem.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/memmem.c	2014-05-29 14:18:37.569363960 -0600
44c1bd
@@ -0,0 +1,20 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef MEMMEM
44c1bd
+#define MEMMEM memmem
44c1bd
+#define TYPE char
44c1bd
+#endif
44c1bd
+
44c1bd
+TYPE arr1[10] = {0};
44c1bd
+TYPE arr2[10] = {0};
44c1bd
+TYPE *p1 = &arr1[0];
44c1bd
+TYPE *p2 = &arr2[1];
44c1bd
+size_t count = 9;
44c1bd
+main ()
44c1bd
+{
44c1bd
+  return MEMMEM (NULL, 0, NULL, 0) == 0 ;
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/memmove.c b/testsuite/memstomp.null/memmove.c
44c1bd
--- a/testsuite/memstomp.null/memmove.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/memmove.c	2014-05-29 13:57:29.563628151 -0600
44c1bd
@@ -0,0 +1,3 @@
44c1bd
+#define MEMCPY memmove
44c1bd
+#define TYPE char
44c1bd
+#include "memcpy.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/mempcpy.c b/testsuite/memstomp.null/mempcpy.c
44c1bd
--- a/testsuite/memstomp.null/mempcpy.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/mempcpy.c	2014-05-29 12:42:18.358166208 -0600
44c1bd
@@ -0,0 +1,3 @@
44c1bd
+#define MEMCPY mempcpy
44c1bd
+#define TYPE char
44c1bd
+#include "memcpy.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/memrchr.c b/testsuite/memstomp.null/memrchr.c
44c1bd
--- a/testsuite/memstomp.null/memrchr.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/memrchr.c	2014-05-29 14:09:22.122797099 -0600
44c1bd
@@ -0,0 +1,4 @@
44c1bd
+#define MEMSET memrchr
44c1bd
+#define TYPE char
44c1bd
+#include "memset.c"
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/memset.c b/testsuite/memstomp.null/memset.c
44c1bd
--- a/testsuite/memstomp.null/memset.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/memset.c	2014-05-29 14:08:06.411991603 -0600
44c1bd
@@ -0,0 +1,20 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef MEMSET
44c1bd
+#define MEMSET memset
44c1bd
+#define TYPE char
44c1bd
+#endif
44c1bd
+
44c1bd
+TYPE arr1[10] = {0};
44c1bd
+TYPE arr2[10] = {0};
44c1bd
+TYPE *p1 = &arr1[0];
44c1bd
+TYPE *p2 = &arr2[1];
44c1bd
+size_t count = 9;
44c1bd
+main ()
44c1bd
+{
44c1bd
+  return MEMSET (NULL, -1, 0) == 0;
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/null.exp b/testsuite/memstomp.null/null.exp
44c1bd
--- a/testsuite/memstomp.null/null.exp	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/null.exp	2014-05-29 12:42:18.358166208 -0600
44c1bd
@@ -0,0 +1,59 @@
44c1bd
+# Copyright (C) 2013 Free Software Foundation, Inc.
44c1bd
+
44c1bd
+# This program is free software; you can redistribute it and/or modify
44c1bd
+# it under the terms of the GNU General Public License as published by
44c1bd
+# the Free Software Foundation; either version 3 of the License, or
44c1bd
+# (at your option) any later version.
44c1bd
+#
44c1bd
+# This program is distributed in the hope that it will be useful,
44c1bd
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
44c1bd
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
44c1bd
+# GNU General Public License for more details.
44c1bd
+#
44c1bd
+# You should have received a copy of the GNU General Public License
44c1bd
+# along with GCC; see the file COPYING3.  If not see
44c1bd
+# <http://www.gnu.org/licenses/>.
44c1bd
+#
44c1bd
+# This was originally copied from GCC's dejagnu testing framework
44c1bd
+#
44c1bd
+
44c1bd
+load_lib memstomp.exp
44c1bd
+set memstomp [find_memstomp]
44c1bd
+set libmemstomp [find_libmemstomp]
44c1bd
+
44c1bd
+if $tracelevel then {
44c1bd
+    strace $tracelevel
44c1bd
+}
44c1bd
+
44c1bd
+#
44c1bd
+# main test loop
44c1bd
+#
44c1bd
+
44c1bd
+proc compile-and-execute { sources } {
44c1bd
+  global memstomp
44c1bd
+  global libmemstomp
44c1bd
+
44c1bd
+  set src [lindex $sources 0]
44c1bd
+
44c1bd
+  if {[catch {exec gcc -fno-builtin $src} results]} {
44c1bd
+    fail "$src compilation $results"
44c1bd
+  } else {
44c1bd
+    pass "$src compilation $results"
44c1bd
+  }
44c1bd
+
44c1bd
+  catch {exec /bin/bash -c "LD_PRELOAD=$libmemstomp $memstomp ./a.out"} results
44c1bd
+  if {[regexp "NULL pointer" $results]} {
44c1bd
+    pass "$src found NULL $results"
44c1bd
+  } else {
44c1bd
+    fail "$src found NULL $results"
44c1bd
+  }
44c1bd
+}
44c1bd
+
44c1bd
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
44c1bd
+    # If we're only testing specific files and this isn't one of them, skip it.
44c1bd
+    if ![runtest_file_p $runtests $src] then {
44c1bd
+        continue
44c1bd
+    }
44c1bd
+
44c1bd
+   compile-and-execute $src
44c1bd
+}
44c1bd
diff -Nrup a/testsuite/memstomp.null/rawmemchr.c b/testsuite/memstomp.null/rawmemchr.c
44c1bd
--- a/testsuite/memstomp.null/rawmemchr.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/rawmemchr.c	2014-05-29 14:10:36.610605748 -0600
44c1bd
@@ -0,0 +1,20 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef RAWMEMCHR
44c1bd
+#define RAWMEMCHR rawmemchr
44c1bd
+#define TYPE char
44c1bd
+#endif
44c1bd
+
44c1bd
+TYPE arr1[10] = {0};
44c1bd
+TYPE arr2[10] = {0};
44c1bd
+TYPE *p1 = &arr1[0];
44c1bd
+TYPE *p2 = &arr2[1];
44c1bd
+size_t count = 9;
44c1bd
+main ()
44c1bd
+{
44c1bd
+  return RAWMEMCHR (NULL, 0) == 0;
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/stpcpy.c b/testsuite/memstomp.null/stpcpy.c
44c1bd
--- a/testsuite/memstomp.null/stpcpy.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/stpcpy.c	2014-05-29 12:42:18.358166208 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRCPY stpcpy
44c1bd
+#include "strcpy.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/stpncpy.c b/testsuite/memstomp.null/stpncpy.c
44c1bd
--- a/testsuite/memstomp.null/stpncpy.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/stpncpy.c	2014-05-29 12:42:18.358166208 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRNCPY stpncpy
44c1bd
+#include "strncpy.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/strcasestr.c b/testsuite/memstomp.null/strcasestr.c
44c1bd
--- a/testsuite/memstomp.null/strcasestr.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strcasestr.c	2014-05-29 14:18:59.099308034 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRCMP strstr
44c1bd
+#include "strcmp.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/strcat.c b/testsuite/memstomp.null/strcat.c
44c1bd
--- a/testsuite/memstomp.null/strcat.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strcat.c	2014-05-29 12:42:18.359166205 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRCPY strcat
44c1bd
+#include "strcpy.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/strchr.c b/testsuite/memstomp.null/strchr.c
44c1bd
--- a/testsuite/memstomp.null/strchr.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strchr.c	2014-05-29 14:13:39.929134865 -0600
44c1bd
@@ -0,0 +1,4 @@
44c1bd
+#define RAWMEMCHR strchr
44c1bd
+#define TYPE char
44c1bd
+#include "rawmemchr.c"
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/strchrnul.c b/testsuite/memstomp.null/strchrnul.c
44c1bd
--- a/testsuite/memstomp.null/strchrnul.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strchrnul.c	2014-05-29 14:15:17.983882584 -0600
44c1bd
@@ -0,0 +1,4 @@
44c1bd
+#define RAWMEMCHR strrchr
44c1bd
+#define TYPE char
44c1bd
+#include "rawmemchr.c"
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/strcmp.c b/testsuite/memstomp.null/strcmp.c
44c1bd
--- a/testsuite/memstomp.null/strcmp.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strcmp.c	2014-05-29 14:17:21.903560538 -0600
44c1bd
@@ -0,0 +1,19 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef STRCMP
44c1bd
+#define STRCMP strcmp
44c1bd
+#endif
44c1bd
+
44c1bd
+
44c1bd
+char arr1[32] = "this is a test";
44c1bd
+char arr2[32] = "this is a test";
44c1bd
+char *p1 = &arr1[0];
44c1bd
+char *p2 = &arr2[1];
44c1bd
+main ()
44c1bd
+{
44c1bd
+  return STRCMP (NULL, NULL) == 0;
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/strcoll.c b/testsuite/memstomp.null/strcoll.c
44c1bd
--- a/testsuite/memstomp.null/strcoll.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strcoll.c	2014-05-29 14:04:39.735522619 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRNCPY strcoll
44c1bd
+#include "strcmp.c"
44c1bd
Binary files a/testsuite/memstomp.null/.strcoll.c.swp and b/testsuite/memstomp.null/.strcoll.c.swp differ
44c1bd
diff -Nrup a/testsuite/memstomp.null/strcoll_l.c b/testsuite/memstomp.null/strcoll_l.c
44c1bd
--- a/testsuite/memstomp.null/strcoll_l.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strcoll_l.c	2014-05-29 14:05:22.181413555 -0600
44c1bd
@@ -0,0 +1,19 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef STRCMP
44c1bd
+#define STRCMP strcoll_l
44c1bd
+#endif
44c1bd
+
44c1bd
+
44c1bd
+char arr1[32] = "this is a test";
44c1bd
+char arr2[32] = "this is a test";
44c1bd
+char *p1 = &arr1[0];
44c1bd
+char *p2 = &arr2[1];
44c1bd
+main ()
44c1bd
+{
44c1bd
+  return STRCMP (NULL, NULL, NULL);
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/strcpy.c b/testsuite/memstomp.null/strcpy.c
44c1bd
--- a/testsuite/memstomp.null/strcpy.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strcpy.c	2014-05-29 12:42:18.359166205 -0600
44c1bd
@@ -0,0 +1,19 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef STRCPY
44c1bd
+#define STRCPY strcpy
44c1bd
+#endif
44c1bd
+
44c1bd
+
44c1bd
+char arr1[32] = "this is a test";
44c1bd
+char arr2[32] = "this is a test";
44c1bd
+char *p1 = &arr1[0];
44c1bd
+char *p2 = &arr2[1];
44c1bd
+main ()
44c1bd
+{
44c1bd
+  STRCPY (NULL, NULL);
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/strcspn.c b/testsuite/memstomp.null/strcspn.c
44c1bd
--- a/testsuite/memstomp.null/strcspn.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strcspn.c	2014-05-29 14:16:12.219741618 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRCMP strcspn
44c1bd
+#include "strcmp.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/strdup.c b/testsuite/memstomp.null/strdup.c
44c1bd
--- a/testsuite/memstomp.null/strdup.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strdup.c	2014-05-29 14:12:20.521338829 -0600
44c1bd
@@ -0,0 +1,3 @@
44c1bd
+#define STRLEN strdup
44c1bd
+#define TYPE char
44c1bd
+#include "strlen.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/strlen.c b/testsuite/memstomp.null/strlen.c
44c1bd
--- a/testsuite/memstomp.null/strlen.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strlen.c	2014-05-29 14:12:28.969317129 -0600
44c1bd
@@ -0,0 +1,19 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef STRLEN
44c1bd
+#define STRLEN strlen
44c1bd
+#endif
44c1bd
+
44c1bd
+
44c1bd
+char arr1[32] = "this is a test";
44c1bd
+char arr2[32] = "this is a test";
44c1bd
+char *p1 = &arr1[0];
44c1bd
+char *p2 = &arr2[1];
44c1bd
+main ()
44c1bd
+{
44c1bd
+  return STRLEN (NULL) == 0;
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/strncat.c b/testsuite/memstomp.null/strncat.c
44c1bd
--- a/testsuite/memstomp.null/strncat.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strncat.c	2014-05-29 12:42:18.359166205 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRNCPY strncat
44c1bd
+#include "strncpy.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/strncmp.c b/testsuite/memstomp.null/strncmp.c
44c1bd
--- a/testsuite/memstomp.null/strncmp.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strncmp.c	2014-05-29 14:03:31.222698668 -0600
44c1bd
@@ -0,0 +1,19 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef STRNCMP
44c1bd
+#define STRNCMP strncmp
44c1bd
+#endif
44c1bd
+
44c1bd
+
44c1bd
+char arr1[32] = "this is a test";
44c1bd
+char arr2[32] = "this is a test";
44c1bd
+char *p1 = &arr1[0];
44c1bd
+char *p2 = &arr2[1];
44c1bd
+main ()
44c1bd
+{
44c1bd
+  return STRNCMP (NULL, NULL, 0);
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/strncpy.c b/testsuite/memstomp.null/strncpy.c
44c1bd
--- a/testsuite/memstomp.null/strncpy.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strncpy.c	2014-05-29 12:42:18.359166205 -0600
44c1bd
@@ -0,0 +1,19 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef STRNCPY
44c1bd
+#define STRNCPY strncpy
44c1bd
+#endif
44c1bd
+
44c1bd
+
44c1bd
+char arr1[32] = "this is a test";
44c1bd
+char arr2[32] = "this is a test";
44c1bd
+char *p1 = &arr1[0];
44c1bd
+char *p2 = &arr2[1];
44c1bd
+main ()
44c1bd
+{
44c1bd
+  STRNCPY (NULL, NULL, 0);
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/strndup.c b/testsuite/memstomp.null/strndup.c
44c1bd
--- a/testsuite/memstomp.null/strndup.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strndup.c	2014-05-29 14:13:18.192190697 -0600
44c1bd
@@ -0,0 +1,4 @@
44c1bd
+#define RAWMEMCHR strndup
44c1bd
+#define TYPE char
44c1bd
+#include "rawmemchr.c"
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/strpbrk.c b/testsuite/memstomp.null/strpbrk.c
44c1bd
--- a/testsuite/memstomp.null/strpbrk.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strpbrk.c	2014-05-29 14:17:09.970591544 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRCMP strpbrk
44c1bd
+#include "strcmp.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/strrchr.c b/testsuite/memstomp.null/strrchr.c
44c1bd
--- a/testsuite/memstomp.null/strrchr.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strrchr.c	2014-05-29 14:15:23.466868332 -0600
44c1bd
@@ -0,0 +1,4 @@
44c1bd
+#define RAWMEMCHR strchrnul
44c1bd
+#define TYPE char
44c1bd
+#include "rawmemchr.c"
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/strspn.c b/testsuite/memstomp.null/strspn.c
44c1bd
--- a/testsuite/memstomp.null/strspn.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strspn.c	2014-05-29 14:16:33.880685326 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRCMP strspn
44c1bd
+#include "strcmp.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/strstr.c b/testsuite/memstomp.null/strstr.c
44c1bd
--- a/testsuite/memstomp.null/strstr.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strstr.c	2014-05-29 14:16:56.195627338 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRCMP strstr
44c1bd
+#include "strcmp.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/strtok.c b/testsuite/memstomp.null/strtok.c
44c1bd
--- a/testsuite/memstomp.null/strtok.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strtok.c	2014-05-29 14:19:10.868277465 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRCMP strtok
44c1bd
+#include "strcmp.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/strtok_r.c b/testsuite/memstomp.null/strtok_r.c
44c1bd
--- a/testsuite/memstomp.null/strtok_r.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strtok_r.c	2014-05-29 14:19:53.089167807 -0600
44c1bd
@@ -0,0 +1,20 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef STRTOK_R
44c1bd
+#define STRTOK_R strtok_r
44c1bd
+#define TYPE char
44c1bd
+#endif
44c1bd
+
44c1bd
+TYPE arr1[10] = {0};
44c1bd
+TYPE arr2[10] = {0};
44c1bd
+TYPE *p1 = &arr1[0];
44c1bd
+TYPE *p2 = &arr2[1];
44c1bd
+size_t count = 9;
44c1bd
+main ()
44c1bd
+{
44c1bd
+  return STRTOK_R (NULL, NULL, NULL) == 0 ;
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/strxfrm.c b/testsuite/memstomp.null/strxfrm.c
44c1bd
--- a/testsuite/memstomp.null/strxfrm.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strxfrm.c	2014-05-29 14:06:23.335256429 -0600
44c1bd
@@ -0,0 +1,2 @@
44c1bd
+#define STRNCPY strxfrm
44c1bd
+#include "strcmp.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/strxfrm_l.c b/testsuite/memstomp.null/strxfrm_l.c
44c1bd
--- a/testsuite/memstomp.null/strxfrm_l.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/strxfrm_l.c	2014-05-29 14:07:10.004136524 -0600
44c1bd
@@ -0,0 +1,19 @@
44c1bd
+#define _GNU_SOURCE
44c1bd
+#include <string.h>
44c1bd
+#include <wchar.h>
44c1bd
+
44c1bd
+#ifndef STRCMP
44c1bd
+#define STRCMP strxfrm_l
44c1bd
+#endif
44c1bd
+
44c1bd
+
44c1bd
+char arr1[32] = "this is a test";
44c1bd
+char arr2[32] = "this is a test";
44c1bd
+char *p1 = &arr1[0];
44c1bd
+char *p2 = &arr2[1];
44c1bd
+main ()
44c1bd
+{
44c1bd
+  return STRCMP (NULL, NULL, 0, NULL);
44c1bd
+}
44c1bd
+
44c1bd
+
44c1bd
diff -Nrup a/testsuite/memstomp.null/wmemcpy.c b/testsuite/memstomp.null/wmemcpy.c
44c1bd
--- a/testsuite/memstomp.null/wmemcpy.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/wmemcpy.c	2014-05-29 12:42:18.359166205 -0600
44c1bd
@@ -0,0 +1,3 @@
44c1bd
+#define MEMCPY wmemcpy
44c1bd
+#define TYPE wchar_t
44c1bd
+#include "memcpy.c"
44c1bd
diff -Nrup a/testsuite/memstomp.null/wmempcpy.c b/testsuite/memstomp.null/wmempcpy.c
44c1bd
--- a/testsuite/memstomp.null/wmempcpy.c	1969-12-31 17:00:00.000000000 -0700
44c1bd
+++ b/testsuite/memstomp.null/wmempcpy.c	2014-05-29 12:42:18.359166205 -0600
44c1bd
@@ -0,0 +1,3 @@
44c1bd
+#define MEMCPY wmempcpy
44c1bd
+#define TYPE wchar_t
44c1bd
+#include "memcpy.c"