From: Rohan McGovern Date: Fri, 27 May 2011 04:31:11 +0000 (+1000) Subject: tests: fixed compilation of qstring benchmark on mac X-Git-Tag: qt-v5.0.0-alpha1~4243 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6abf9093f75d11f120bd3b8569d2cc843c27c09f;p=profile%2Fivi%2Fqtbase.git tests: fixed compilation of qstring benchmark on mac On Mac, MAP_ANONYMOUS and MAP_POPULATE are not defined. Fix MAP_ANONYMOUS by defining it to MAP_ANON. Fix MAP_POPULATE by removing it, because its usage was unnecessary in this code (the page was explicitly faulted in a few lines later anyway). Change-Id: Iead82e1a949b35fe3c304d38babac8d4dc6f0769 Reviewed-on: http://codereview.qt.nokia.com/162 Reviewed-by: Jason McDonald --- diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp index d62cdac..95aaad3 100644 --- a/tests/benchmarks/corelib/tools/qstring/main.cpp +++ b/tests/benchmarks/corelib/tools/qstring/main.cpp @@ -53,6 +53,11 @@ #include #endif +// MAP_ANON is deprecated on Linux, and MAP_ANONYMOUS is not present on Mac +#ifndef MAP_ANONYMOUS +# define MAP_ANONYMOUS MAP_ANON +#endif + #include #include "data.h" @@ -772,7 +777,7 @@ static void __attribute__((noinline)) equals2_selftest() void *page1, *page3; ushort *page2; page1 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); + page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); page3 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); Q_ASSERT(quintptr(page2) == quintptr(page1) + pagesize || quintptr(page2) == quintptr(page1) - pagesize); @@ -1329,7 +1334,7 @@ void tst_QString::ucstrncmp() const void *page1, *page3; ushort *page2; page1 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); + page2 = (ushort *)mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); page3 = mmap(0, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); Q_ASSERT(quintptr(page2) == quintptr(page1) + pagesize || quintptr(page2) == quintptr(page1) - pagesize);