summaryrefslogtreecommitdiff
path: root/prism/defines.h
diff options
context:
space:
mode:
authorHASUMI Hitoshi <[email protected]>2024-01-22 15:17:40 +0900
committergit <[email protected]>2024-02-20 14:21:16 +0000
commit15b53e901c15225bdb2d67abb6f2aabf2e93cc4e (patch)
tree7b217108323944eeaeb1b1c1e67fa7e1f9ac4bc9 /prism/defines.h
parentc22cb960cf5333e4789489be16db42dc805395b0 (diff)
[ruby/prism] Use `_POSIX_MAPPED_FILES` and `_WIN32` to know if memory map interface is available in the target platform
https://github.com/ruby/prism/commit/88e2ff52d4
Diffstat (limited to 'prism/defines.h')
-rw-r--r--prism/defines.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/prism/defines.h b/prism/defines.h
index c9af5fa42c..8fa6a6a3d1 100644
--- a/prism/defines.h
+++ b/prism/defines.h
@@ -99,4 +99,13 @@
# define PM_STATIC_ASSERT(line, condition, message) typedef char PM_CONCATENATE(static_assert_, line)[(condition) ? 1 : -1]
#endif
+/**
+ * In general, libc for embedded systems does not support memory-mapped files.
+ * If the target platform is POSIX or Windows, we can map a file in memory and
+ * read it in a more efficient manner.
+ */
+#if defined(_POSIX_MAPPED_FILES) || defined(_WIN32)
+# define PRISM_HAS_MMAP
+#endif
+
#endif