Skip to content

Commit 291298c

Browse files
committed
Fix -Wundef warnings for RBIMPL_HAS_BUILTIN
* See [Feature #17752] * Defining explicitly to 0 seems the best solution, see #4428 * For example: ./include/ruby/internal/has/builtin.h:49:33: error: "RBIMPL_HAS_BUILTIN___builtin_assume" is not defined, evaluates to 0 [-Werror=undef] 49 | # define RBIMPL_HAS_BUILTIN(_) (RBIMPL_HAS_BUILTIN_ ## _) | ^~~~~~~~~~~~~~~~~~~ ./include/ruby/internal/assume.h:75:7: note: in expansion of macro ‘RBIMPL_HAS_BUILTIN’ 75 | #elif RBIMPL_HAS_BUILTIN(__builtin_assume) | ^~~~~~~~~~~~~~~~~~
1 parent 03e6d19 commit 291298c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

include/ruby/internal/has/builtin.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
# define RBIMPL_HAS_BUILTIN___builtin_add_overflow RBIMPL_COMPILER_SINCE(GCC, 5, 1, 0)
5151
# define RBIMPL_HAS_BUILTIN___builtin_alloca RBIMPL_COMPILER_SINCE(GCC, 0, 0, 0)
5252
# define RBIMPL_HAS_BUILTIN___builtin_alloca_with_align RBIMPL_COMPILER_SINCE(GCC, 6, 1, 0)
53+
# define RBIMPL_HAS_BUILTIN___builtin_assume 0
5354
# /* See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 for bswap16. */
5455
# define RBIMPL_HAS_BUILTIN___builtin_bswap16 RBIMPL_COMPILER_SINCE(GCC, 4, 8, 0)
5556
# define RBIMPL_HAS_BUILTIN___builtin_bswap32 RBIMPL_COMPILER_SINCE(GCC, 3, 6, 0)
@@ -79,7 +80,9 @@
7980
# /* Take config.h definition when available */
8081
# define RBIMPL_HAS_BUILTIN(_) ((RBIMPL_HAS_BUILTIN_ ## _)+0)
8182
# define RBIMPL_HAS_BUILTIN___builtin_add_overflow HAVE_BUILTIN___BUILTIN_ADD_OVERFLOW
83+
# define RBIMPL_HAS_BUILTIN___builtin_alloca 0
8284
# define RBIMPL_HAS_BUILTIN___builtin_alloca_with_align HAVE_BUILTIN___BUILTIN_ALLOCA_WITH_ALIGN
85+
# define RBIMPL_HAS_BUILTIN___builtin_assume 0
8386
# define RBIMPL_HAS_BUILTIN___builtin_assume_aligned HAVE_BUILTIN___BUILTIN_ASSUME_ALIGNED
8487
# define RBIMPL_HAS_BUILTIN___builtin_bswap16 HAVE_BUILTIN___BUILTIN_BSWAP16
8588
# define RBIMPL_HAS_BUILTIN___builtin_bswap32 HAVE_BUILTIN___BUILTIN_BSWAP32
@@ -96,9 +99,7 @@
9699
# define RBIMPL_HAS_BUILTIN___builtin_popcount HAVE_BUILTIN___BUILTIN_POPCOUNT
97100
# define RBIMPL_HAS_BUILTIN___builtin_popcountll HAVE_BUILTIN___BUILTIN_POPCOUNTLL
98101
# define RBIMPL_HAS_BUILTIN___builtin_sub_overflow HAVE_BUILTIN___BUILTIN_SUB_OVERFLOW
99-
# if defined(UNREACHABLE)
100-
# define RBIMPL_HAS_BUILTIN___builtin_unreachable 1
101-
# endif
102+
# define RBIMPL_HAS_BUILTIN___builtin_unreachable defined(UNREACHABLE)
102103
#endif
103104

104105
#endif /* RBIMPL_HAS_BUILTIN_H */

0 commit comments

Comments
 (0)