Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runtime-c-api) Add support for clang in WASMER_H_MACROS #960

Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).
Expand Down
24 changes: 12 additions & 12 deletions lib/runtime-c-api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ fn main() {
out_wasmer_header_file.push("wasmer");

const WASMER_PRE_HEADER: &str = r#"
#ifndef WASMER_H_MACROS
#define WASMER_H_MACROS
#if MSVC
#ifdef _M_AMD64
#define ARCH_X86_64
#endif
#endif
#if !defined(WASMER_H_MACROS)
#define WASMER_H_MACROS
#if defined(MSVC)
#if defined(_M_AMD64)
#define ARCH_X86_64
#endif
#endif

#if GCC
#ifdef __x86_64__
#define ARCH_X86_64
#endif
#if defined(GCC) || defined(__clang__)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug fix is here: defined(__clang__).

#if defined(__x86_64__)
#define ARCH_X86_64
#endif
#endif
#endif
#endif // WASMER_H_MACROS
"#;
// Generate the C bindings in the `OUT_DIR`.
out_wasmer_header_file.set_extension("h");
Expand Down
26 changes: 13 additions & 13 deletions lib/runtime-c-api/wasmer.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

#ifndef WASMER_H_MACROS
#define WASMER_H_MACROS
#if MSVC
#ifdef _M_AMD64
#define ARCH_X86_64
#if !defined(WASMER_H_MACROS)
#define WASMER_H_MACROS
#if defined(MSVC)
#if defined(_M_AMD64)
#define ARCH_X86_64
#endif
#endif

#if defined(GCC) || defined(__clang__)
#if defined(__x86_64__)
#define ARCH_X86_64
#endif
#endif
#endif
#endif

#if GCC
#ifdef __x86_64__
#define ARCH_X86_64
#endif
#endif
#endif // WASMER_H_MACROS


#ifndef WASMER_H
Expand Down
26 changes: 13 additions & 13 deletions lib/runtime-c-api/wasmer.hh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

#ifndef WASMER_H_MACROS
#define WASMER_H_MACROS
#if MSVC
#ifdef _M_AMD64
#define ARCH_X86_64
#if !defined(WASMER_H_MACROS)
#define WASMER_H_MACROS
#if defined(MSVC)
#if defined(_M_AMD64)
#define ARCH_X86_64
#endif
#endif

#if defined(GCC) || defined(__clang__)
#if defined(__x86_64__)
#define ARCH_X86_64
#endif
#endif
#endif
#endif

#if GCC
#ifdef __x86_64__
#define ARCH_X86_64
#endif
#endif
#endif // WASMER_H_MACROS


#ifndef WASMER_H
Expand Down