From 6c2009c92afbc42f5d64a2efef4ab6ca90fce1b0 Mon Sep 17 00:00:00 2001 From: yui-knk Date: Tue, 30 May 2023 21:37:04 +0900 Subject: [PATCH] wip --- st2.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/st2.h b/st2.h index 5b39ac0496c294..61d7a43baf5f57 100644 --- a/st2.h +++ b/st2.h @@ -18,6 +18,57 @@ extern "C" { #include #include "ruby/config.h" +/* From include/ruby/internal/has/warning.h */ +#if defined(__has_warning) +# define RBIMPL_HAS_WARNING(_) __has_warning(_) +#else +# define RBIMPL_HAS_WARNING(_) 0 +#endif + + +/* From include/ruby/backward/2/long_long.h */ +#if defined(__DOXYGEN__) +# /** @cond INTERNAL_MACRO */ +# define HAVE_LONG_LONG 1 +# define HAVE_TRUE_LONG_LONG 1 +# /** @endcond */ +# /** @deprecated Just use `long long` directly. */ +# define LONG_LONG long long. + +#elif RBIMPL_HAS_WARNING("-Wc++11-long-long") +# define HAVE_TRUE_LONG_LONG 1 +# define LONG_LONG \ + RBIMPL_WARNING_PUSH() \ + RBIMPL_WARNING_IGNORED(-Wc++11-long-long) \ + long long \ + RBIMPL_WARNING_POP() + +#elif RBIMPL_HAS_WARNING("-Wlong-long") +# define HAVE_TRUE_LONG_LONG 1 +# define LONG_LONG \ + RBIMPL_WARNING_PUSH() \ + RBIMPL_WARNING_IGNORED(-Wlong-long) \ + long long \ + RBIMPL_WARNING_POP() + +#elif defined(HAVE_LONG_LONG) +# define HAVE_TRUE_LONG_LONG 1 +# define LONG_LONG long long + +#elif SIZEOF___INT64 > 0 +# define HAVE_LONG_LONG 1 +# define LONG_LONG __int64 +# undef SIZEOF_LONG_LONG +# define SIZEOF_LONG_LONG SIZEOF___INT64 + +#else +# error Hello! Ruby developers believe this message must not happen. +# error If you encounter this message, can you file a bug report? +# error Remember to attach a detailed description of your environment. +# error Thank you! +#endif + + RUBY_SYMBOL_EXPORT_BEGIN #if SIZEOF_LONG == SIZEOF_VOIDP