summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2014-11-20 10:47:55 -0800
committerDan Albert <danalbert@google.com>2014-11-20 10:47:55 -0800
commite4c649c9fca659fda908b0d4608feedd434b5656 (patch)
tree976fd5c97560c95dbe4ab9128116bc3637190888 /include
parent606bb5f2e5f2913d5cb30ed87dd18da23dda1705 (diff)
downloadsystem_core-e4c649c9fca659fda908b0d4608feedd434b5656.zip
system_core-e4c649c9fca659fda908b0d4608feedd434b5656.tar.gz
system_core-e4c649c9fca659fda908b0d4608feedd434b5656.tar.bz2
Add a pre-C++11 constexpr compatibility macro.
Needed for cases where something should be constexpr if possible, but not being constexpr is fine if in pre-C++11 code (such as a const static float member variable). Bug: 18466763 Change-Id: I635d062575ba2fbc4cbe3a89f730128c404d95e1
Diffstat (limited to 'include')
-rw-r--r--include/utils/Compat.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/utils/Compat.h b/include/utils/Compat.h
index 20a6920..0df40a1 100644
--- a/include/utils/Compat.h
+++ b/include/utils/Compat.h
@@ -44,6 +44,17 @@ static inline ssize_t pread64(int fd, void* buf, size_t nbytes, off64_t offset)
#endif
/*
+ * Needed for cases where something should be constexpr if possible, but not
+ * being constexpr is fine if in pre-C++11 code (such as a const static float
+ * member variable).
+ */
+#if __cplusplus >= 201103L
+#define CONSTEXPR constexpr
+#else
+#define CONSTEXPR
+#endif
+
+/*
* TEMP_FAILURE_RETRY is defined by some, but not all, versions of
* <unistd.h>. (Alas, it is not as standard as we'd hoped!) So, if it's
* not already defined, then define it here.