summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-07-25 11:51:24 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-25 11:51:24 +0200
commitafc638c3ab0e548344d5d88341dcd4492c990260 (patch)
treed743296fd19426a9653f0d82c9895045971eb40f
parentf46a1377ac39985b4fe6132a6b360dcac0036c38 (diff)
downloadserenity-afc638c3ab0e548344d5d88341dcd4492c990260.zip
AK: Allow NonnullRefPtr::ptr() when in "unknown" typestate.
Clang loses the typestate when passing NonnullRefPtr's via lambda captures. This is unfortunate, but not much we can do about it. Allowing ptr() makes it possible to use captured NonnullRefPtrs as you'd expect.
-rw-r--r--AK/NonnullRefPtr.h4
-rw-r--r--AK/Platform.h6
2 files changed, 7 insertions, 3 deletions
diff --git a/AK/NonnullRefPtr.h b/AK/NonnullRefPtr.h
index 0cbb4ed8f9..75272f71c8 100644
--- a/AK/NonnullRefPtr.h
+++ b/AK/NonnullRefPtr.h
@@ -148,13 +148,13 @@ public:
return *leakedPtr;
}
- CALLABLE_WHEN(unconsumed)
+ CALLABLE_WHEN("unconsumed","unknown")
T* ptr()
{
ASSERT(m_ptr);
return m_ptr;
}
- CALLABLE_WHEN(unconsumed)
+ CALLABLE_WHEN("unconsumed","unknown")
const T* ptr() const
{
ASSERT(m_ptr);
diff --git a/AK/Platform.h b/AK/Platform.h
index 7764b93923..c75abaa69a 100644
--- a/AK/Platform.h
+++ b/AK/Platform.h
@@ -17,7 +17,11 @@
# define RETURN_TYPESTATE(state) __attribute__((return_typestate(state)))
#else
# define CONSUMABLE(initial_state)
-# define CALLABLE_WHEN(state)
+# define CALLABLE_WHEN(...)
# define SET_TYPESTATE(state)
# define RETURN_TYPESTATE(state)
#endif
+
+#ifndef __serenity__
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
+#endif