Project

General

Profile

Feature #17752 » ruby-trivial-undefined-macros.patch

Trivial fix to calm down `-Wundef` warnings - xtkoba (Tee KOBAYASHI), 04/07/2021 01:03 AM

View differences:

builtin.h
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);
-- a/dir.c
++ b/dir.c
......
#else
#define FNM_SYSCASE 0
#endif
#if _WIN32
#ifdef _WIN32
#define FNM_SHORTNAME 0x20
#else
#define FNM_SHORTNAME 0
-- a/gc.c
++ b/gc.c
......
};
#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
-- a/hash.c
++ b/hash.c
......
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);
-- a/include/ruby/internal/attr/const.h
++ b/include/ruby/internal/attr/const.h
......
#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 */
-- a/memory_view.c
++ b/memory_view.c
......
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);
......
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);
-- a/ractor_core.h
++ b/ractor_core.h
......
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;
-- a/thread_pthread.h
++ b/thread_pthread.h
......
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 *);
-- a/ruby.c
++ b/ruby.c
......
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), '\\', '/');
-- a/vm.c
++ b/vm.c
......
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];
-- a/vm_core.h
++ b/vm_core.h
......
#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
......
/* 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
......
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;
......
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) {
-- a/vm_exec.c
++ b/vm_exec.c
......
#else
register rb_control_frame_t *reg_cfp;
const VALUE *reg_pc;
#define USE_MACHINE_REGS 0
#endif
#if USE_MACHINE_REGS
(4-4/5)