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

Fix trivial -Wundef warnings

* See [Feature #17752]

Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
This commit is contained in:
Benoit Daloze 2021-04-29 14:31:05 +02:00
parent 229cbeba8c
commit 68d6bd0873
Notes: git 2021-05-04 21:57:21 +09:00
16 changed files with 21 additions and 19 deletions

View file

@ -3,7 +3,7 @@
#include "iseq.h"
#include "builtin.h"
#if CROSS_COMPILING
#ifdef CROSS_COMPILING
#define INCLUDED_BY_BUILTIN_C 1
#include "mini_builtin.c"

View file

@ -65,7 +65,7 @@ PUREFUNC(static inline VALUE rb_vm_lvar(rb_execution_context_t *ec, int index));
static inline VALUE
rb_vm_lvar(rb_execution_context_t *ec, int index)
{
#if VM_CORE_H_EC_DEFINED
#if defined(VM_CORE_H_EC_DEFINED) && VM_CORE_H_EC_DEFINED
return ec->cfp->ep[index];
#else
return rb_vm_lvar_exposed(ec, index);

2
dir.c
View file

@ -216,7 +216,7 @@ typedef enum {
#else
#define FNM_SYSCASE 0
#endif
#if _WIN32
#ifdef _WIN32
#define FNM_SHORTNAME 0x20
#else
#define FNM_SHORTNAME 0

View file

@ -144,7 +144,7 @@ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
#define EC_REPUSH_TAG() (void)(_ec->tag = &_tag)
#if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) || __clang__
#if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) || defined __clang__
/* This macro prevents GCC 4.6--4.8 from emitting maybe-uninitialized warnings.
* This macro also prevents Clang from dumping core in EC_EXEC_TAG().
* (I confirmed Clang 4.0.1 and 5.0.0.)

2
gc.c
View file

@ -830,7 +830,7 @@ enum {
};
#define HEAP_PAGE_ALIGN (1 << HEAP_PAGE_ALIGN_LOG)
#define HEAP_PAGE_SIZE HEAP_PAGE_ALIGN
#if defined(HAVE_MMAP) && (PAGE_SIZE <= HEAP_PAGE_SIZE)
#if defined(HAVE_MMAP) && (!defined(PAGE_SIZE) || PAGE_SIZE <= HEAP_PAGE_SIZE)
# define USE_MMAP_ALIGNED_ALLOC 1
#else
# define USE_MMAP_ALIGNED_ALLOC 0

2
hash.c
View file

@ -800,7 +800,7 @@ ar_force_convert_table(VALUE hash, const char *file, int line)
if (RHASH_AR_TABLE(hash)) {
unsigned i, bound = RHASH_AR_TABLE_BOUND(hash);
#if RHASH_CONVERT_TABLE_DEBUG
#if defined(RHASH_CONVERT_TABLE_DEBUG) && RHASH_CONVERT_TABLE_DEBUG
rb_obj_info_dump(hash);
fprintf(stderr, "force_convert: %s:%d\n", file, line);
RB_DEBUG_COUNTER_INC(obj_hash_force_convert);

View file

@ -37,7 +37,7 @@
#endif
/** Enables #RBIMPL_ATTR_CONST if and only if. ! #RUBY_DEBUG. */
#if !RUBY_DEBUG
#if !defined(RUBY_DEBUG) || !RUBY_DEBUG
# define RBIMPL_ATTR_CONST_UNLESS_DEBUG() RBIMPL_ATTR_CONST()
#else
# define RBIMPL_ATTR_CONST_UNLESS_DEBUG() /* void */

View file

@ -671,7 +671,7 @@ extract_item_member(const uint8_t *ptr, const rb_memory_view_item_component_t *m
return LL2NUM(val.ll);
}
else {
#if SIZEOF_INT64_t == SIZEOF_LONG
#if SIZEOF_INT64_T == SIZEOF_LONG
return LONG2NUM(val.i64);
#else
return LL2NUM(val.i64);
@ -683,7 +683,7 @@ extract_item_member(const uint8_t *ptr, const rb_memory_view_item_component_t *m
return ULL2NUM(val.ull);
}
else {
#if SIZEOF_UINT64_t == SIZEOF_LONG
#if SIZEOF_UINT64_T == SIZEOF_LONG
return ULONG2NUM(val.u64);
#else
return ULL2NUM(val.u64);

View file

@ -261,7 +261,7 @@ static inline void
rb_ractor_set_current_ec(rb_ractor_t *cr, rb_execution_context_t *ec)
{
#ifdef RB_THREAD_LOCAL_SPECIFIER
#if __APPLE__
#ifdef __APPLE__
rb_current_ec_set(ec);
#else
ruby_current_ec = ec;

2
ruby.c
View file

@ -1826,7 +1826,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
opt->script_name = rb_str_new_cstr(opt->script);
opt->script = RSTRING_PTR(opt->script_name);
#if _WIN32
#ifdef _WIN32
translit_char_bin(RSTRING_PTR(opt->script_name), '\\', '/');
#elif defined DOSISH
translit_char(RSTRING_PTR(opt->script_name), '\\', '/');

View file

@ -43,7 +43,7 @@ Init_sizeof(void)
% next
% end
% cond = conditions[type]
#if SIZEOF_<%= type.tr_cpp %> != 0<%= " && #{cond}" if cond %>
#if defined(SIZEOF_<%= type.tr_cpp %>) && SIZEOF_<%= type.tr_cpp %> != 0<%= " && #{cond}" if cond %>
DEFINE(<%= type %>, <%= type.tr_cpp %>);
#endif
% end

View file

@ -100,7 +100,7 @@ native_tls_set(native_tls_key_t key, void *ptr)
RUBY_SYMBOL_EXPORT_BEGIN
#ifdef RB_THREAD_LOCAL_SPECIFIER
#if __APPLE__
#ifdef __APPLE__
// on Darwin, TLS can not be accessed across .so
struct rb_execution_context_struct *rb_current_ec();
void rb_current_ec_set(struct rb_execution_context_struct *);

View file

@ -343,7 +343,7 @@ def mk_builtin_header file
f.puts
f.puts " // arity_check"
f.puts "COMPILER_WARNING_PUSH"
f.puts "#if GCC_VERSION_SINCE(5, 1, 0) || __clang__"
f.puts "#if GCC_VERSION_SINCE(5, 1, 0) || defined __clang__"
f.puts "COMPILER_WARNING_ERROR(-Wincompatible-pointer-types)"
f.puts "#endif"
bs.each{|func, (argc, cfunc_name)|

2
vm.c
View file

@ -3262,7 +3262,7 @@ static VALUE
nsdr(VALUE self)
{
VALUE ary = rb_ary_new();
#if HAVE_BACKTRACE
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
#define MAX_NATIVE_TRACE 1024
static void *trace[MAX_NATIVE_TRACE];

View file

@ -670,7 +670,7 @@ typedef struct rb_vm_struct {
#endif
const struct rb_callcache *global_cc_cache_table[VM_GLOBAL_CC_CACHE_TABLE_SIZE]; // vm_eval.c
#if USE_VM_CLOCK
#if defined(USE_VM_CLOCK) && USE_VM_CLOCK
uint32_t clock;
#endif
@ -870,7 +870,7 @@ struct rb_execution_context_struct {
/* interrupt flags */
rb_atomic_t interrupt_flag;
rb_atomic_t interrupt_mask; /* size should match flag */
#if USE_VM_CLOCK
#if defined(USE_VM_CLOCK) && USE_VM_CLOCK
uint32_t checked_clock;
#endif
@ -1804,7 +1804,7 @@ static inline rb_execution_context_t *
rb_current_execution_context(void)
{
#ifdef RB_THREAD_LOCAL_SPECIFIER
#if __APPLE__
#ifdef __APPLE__
rb_execution_context_t *ec = rb_current_ec();
#else
rb_execution_context_t *ec = ruby_current_ec;
@ -1891,7 +1891,7 @@ enum {
static inline bool
RUBY_VM_INTERRUPTED_ANY(rb_execution_context_t *ec)
{
#if USE_VM_CLOCK
#if defined(USE_VM_CLOCK) && USE_VM_CLOCK
uint32_t current_clock = rb_ec_vm_ptr(ec)->clock;
if (current_clock != ec->checked_clock) {

View file

@ -104,6 +104,8 @@ vm_exec_core(rb_execution_context_t *ec, VALUE initial)
#else
register rb_control_frame_t *reg_cfp;
const VALUE *reg_pc;
#define USE_MACHINE_REGS 0
#endif
#if USE_MACHINE_REGS