1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Check if __assume is supported

This commit is contained in:
Nobuyoshi Nakada 2022-02-19 21:22:13 +09:00
parent 131154f878
commit 7470780058
Notes: git 2022-02-19 23:33:11 +09:00
4 changed files with 14 additions and 6 deletions

View file

@ -1679,6 +1679,18 @@ AS_IF([test "$GCC" = yes], [
AS_IF([test "$rb_cv_func___builtin_unreachable" = yes], [
AC_DEFINE(HAVE___BUILTIN_UNREACHABLE)
])
AC_CACHE_CHECK(for __assume, rb_cv_func___assume,
[RUBY_WERROR_FLAG([
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
[[__assume(1);]])],
[rb_cv_func___assume=yes],
[rb_cv_func___assume=no])
])
])
AS_IF([test "$rb_cv_func___assume" = yes], [
AC_DEFINE(HAVE___ASSUME)
])
}
AC_CACHE_CHECK(for exported function attribute, rb_cv_func_exported, [

View file

@ -24,7 +24,6 @@
#include "ruby/internal/assume.h"
#include "ruby/internal/has/builtin.h"
#undef ASSUME /* Kill config.h definition */
#define ASSUME RBIMPL_ASSUME /**< @old{RBIMPL_ASSUME} */
#define UNREACHABLE RBIMPL_UNREACHABLE() /**< @old{RBIMPL_UNREACHABLE} */
#define UNREACHABLE_RETURN RBIMPL_UNREACHABLE_RETURN /**< @old{RBIMPL_UNREACHABLE_RETURN} */

View file

@ -32,10 +32,7 @@
#include "ruby/internal/warning_push.h"
/** @cond INTERNAL_MACRO */
#if RBIMPL_COMPILER_SINCE(MSVC, 13, 10, 0)
# define RBIMPL_HAVE___ASSUME
#elif RBIMPL_COMPILER_SINCE(Intel, 13, 0, 0)
#if defined(HAVE___ASSUME)
# define RBIMPL_HAVE___ASSUME
#endif
/** @endcond */

View file

@ -702,7 +702,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub
#define ALWAYS_INLINE(x) __forceinline x
#define WARN_UNUSED_RESULT(x) x
#define MAYBE_UNUSED(x) x
#define ASSUME(x) __assume(!!(x))
#define HAVE___ASSUME 1
#define FUNC_STDCALL(x) __stdcall x
#define FUNC_CDECL(x) __cdecl x
#define FUNC_FASTCALL(x) __fastcall x