On Darwin, the memcpy is a macro to provide secure string operations (FORTIFY_LEVEL > 0). I propose to remove the string.h include and add manually the declaration.

Tested on x86_64-apple-darwin and on x86_64-unknown-linux-gnu.
This solves PR51655.

Patrick Marlier.

testsuite/ChangeLog
2012-01-05  Patrick Marlier  <patrick.marl...@gmail.com>

        PR testsuite/51655
        * c-c++-common/tm/memcpy-1.c: Declare memcpy instead of
        including <string.h>.
Index: c-c++-common/tm/memcpy-1.c
===================================================================
--- c-c++-common/tm/memcpy-1.c	(revision 182922)
+++ c-c++-common/tm/memcpy-1.c	(working copy)
@@ -1,6 +1,10 @@
 /* { dg-do compile } */
 /* { dg-options "-fgnu-tm" } */
-#include <string.h>
+typedef __SIZE_TYPE__ size_t;
+#ifdef __cplusplus
+extern "C"
+#endif
+void *memcpy (void *__restrict, const void *__restrict, size_t);
 
 __attribute__((transaction_safe))
 void *wmemcpy(void *dest, const void *src, size_t n)

Reply via email to