From e854bc8fc9fe9a5c5822fe5194f84b6c0f24ab69 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Thu, 12 May 2022 00:00:10 +0200 Subject: [PATCH] Remove warning in C++ mode for using C++ class --- tests/test-marray.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test-marray.c b/tests/test-marray.c index 18ec2088..a1d714a8 100644 --- a/tests/test-marray.c +++ b/tests/test-marray.c @@ -486,10 +486,20 @@ public: bool operator==(int n) const { return *x == n; } }; +// Disable the warning due to using memcpy/memmove with this C++ class +#if defined(__GNUC__) && __GNUC__ >= 8 + _Pragma("GCC diagnostic push") + _Pragma("GCC diagnostic ignored \"-Wclass-memaccess\"") +#endif + // Define a M*LIB array of such class ARRAY_DEF_AS(array_foo, array_foo_t, array_foo_it_t, Foo, M_CLASS_OPLIST(Foo)) #define M_OPL_array_foo_t() ARRAY_OPLIST(array_foo, M_CLASS_OPLIST(Foo)) +#if defined(__GNUC__) && __GNUC__ >= 8 + _Pragma("GCC diagnostic pop") +#endif + static void test_cplusplus(void) { int n = 100;