Blame SOURCES/memstomp-rh1093173.patch

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