Blame SOURCES/memstomp-rh1093173.patch

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