Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions src/util/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,32 +183,6 @@ do { \
# endif
#endif

#ifdef __cplusplus
/**
* Macro function that evaluates to true if T is a trivially
* destructible type -- that is, if its (non-virtual) destructor
* performs no action and all member variables and base classes are
* trivially destructible themselves.
*/
# if (defined(__clang__) && defined(__has_feature))
# if __has_feature(has_trivial_destructor)
# define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
# endif
# elif defined(__GNUC__)
# if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
# define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
# endif
# elif defined(_MSC_VER) && !defined(__INTEL_COMPILER)
# define HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
# endif
# ifndef HAS_TRIVIAL_DESTRUCTOR
/* It's always safe (if inefficient) to assume that a
* destructor is non-trivial.
*/
# define HAS_TRIVIAL_DESTRUCTOR(T) (false)
# endif
#endif

/**
* PUBLIC/USED macros
*
Expand Down
6 changes: 4 additions & 2 deletions src/util/ralloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
#include "macros.h"

#ifdef __cplusplus
#include <type_traits>

extern "C" {
#endif

Expand Down Expand Up @@ -504,7 +506,7 @@ public: \
{ \
void *p = ALLOC_FUNC(mem_ctx, size); \
assert(p != NULL); \
if (!HAS_TRIVIAL_DESTRUCTOR(TYPE)) \
if (!std::is_trivially_destructible<TYPE>()) \
ralloc_set_destructor(p, _ralloc_destructor); \
return p; \
} \
Expand All @@ -515,7 +517,7 @@ public: \
* called by the delete operator at this point -- Make sure it's \
* not called again. \
*/ \
if (!HAS_TRIVIAL_DESTRUCTOR(TYPE)) \
if (!std::is_trivially_destructible<TYPE>()) \
ralloc_set_destructor(p, NULL); \
ralloc_free(p); \
}
Expand Down