Fix trivial -Wundef warnings
* See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@gmail.com>
This commit is contained in:
parent
229cbeba8c
commit
68d6bd0873
Notes:
git
2021-05-04 21:57:21 +09:00
@ -3,7 +3,7 @@
|
|||||||
#include "iseq.h"
|
#include "iseq.h"
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
|
|
||||||
#if CROSS_COMPILING
|
#ifdef CROSS_COMPILING
|
||||||
|
|
||||||
#define INCLUDED_BY_BUILTIN_C 1
|
#define INCLUDED_BY_BUILTIN_C 1
|
||||||
#include "mini_builtin.c"
|
#include "mini_builtin.c"
|
||||||
|
@ -65,7 +65,7 @@ PUREFUNC(static inline VALUE rb_vm_lvar(rb_execution_context_t *ec, int index));
|
|||||||
static inline VALUE
|
static inline VALUE
|
||||||
rb_vm_lvar(rb_execution_context_t *ec, int index)
|
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];
|
return ec->cfp->ep[index];
|
||||||
#else
|
#else
|
||||||
return rb_vm_lvar_exposed(ec, index);
|
return rb_vm_lvar_exposed(ec, index);
|
||||||
|
2
dir.c
2
dir.c
@ -216,7 +216,7 @@ typedef enum {
|
|||||||
#else
|
#else
|
||||||
#define FNM_SYSCASE 0
|
#define FNM_SYSCASE 0
|
||||||
#endif
|
#endif
|
||||||
#if _WIN32
|
#ifdef _WIN32
|
||||||
#define FNM_SHORTNAME 0x20
|
#define FNM_SHORTNAME 0x20
|
||||||
#else
|
#else
|
||||||
#define FNM_SHORTNAME 0
|
#define FNM_SHORTNAME 0
|
||||||
|
@ -144,7 +144,7 @@ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
|
|||||||
|
|
||||||
#define EC_REPUSH_TAG() (void)(_ec->tag = &_tag)
|
#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 prevents GCC 4.6--4.8 from emitting maybe-uninitialized warnings.
|
||||||
* This macro also prevents Clang from dumping core in EC_EXEC_TAG().
|
* This macro also prevents Clang from dumping core in EC_EXEC_TAG().
|
||||||
* (I confirmed Clang 4.0.1 and 5.0.0.)
|
* (I confirmed Clang 4.0.1 and 5.0.0.)
|
||||||
|
2
gc.c
2
gc.c
@ -830,7 +830,7 @@ enum {
|
|||||||
};
|
};
|
||||||
#define HEAP_PAGE_ALIGN (1 << HEAP_PAGE_ALIGN_LOG)
|
#define HEAP_PAGE_ALIGN (1 << HEAP_PAGE_ALIGN_LOG)
|
||||||
#define HEAP_PAGE_SIZE HEAP_PAGE_ALIGN
|
#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
|
# define USE_MMAP_ALIGNED_ALLOC 1
|
||||||
#else
|
#else
|
||||||
# define USE_MMAP_ALIGNED_ALLOC 0
|
# define USE_MMAP_ALIGNED_ALLOC 0
|
||||||
|
2
hash.c
2
hash.c
@ -800,7 +800,7 @@ ar_force_convert_table(VALUE hash, const char *file, int line)
|
|||||||
if (RHASH_AR_TABLE(hash)) {
|
if (RHASH_AR_TABLE(hash)) {
|
||||||
unsigned i, bound = RHASH_AR_TABLE_BOUND(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);
|
rb_obj_info_dump(hash);
|
||||||
fprintf(stderr, "force_convert: %s:%d\n", file, line);
|
fprintf(stderr, "force_convert: %s:%d\n", file, line);
|
||||||
RB_DEBUG_COUNTER_INC(obj_hash_force_convert);
|
RB_DEBUG_COUNTER_INC(obj_hash_force_convert);
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Enables #RBIMPL_ATTR_CONST if and only if. ! #RUBY_DEBUG. */
|
/** 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()
|
# define RBIMPL_ATTR_CONST_UNLESS_DEBUG() RBIMPL_ATTR_CONST()
|
||||||
#else
|
#else
|
||||||
# define RBIMPL_ATTR_CONST_UNLESS_DEBUG() /* void */
|
# define RBIMPL_ATTR_CONST_UNLESS_DEBUG() /* void */
|
||||||
|
@ -671,7 +671,7 @@ extract_item_member(const uint8_t *ptr, const rb_memory_view_item_component_t *m
|
|||||||
return LL2NUM(val.ll);
|
return LL2NUM(val.ll);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if SIZEOF_INT64_t == SIZEOF_LONG
|
#if SIZEOF_INT64_T == SIZEOF_LONG
|
||||||
return LONG2NUM(val.i64);
|
return LONG2NUM(val.i64);
|
||||||
#else
|
#else
|
||||||
return LL2NUM(val.i64);
|
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);
|
return ULL2NUM(val.ull);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if SIZEOF_UINT64_t == SIZEOF_LONG
|
#if SIZEOF_UINT64_T == SIZEOF_LONG
|
||||||
return ULONG2NUM(val.u64);
|
return ULONG2NUM(val.u64);
|
||||||
#else
|
#else
|
||||||
return ULL2NUM(val.u64);
|
return ULL2NUM(val.u64);
|
||||||
|
@ -261,7 +261,7 @@ static inline void
|
|||||||
rb_ractor_set_current_ec(rb_ractor_t *cr, rb_execution_context_t *ec)
|
rb_ractor_set_current_ec(rb_ractor_t *cr, rb_execution_context_t *ec)
|
||||||
{
|
{
|
||||||
#ifdef RB_THREAD_LOCAL_SPECIFIER
|
#ifdef RB_THREAD_LOCAL_SPECIFIER
|
||||||
#if __APPLE__
|
#ifdef __APPLE__
|
||||||
rb_current_ec_set(ec);
|
rb_current_ec_set(ec);
|
||||||
#else
|
#else
|
||||||
ruby_current_ec = ec;
|
ruby_current_ec = ec;
|
||||||
|
2
ruby.c
2
ruby.c
@ -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_name = rb_str_new_cstr(opt->script);
|
||||||
opt->script = RSTRING_PTR(opt->script_name);
|
opt->script = RSTRING_PTR(opt->script_name);
|
||||||
|
|
||||||
#if _WIN32
|
#ifdef _WIN32
|
||||||
translit_char_bin(RSTRING_PTR(opt->script_name), '\\', '/');
|
translit_char_bin(RSTRING_PTR(opt->script_name), '\\', '/');
|
||||||
#elif defined DOSISH
|
#elif defined DOSISH
|
||||||
translit_char(RSTRING_PTR(opt->script_name), '\\', '/');
|
translit_char(RSTRING_PTR(opt->script_name), '\\', '/');
|
||||||
|
@ -43,7 +43,7 @@ Init_sizeof(void)
|
|||||||
% next
|
% next
|
||||||
% end
|
% end
|
||||||
% cond = conditions[type]
|
% 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 %>);
|
DEFINE(<%= type %>, <%= type.tr_cpp %>);
|
||||||
#endif
|
#endif
|
||||||
% end
|
% end
|
||||||
|
@ -100,7 +100,7 @@ native_tls_set(native_tls_key_t key, void *ptr)
|
|||||||
|
|
||||||
RUBY_SYMBOL_EXPORT_BEGIN
|
RUBY_SYMBOL_EXPORT_BEGIN
|
||||||
#ifdef RB_THREAD_LOCAL_SPECIFIER
|
#ifdef RB_THREAD_LOCAL_SPECIFIER
|
||||||
#if __APPLE__
|
#ifdef __APPLE__
|
||||||
// on Darwin, TLS can not be accessed across .so
|
// on Darwin, TLS can not be accessed across .so
|
||||||
struct rb_execution_context_struct *rb_current_ec();
|
struct rb_execution_context_struct *rb_current_ec();
|
||||||
void rb_current_ec_set(struct rb_execution_context_struct *);
|
void rb_current_ec_set(struct rb_execution_context_struct *);
|
||||||
|
@ -343,7 +343,7 @@ def mk_builtin_header file
|
|||||||
f.puts
|
f.puts
|
||||||
f.puts " // arity_check"
|
f.puts " // arity_check"
|
||||||
f.puts "COMPILER_WARNING_PUSH"
|
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 "COMPILER_WARNING_ERROR(-Wincompatible-pointer-types)"
|
||||||
f.puts "#endif"
|
f.puts "#endif"
|
||||||
bs.each{|func, (argc, cfunc_name)|
|
bs.each{|func, (argc, cfunc_name)|
|
||||||
|
2
vm.c
2
vm.c
@ -3262,7 +3262,7 @@ static VALUE
|
|||||||
nsdr(VALUE self)
|
nsdr(VALUE self)
|
||||||
{
|
{
|
||||||
VALUE ary = rb_ary_new();
|
VALUE ary = rb_ary_new();
|
||||||
#if HAVE_BACKTRACE
|
#ifdef HAVE_BACKTRACE
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#define MAX_NATIVE_TRACE 1024
|
#define MAX_NATIVE_TRACE 1024
|
||||||
static void *trace[MAX_NATIVE_TRACE];
|
static void *trace[MAX_NATIVE_TRACE];
|
||||||
|
@ -670,7 +670,7 @@ typedef struct rb_vm_struct {
|
|||||||
#endif
|
#endif
|
||||||
const struct rb_callcache *global_cc_cache_table[VM_GLOBAL_CC_CACHE_TABLE_SIZE]; // vm_eval.c
|
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;
|
uint32_t clock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -870,7 +870,7 @@ struct rb_execution_context_struct {
|
|||||||
/* interrupt flags */
|
/* interrupt flags */
|
||||||
rb_atomic_t interrupt_flag;
|
rb_atomic_t interrupt_flag;
|
||||||
rb_atomic_t interrupt_mask; /* size should match 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;
|
uint32_t checked_clock;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1804,7 +1804,7 @@ static inline rb_execution_context_t *
|
|||||||
rb_current_execution_context(void)
|
rb_current_execution_context(void)
|
||||||
{
|
{
|
||||||
#ifdef RB_THREAD_LOCAL_SPECIFIER
|
#ifdef RB_THREAD_LOCAL_SPECIFIER
|
||||||
#if __APPLE__
|
#ifdef __APPLE__
|
||||||
rb_execution_context_t *ec = rb_current_ec();
|
rb_execution_context_t *ec = rb_current_ec();
|
||||||
#else
|
#else
|
||||||
rb_execution_context_t *ec = ruby_current_ec;
|
rb_execution_context_t *ec = ruby_current_ec;
|
||||||
@ -1891,7 +1891,7 @@ enum {
|
|||||||
static inline bool
|
static inline bool
|
||||||
RUBY_VM_INTERRUPTED_ANY(rb_execution_context_t *ec)
|
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;
|
uint32_t current_clock = rb_ec_vm_ptr(ec)->clock;
|
||||||
|
|
||||||
if (current_clock != ec->checked_clock) {
|
if (current_clock != ec->checked_clock) {
|
||||||
|
@ -104,6 +104,8 @@ vm_exec_core(rb_execution_context_t *ec, VALUE initial)
|
|||||||
#else
|
#else
|
||||||
register rb_control_frame_t *reg_cfp;
|
register rb_control_frame_t *reg_cfp;
|
||||||
const VALUE *reg_pc;
|
const VALUE *reg_pc;
|
||||||
|
#define USE_MACHINE_REGS 0
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_MACHINE_REGS
|
#if USE_MACHINE_REGS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user