[Openmp-commits] [PATCH] D35072: Stop defining `PAGE_SIZE`, and use `getpagesize()` on Unix

Dimitry Andric via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jul 6 10:32:39 PDT 2017

dim created this revision.

The kmp_os.h header is defining the `PAGE_SIZE` macro unconditionally,
even while it is only used directly after its definition, for the
Windows implementation of the `KMP_GET_PAGE_SIZE()` macro.

On at least FreeBSD, but likely all other BSDs too, this macro conflicts
with the one defined in system headers, so remove it, since nothing else
uses it.  Make all Unixes use `getpagesize()` instead, and return 0x4000
directly for the Windows case.

(Note that Windows also has a way to retrieve page size, via the
SYSTEM_INFO structure:



Index: runtime/src/kmp_os.h
--- runtime/src/kmp_os.h
+++ runtime/src/kmp_os.h
@@ -248,14 +248,12 @@
 #define __forceinline __inline
-#define PAGE_SIZE (0x4000)
 #define KMP_GET_PAGE_SIZE() getpagesize()
 // TODO: find the corresponding function to getpagesize() in Windows
 // and use it whenever possible.
+#define KMP_GET_PAGE_SIZE() 0x4000
 #define PAGE_ALIGNED(_addr)                                                    \

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35072.105473.patch
Type: text/x-patch
Size: 596 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170706/31c59442/attachment.bin>

More information about the Openmp-commits mailing list