diff --git a/rust/rust.cc b/rust/rust.cc index 279884d0..cb486233 100644 --- a/rust/rust.cc +++ b/rust/rust.cc @@ -24,17 +24,12 @@ namespace { USING_NEXTPNR_NAMESPACE; - // `memcpy` is used here to avoid strict-aliasing problems, but GCC dislikes it. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wclass-memaccess" - template - uint64_t wrap(T thing) { + template static inline uint64_t wrap(const T &thing) noexcept { static_assert(sizeof(T) <= 8, "T is too big for FFI"); uint64_t b = 0; memcpy(&b, &thing, sizeof(T)); return b; } -#pragma GCC diagnostic pop template static inline T unwrap(const std::array &value) noexcept { static_assert(sizeof(T) <= 8, "T is too big for FFI");