From f486d61629455390e7106b22c593a1ffa2e5d0c5 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 27 May 2019 09:07:04 -0700 Subject: [PATCH] Make use of `static_assert` conditional on whether it's available. --- wasmtime-wasi/sandboxed-system-primitives/src/posix.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wasmtime-wasi/sandboxed-system-primitives/src/posix.c b/wasmtime-wasi/sandboxed-system-primitives/src/posix.c index 42799ca47b..5fc6e81e5b 100644 --- a/wasmtime-wasi/sandboxed-system-primitives/src/posix.c +++ b/wasmtime-wasi/sandboxed-system-primitives/src/posix.c @@ -46,6 +46,9 @@ #include "rights.h" #include "str.h" +// static_assert is not defined in older compilers. +#ifdef static_assert + // struct iovec must have the same layout as __wasi_iovec_t. static_assert(offsetof(struct iovec, iov_base) == offsetof(__wasi_iovec_t, buf), @@ -78,6 +81,8 @@ static_assert(sizeof(((struct iovec *)0)->iov_len) == static_assert(sizeof(struct iovec) == sizeof(__wasi_ciovec_t), "Size mismatch"); +#endif + #if defined(WASMTIME_SSP_STATIC_CURFDS) static __thread struct fd_table *curfds; static __thread struct fd_prestats *prestats;