Skip to content

Commit 68d6bd0

Browse files
eregonxtkoba (Tee KOBAYASHI)
andcommitted
Fix trivial -Wundef warnings
* See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
1 parent 229cbeb commit 68d6bd0

File tree

16 files changed

+21
-19
lines changed

16 files changed

+21
-19
lines changed

builtin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "iseq.h"
44
#include "builtin.h"
55

6-
#if CROSS_COMPILING
6+
#ifdef CROSS_COMPILING
77

88
#define INCLUDED_BY_BUILTIN_C 1
99
#include "mini_builtin.c"

builtin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ PUREFUNC(static inline VALUE rb_vm_lvar(rb_execution_context_t *ec, int index));
6565
static inline VALUE
6666
rb_vm_lvar(rb_execution_context_t *ec, int index)
6767
{
68-
#if VM_CORE_H_EC_DEFINED
68+
#if defined(VM_CORE_H_EC_DEFINED) && VM_CORE_H_EC_DEFINED
6969
return ec->cfp->ep[index];
7070
#else
7171
return rb_vm_lvar_exposed(ec, index);

dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ typedef enum {
216216
#else
217217
#define FNM_SYSCASE 0
218218
#endif
219-
#if _WIN32
219+
#ifdef _WIN32
220220
#define FNM_SHORTNAME 0x20
221221
#else
222222
#define FNM_SHORTNAME 0

eval_intern.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
144144

145145
#define EC_REPUSH_TAG() (void)(_ec->tag = &_tag)
146146

147-
#if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) || __clang__
147+
#if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) || defined __clang__
148148
/* This macro prevents GCC 4.6--4.8 from emitting maybe-uninitialized warnings.
149149
* This macro also prevents Clang from dumping core in EC_EXEC_TAG().
150150
* (I confirmed Clang 4.0.1 and 5.0.0.)

gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ enum {
830830
};
831831
#define HEAP_PAGE_ALIGN (1 << HEAP_PAGE_ALIGN_LOG)
832832
#define HEAP_PAGE_SIZE HEAP_PAGE_ALIGN
833-
#if defined(HAVE_MMAP) && (PAGE_SIZE <= HEAP_PAGE_SIZE)
833+
#if defined(HAVE_MMAP) && (!defined(PAGE_SIZE) || PAGE_SIZE <= HEAP_PAGE_SIZE)
834834
# define USE_MMAP_ALIGNED_ALLOC 1
835835
#else
836836
# define USE_MMAP_ALIGNED_ALLOC 0

hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ ar_force_convert_table(VALUE hash, const char *file, int line)
800800
if (RHASH_AR_TABLE(hash)) {
801801
unsigned i, bound = RHASH_AR_TABLE_BOUND(hash);
802802

803-
#if RHASH_CONVERT_TABLE_DEBUG
803+
#if defined(RHASH_CONVERT_TABLE_DEBUG) && RHASH_CONVERT_TABLE_DEBUG
804804
rb_obj_info_dump(hash);
805805
fprintf(stderr, "force_convert: %s:%d\n", file, line);
806806
RB_DEBUG_COUNTER_INC(obj_hash_force_convert);

include/ruby/internal/attr/const.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#endif
3838

3939
/** Enables #RBIMPL_ATTR_CONST if and only if. ! #RUBY_DEBUG. */
40-
#if !RUBY_DEBUG
40+
#if !defined(RUBY_DEBUG) || !RUBY_DEBUG
4141
# define RBIMPL_ATTR_CONST_UNLESS_DEBUG() RBIMPL_ATTR_CONST()
4242
#else
4343
# define RBIMPL_ATTR_CONST_UNLESS_DEBUG() /* void */

memory_view.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ extract_item_member(const uint8_t *ptr, const rb_memory_view_item_component_t *m
671671
return LL2NUM(val.ll);
672672
}
673673
else {
674-
#if SIZEOF_INT64_t == SIZEOF_LONG
674+
#if SIZEOF_INT64_T == SIZEOF_LONG
675675
return LONG2NUM(val.i64);
676676
#else
677677
return LL2NUM(val.i64);
@@ -683,7 +683,7 @@ extract_item_member(const uint8_t *ptr, const rb_memory_view_item_component_t *m
683683
return ULL2NUM(val.ull);
684684
}
685685
else {
686-
#if SIZEOF_UINT64_t == SIZEOF_LONG
686+
#if SIZEOF_UINT64_T == SIZEOF_LONG
687687
return ULONG2NUM(val.u64);
688688
#else
689689
return ULL2NUM(val.u64);

ractor_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static inline void
261261
rb_ractor_set_current_ec(rb_ractor_t *cr, rb_execution_context_t *ec)
262262
{
263263
#ifdef RB_THREAD_LOCAL_SPECIFIER
264-
#if __APPLE__
264+
#ifdef __APPLE__
265265
rb_current_ec_set(ec);
266266
#else
267267
ruby_current_ec = ec;

ruby.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
18261826
opt->script_name = rb_str_new_cstr(opt->script);
18271827
opt->script = RSTRING_PTR(opt->script_name);
18281828

1829-
#if _WIN32
1829+
#ifdef _WIN32
18301830
translit_char_bin(RSTRING_PTR(opt->script_name), '\\', '/');
18311831
#elif defined DOSISH
18321832
translit_char(RSTRING_PTR(opt->script_name), '\\', '/');

0 commit comments

Comments
 (0)