From 2a5f98ed1d4d8e8b8c6c1850c5cbbe29dff08c94 Mon Sep 17 00:00:00 2001 From: barracuda156 Date: Wed, 22 May 2024 14:43:57 +0800 Subject: [PATCH] data.h: use _Static_assert when static_assert undefined Fixes: https://github.com/tlsa/libcyaml/issues/230 --- src/data.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git src/data.h src/data.h index 8b76a9c..4a00e4f 100644 --- src/data.h +++ src/data.h @@ -12,6 +12,13 @@ #ifndef CYAML_DATA_H #define CYAML_DATA_H +#include +#if !defined(static_assert) && (defined(__GNUC__) || defined(__clang__)) \ + && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \ + && __STDC_VERSION__ <= 201710L +#define static_assert _Static_assert +#endif + #include "cyaml/cyaml.h" #include "util.h"