c++20 (timid) introduction of constinit proposal.

This commit is contained in:
David Carlier
2021-05-02 10:50:27 +01:00
committed by Matthew Parkinson
parent e3a7eab789
commit f3a9d3a682
3 changed files with 10 additions and 2 deletions

View File

@@ -20,6 +20,14 @@
# define SNMALLOC_COLD __attribute__((cold))
#endif
#if defined(__cpp_constinit) && __cpp_constinit >= 201907
# define SNMALLOC_CONSTINIT_FN constinit
# define SNMALLOC_CONSTINIT_STATIC constinit const
#else
# define SNMALLOC_CONSTINIT_FN constexpr
# define SNMALLOC_CONSTINIT_STATIC constexpr
#endif
#if !defined(__clang__) && defined(__GNUC__)
# define GCC_NOT_CLANG
#endif

View File

@@ -23,7 +23,7 @@ namespace snmalloc
static constexpr uint64_t pal_features =
AlignedAllocation | PALBSD<OS>::pal_features;
static constexpr size_t minimum_alloc_size = 4096;
static SNMALLOC_CONSTINIT_STATIC size_t minimum_alloc_size = 4096;
/**
* Reserve memory at a specific alignment.

View File

@@ -58,7 +58,7 @@ namespace snmalloc
# endif
;
static constexpr size_t minimum_alloc_size = 0x10000;
static SNMALLOC_CONSTINIT_STATIC size_t minimum_alloc_size = 0x10000;
static constexpr size_t page_size = 0x1000;