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

Define HAVE___BUILTIN_UNREACHABLE instead of UNREACHABLE

`UNREACHABLE` in ruby/internal/has/builtin.h is only used as just
a flag now, and redefined in ruby/backward/2/assume.h then.
This commit is contained in:
Nobuyoshi Nakada 2022-02-19 16:02:29 +09:00
parent 6e6ee1e6b3
commit 131154f878
Notes: git 2022-02-19 23:33:11 +09:00
4 changed files with 2 additions and 8 deletions

View file

@ -1677,7 +1677,7 @@ AS_IF([test "$GCC" = yes], [
])
])
AS_IF([test "$rb_cv_func___builtin_unreachable" = yes], [
AC_DEFINE_UNQUOTED(UNREACHABLE, [__builtin_unreachable()])
AC_DEFINE(HAVE___BUILTIN_UNREACHABLE)
])
}

View file

@ -25,7 +25,6 @@
#include "ruby/internal/has/builtin.h"
#undef ASSUME /* Kill config.h definition */
#undef UNREACHABLE /* 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

@ -78,10 +78,6 @@
# define RBIMPL_HAS_BUILTIN___builtin_unreachable RBIMPL_COMPILER_SINCE(GCC, 4, 5, 0)
# /* Note that "0, 0, 0" might be inaccurate. */
#elif RBIMPL_COMPILER_IS(MSVC)
# /* MSVC has UNREACHABLE, but that is not __builtin_unreachable. */
# define RBIMPL_HAS_BUILTIN(_) 0
#else
# /* Take config.h definition when available */
# define RBIMPL_HAS_BUILTIN(_) ((RBIMPL_HAS_BUILTIN_ ## _)+0)
@ -111,7 +107,7 @@
# define RBIMPL_HAS_BUILTIN___builtin_rotateright64 0
# define RBIMPL_HAS_BUILTIN___builtin_popcountll HAVE_BUILTIN___BUILTIN_POPCOUNTLL
# define RBIMPL_HAS_BUILTIN___builtin_sub_overflow HAVE_BUILTIN___BUILTIN_SUB_OVERFLOW
# if defined(UNREACHABLE)
# if defined(HAVE___BUILTIN_UNREACHABLE)
# define RBIMPL_HAS_BUILTIN___builtin_unreachable 1
# else
# define RBIMPL_HAS_BUILTIN___builtin_unreachable 0

View file

@ -702,7 +702,6 @@ $(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 UNREACHABLE __assume(0)
#define ASSUME(x) __assume(!!(x))
#define FUNC_STDCALL(x) __stdcall x
#define FUNC_CDECL(x) __cdecl x