diff --git a/CHANGELOG.md b/CHANGELOG.md index a3bcfcd9518..24d0a57f3ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## **[Unreleased]** +- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang. - [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment. - [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional. - [#915](https://github.com/wasmerio/wasmer/pull/915) All backends share the same definition of `Trampoline` (defined in `wasmer-runtime-core`). diff --git a/lib/runtime-c-api/build.rs b/lib/runtime-c-api/build.rs index 7c518398c63..7750b00813d 100644 --- a/lib/runtime-c-api/build.rs +++ b/lib/runtime-c-api/build.rs @@ -13,19 +13,21 @@ fn main() { out_wasmer_header_file.push("wasmer"); const WASMER_PRE_HEADER: &str = r#" -#ifndef WASMER_H_MACROS +#if !defined(WASMER_H_MACROS) #define WASMER_H_MACROS -#if MSVC -#ifdef _M_AMD64 + +#if defined(MSVC) +#if defined(_M_AMD64) #define ARCH_X86_64 #endif #endif -#if GCC -#ifdef __x86_64__ +#if defined(GCC) || defined(__clang__) +#if defined(__x86_64__) #define ARCH_X86_64 #endif #endif + #endif // WASMER_H_MACROS "#; // Generate the C bindings in the `OUT_DIR`. diff --git a/lib/runtime-c-api/wasmer.h b/lib/runtime-c-api/wasmer.h index bc4a3ed4fe6..836a41df215 100644 --- a/lib/runtime-c-api/wasmer.h +++ b/lib/runtime-c-api/wasmer.h @@ -1,17 +1,19 @@ -#ifndef WASMER_H_MACROS +#if !defined(WASMER_H_MACROS) #define WASMER_H_MACROS -#if MSVC -#ifdef _M_AMD64 + +#if defined(MSVC) +#if defined(_M_AMD64) #define ARCH_X86_64 #endif #endif -#if GCC -#ifdef __x86_64__ +#if defined(GCC) || defined(__clang__) +#if defined(__x86_64__) #define ARCH_X86_64 #endif #endif + #endif // WASMER_H_MACROS diff --git a/lib/runtime-c-api/wasmer.hh b/lib/runtime-c-api/wasmer.hh index acf4b20e797..79c350d6080 100644 --- a/lib/runtime-c-api/wasmer.hh +++ b/lib/runtime-c-api/wasmer.hh @@ -1,17 +1,19 @@ -#ifndef WASMER_H_MACROS +#if !defined(WASMER_H_MACROS) #define WASMER_H_MACROS -#if MSVC -#ifdef _M_AMD64 + +#if defined(MSVC) +#if defined(_M_AMD64) #define ARCH_X86_64 #endif #endif -#if GCC -#ifdef __x86_64__ +#if defined(GCC) || defined(__clang__) +#if defined(__x86_64__) #define ARCH_X86_64 #endif #endif + #endif // WASMER_H_MACROS