summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2014-02-25 00:08:38 (GMT)
committerJason Evans <jasone@canonware.com>2014-02-25 00:08:38 (GMT)
commit99b0fbbe6975bf2af1387f75d961ad84fb108276 (patch)
tree5b9387647e2e6d7c142ed81a77addf5856dcf983 /include
parent302735f90ded144fe61d7d6049d6b30a4be0e104 (diff)
downloadjemalloc-99b0fbbe6975bf2af1387f75d961ad84fb108276.zip
jemalloc-99b0fbbe6975bf2af1387f75d961ad84fb108276.tar.gz
jemalloc-99b0fbbe6975bf2af1387f75d961ad84fb108276.tar.bz2
Add workaround for missing 'restrict' keyword.
Add a cpp #define that removes 'restrict' keyword usage unless the compiler definitely supports C99. As written, 'restrict' is only enabled if the compiler supports the -std=gnu99 option (e.g. gcc and llvm). Reported by Tobias Hieta.
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/jemalloc_internal_defs.h.in3
-rw-r--r--include/jemalloc/internal/jemalloc_internal_macros.h4
2 files changed, 7 insertions, 0 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in
index 752bb10..e3758e4 100644
--- a/include/jemalloc/internal/jemalloc_internal_defs.h.in
+++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in
@@ -187,6 +187,9 @@
*/
#undef JEMALLOC_HAS_ALLOCA_H
+/* C99 restrict keyword supported. */
+#undef JEMALLOC_HAS_RESTRICT
+
/* sizeof(int) == 2^LG_SIZEOF_INT. */
#undef LG_SIZEOF_INT
diff --git a/include/jemalloc/internal/jemalloc_internal_macros.h b/include/jemalloc/internal/jemalloc_internal_macros.h
index 70602ee..4e23923 100644
--- a/include/jemalloc/internal/jemalloc_internal_macros.h
+++ b/include/jemalloc/internal/jemalloc_internal_macros.h
@@ -45,3 +45,7 @@
#ifndef __DECONST
# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
#endif
+
+#ifndef JEMALLOC_HAS_RESTRICT
+# define restrict
+#endif