projects
/
gcc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
027a9dd
)
strncmp-2.c: Portability fixes.
author
Aaron Sawdey
<acsawdey@gcc.gnu.org>
Mon, 20 Feb 2017 17:09:40 +0000
(11:09 -0600)
committer
Aaron Sawdey
<acsawdey@gcc.gnu.org>
Mon, 20 Feb 2017 17:09:40 +0000
(11:09 -0600)
2017-02-14 Aaron Sawdey <acsawdey@linux.vnet.ibm.com>
* gcc.dg/strncmp-2.c: Portability fixes.
From-SVN: r245608
gcc/testsuite/gcc.dg/strncmp-2.c
patch
|
blob
|
history
diff --git
a/gcc/testsuite/gcc.dg/strncmp-2.c
b/gcc/testsuite/gcc.dg/strncmp-2.c
index 0c9a07aacb77a17731cb6d519ca233138bc3f0b9..ed6c5fa08809c82e2fe556f8eece8805486e15de 100644
(file)
--- a/
gcc/testsuite/gcc.dg/strncmp-2.c
+++ b/
gcc/testsuite/gcc.dg/strncmp-2.c
@@
-19,7
+19,12
@@
static void test_driver_strncmp (void (test_strncmp)(const char *, const char *,
{
long pgsz = sysconf(_SC_PAGESIZE);
char buf1[sz+1];
- char *buf2 = aligned_alloc(pgsz,2*pgsz);
+ char *buf2;
+#if _POSIX_C_SOURCE >= 200112L
+ if ( posix_memalign ((void **)&buf2, pgsz, 2*pgsz) ) abort ();
+#else
+ if ( !(buf2 = valloc(2*pgsz))) abort ();
+#endif
char *p2;
int r,i,e;
@@
-35,6
+40,7
@@
static void test_driver_strncmp (void (test_strncmp)(const char *, const char *,
e = lib_memcmp(buf1,p2,sz);
(*test_memcmp)(buf1,p2,e);
}
+ free(buf2);
}
#define RUN_TEST(SZ) test_driver_strncmp (test_strncmp_ ## SZ, test_memcmp_ ## SZ, SZ);