Patchwork [testsuite,trans-mem] memcpy-1.c testcase

login
register
mail settings
Submitter Patrick Marlier
Date Jan. 5, 2012, 11:44 p.m.
Message ID <4F0635CE.2000604@gmail.com>
Download mbox | patch
Permalink /patch/134556/
State New
Headers show

Comments

Patrick Marlier - Jan. 5, 2012, 11:44 p.m.
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.marlier@gmail.com>

	PR testsuite/51655
	* c-c++-common/tm/memcpy-1.c: Declare memcpy instead of
         including <string.h>.
Aldy Hernandez - Jan. 6, 2012, 4:17 p.m.
On 01/05/12 17:44, Patrick Marlier wrote:
> 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.marlier@gmail.com>
>
> PR testsuite/51655
> * c-c++-common/tm/memcpy-1.c: Declare memcpy instead of
> including <string.h>.

This looks reasonable.  Richard will have to give the approval.

Thanks.
Richard Henderson - Jan. 6, 2012, 9:58 p.m.
On 01/06/2012 10:44 AM, Patrick Marlier wrote:
> 2012-01-05  Patrick Marlier  <patrick.marlier@gmail.com>
> 
>     PR testsuite/51655
>     * c-c++-common/tm/memcpy-1.c: Declare memcpy instead of
>         including <string.h>.

Applied.


r~

Patch

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)