From 3a62badb2e1606274f7e36302c96b96f57e90b2d Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Tue, 7 Jun 2022 16:33:02 +0200 Subject: [PATCH] util: use c11 alignof instead of our own ...with an exception for MSVC, which doesn't have stdalign.h, so let's add a definition for that. Reviewed-by: Jesse Natalie Part-of: --- src/util/macros.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/util/macros.h b/src/util/macros.h index 22b18303826..e0af384f7b9 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -410,13 +410,11 @@ u_uintN_max(unsigned bit_size) return UINT64_MAX >> (64 - bit_size); } -#if !defined(alignof) && !defined(__cplusplus) -#if __STDC_VERSION__ >= 201112L -#define alignof(t) _Alignof(t) -#elif defined(_MSC_VER) -#define alignof(t) __alignof(t) +#ifndef __cplusplus +#ifdef _MSC_VER +#define alignof _Alignof #else -#define alignof(t) __alignof__(t) +#include #endif #endif