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
65 65
static inline VALUE
66 66
rb_vm_lvar(rb_execution_context_t *ec, int index)
67 67
{
68
#if VM_CORE_H_EC_DEFINED
68
#if defined(VM_CORE_H_EC_DEFINED) && VM_CORE_H_EC_DEFINED
69 69
    return ec->cfp->ep[index];
70 70
#else
71 71
    return rb_vm_lvar_exposed(ec, index);
72
-- a/dir.c
72
++ b/dir.c
......
216 216
#else
217 217
#define FNM_SYSCASE	0
218 218
#endif
219
#if _WIN32
219
#ifdef _WIN32
220 220
#define FNM_SHORTNAME	0x20
221 221
#else
222 222
#define FNM_SHORTNAME	0
223
-- a/gc.c
223
++ b/gc.c
......
829 829
};
830 830
#define HEAP_PAGE_ALIGN (1 << HEAP_PAGE_ALIGN_LOG)
831 831
#define HEAP_PAGE_SIZE HEAP_PAGE_ALIGN
832
#if defined(HAVE_MMAP) && (PAGE_SIZE <= HEAP_PAGE_SIZE)
832
#if defined(HAVE_MMAP) && (!defined(PAGE_SIZE) || PAGE_SIZE <= HEAP_PAGE_SIZE)
833 833
# define USE_MMAP_ALIGNED_ALLOC 1
834 834
#else
835 835
# define USE_MMAP_ALIGNED_ALLOC 0
836
-- a/hash.c
836
++ b/hash.c
......
800 800
    if (RHASH_AR_TABLE(hash)) {
801 801
        unsigned i, bound = RHASH_AR_TABLE_BOUND(hash);
802 802

  
803
#if RHASH_CONVERT_TABLE_DEBUG
803
#if defined(RHASH_CONVERT_TABLE_DEBUG) && RHASH_CONVERT_TABLE_DEBUG
804 804
        rb_obj_info_dump(hash);
805 805
        fprintf(stderr, "force_convert: %s:%d\n", file, line);
806 806
        RB_DEBUG_COUNTER_INC(obj_hash_force_convert);
807
-- a/include/ruby/internal/attr/const.h
807
++ b/include/ruby/internal/attr/const.h
......
37 37
#endif
38 38

  
39 39
/** Enables #RBIMPL_ATTR_CONST if and only if. ! #RUBY_DEBUG. */
40
#if !RUBY_DEBUG
40
#if !defined(RUBY_DEBUG) || !RUBY_DEBUG
41 41
# define RBIMPL_ATTR_CONST_UNLESS_DEBUG() RBIMPL_ATTR_CONST()
42 42
#else
43 43
# define RBIMPL_ATTR_CONST_UNLESS_DEBUG() /* void */
44
-- a/memory_view.c
44
++ b/memory_view.c
......
671 671
            return LL2NUM(val.ll);
672 672
        }
673 673
        else {
674
#if SIZEOF_INT64_t == SIZEOF_LONG
674
#if SIZEOF_INT64_T == SIZEOF_LONG
675 675
            return LONG2NUM(val.i64);
676 676
#else
677 677
            return LL2NUM(val.i64);
......
683 683
            return ULL2NUM(val.ull);
684 684
        }
685 685
        else {
686
#if SIZEOF_UINT64_t == SIZEOF_LONG
686
#if SIZEOF_UINT64_T == SIZEOF_LONG
687 687
            return ULONG2NUM(val.u64);
688 688
#else
689 689
            return ULL2NUM(val.u64);
690
-- a/ractor_core.h
690
++ b/ractor_core.h
......
261 261
rb_ractor_set_current_ec(rb_ractor_t *cr, rb_execution_context_t *ec)
262 262
{
263 263
#ifdef RB_THREAD_LOCAL_SPECIFIER
264
  #if __APPLE__
264
  #ifdef __APPLE__
265 265
    rb_current_ec_set(ec);
266 266
  #else
267 267
    ruby_current_ec = ec;
268
-- a/thread_pthread.h
268
++ b/thread_pthread.h
......
100 100

  
101 101
RUBY_SYMBOL_EXPORT_BEGIN
102 102
#ifdef RB_THREAD_LOCAL_SPECIFIER
103
  #if __APPLE__
103
  #ifdef __APPLE__
104 104
    // on Darwin, TLS can not be accessed across .so
105 105
    struct rb_execution_context_struct *rb_current_ec();
106 106
    void rb_current_ec_set(struct rb_execution_context_struct *);
107
-- a/ruby.c
107
++ b/ruby.c
......
1826 1826
    opt->script_name = rb_str_new_cstr(opt->script);
1827 1827
    opt->script = RSTRING_PTR(opt->script_name);
1828 1828

  
1829
#if _WIN32
1829
#ifdef _WIN32
1830 1830
    translit_char_bin(RSTRING_PTR(opt->script_name), '\\', '/');
1831 1831
#elif defined DOSISH
1832 1832
    translit_char(RSTRING_PTR(opt->script_name), '\\', '/');
1833
-- a/vm.c
1833
++ b/vm.c
......
3264 3264
nsdr(VALUE self)
3265 3265
{
3266 3266
    VALUE ary = rb_ary_new();
3267
#if HAVE_BACKTRACE
3267
#ifdef HAVE_BACKTRACE
3268 3268
#include <execinfo.h>
3269 3269
#define MAX_NATIVE_TRACE 1024
3270 3270
    static void *trace[MAX_NATIVE_TRACE];
3271
-- a/vm_core.h
3271
++ b/vm_core.h
......
664 664
#endif
665 665
    const struct rb_callcache *global_cc_cache_table[VM_GLOBAL_CC_CACHE_TABLE_SIZE]; // vm_eval.c
666 666

  
667
#if USE_VM_CLOCK
667
#if defined(USE_VM_CLOCK) && USE_VM_CLOCK
668 668
    uint32_t clock;
669 669
#endif
670 670

  
......
864 864
    /* interrupt flags */
865 865
    rb_atomic_t interrupt_flag;
866 866
    rb_atomic_t interrupt_mask; /* size should match flag */
867
#if USE_VM_CLOCK
867
#if defined(USE_VM_CLOCK) && USE_VM_CLOCK
868 868
    uint32_t checked_clock;
869 869
#endif
870 870

  
......
1798 1798
rb_current_execution_context(void)
1799 1799
{
1800 1800
#ifdef RB_THREAD_LOCAL_SPECIFIER
1801
  #if __APPLE__
1801
  #ifdef __APPLE__
1802 1802
    rb_execution_context_t *ec = rb_current_ec();
1803 1803
  #else
1804 1804
    rb_execution_context_t *ec = ruby_current_ec;
......
1885 1885
static inline bool
1886 1886
RUBY_VM_INTERRUPTED_ANY(rb_execution_context_t *ec)
1887 1887
{
1888
#if USE_VM_CLOCK
1888
#if defined(USE_VM_CLOCK) && USE_VM_CLOCK
1889 1889
    uint32_t current_clock = rb_ec_vm_ptr(ec)->clock;
1890 1890

  
1891 1891
    if (current_clock != ec->checked_clock) {
1892
-- a/vm_exec.c
1892
++ b/vm_exec.c
......
104 104
#else
105 105
    register rb_control_frame_t *reg_cfp;
106 106
    const VALUE *reg_pc;
107
#define USE_MACHINE_REGS 0
108

  
107 109
#endif
108 110

  
109 111
#if USE_MACHINE_REGS