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
Родитель 6e6ee1e6b3
Коммит 131154f878
4 изменённых файлов: 2 добавлений и 8 удалений

Просмотреть файл

@ -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)
])
}

Просмотреть файл

@ -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} */

Просмотреть файл

@ -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

Просмотреть файл

@ -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