From b7bd55cdc7125c4d383eea0e9be6e57015cd19b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Mon, 29 Apr 2024 03:09:15 +0200 Subject: [PATCH] suppress -Wold-style-cast warnings --- include/ruby/internal/stdckdint.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/ruby/internal/stdckdint.h b/include/ruby/internal/stdckdint.h index 33647a5a47..e5b5b8b751 100644 --- a/include/ruby/internal/stdckdint.h +++ b/include/ruby/internal/stdckdint.h @@ -20,6 +20,7 @@ * @brief C23 shim for */ #include "ruby/internal/config.h" +#include "ruby/internal/cast.h" #include "ruby/internal/has/builtin.h" #include "ruby/internal/stdbool.h" @@ -47,9 +48,9 @@ # include #elif RBIMPL_HAS_BUILTIN(__builtin_add_overflow) -# define ckd_add(x, y, z) ((bool)__builtin_add_overflow((y), (z), (x))) -# define ckd_sub(x, y, z) ((bool)__builtin_sub_overflow((y), (z), (x))) -# define ckd_mul(x, y, z) ((bool)__builtin_mul_overflow((y), (z), (x))) +# define ckd_add(x, y, z) RBIMPL_CAST((bool)__builtin_add_overflow((y), (z), (x))) +# define ckd_sub(x, y, z) RBIMPL_CAST((bool)__builtin_sub_overflow((y), (z), (x))) +# define ckd_mul(x, y, z) RBIMPL_CAST((bool)__builtin_mul_overflow((y), (z), (x))) # define __STDC_VERSION_STDCKDINT_H__ 202311L #/* elif defined(__cplusplus) */