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

* configure.in: check function attirbute const and pure,

and define CONSTFUNC and PUREFUNC if available.
  Note that I don't add those options as default because
  it still shows many false-positive (it seems not to consider
  longjmp).

* vm_eval.c (stack_check): get rb_thread_t* as an argument
  to avoid duplicate call of GET_THREAD().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2016-05-08 17:44:51 +00:00
parent 94419c16dc
commit 28f5e12c24
19 changed files with 99 additions and 80 deletions

View file

@ -1,3 +1,14 @@
Mon May 9 02:39:16 2016 NARUSE, Yui <naruse@ruby-lang.org>
* configure.in: check function attirbute const and pure,
and define CONSTFUNC and PUREFUNC if available.
Note that I don't add those options as default because
it still shows many false-positive (it seems not to consider
longjmp).
* vm_eval.c (stack_check): get rb_thread_t* as an argument
to avoid duplicate call of GET_THREAD().
Sun May 8 21:01:14 2016 NARUSE, Yui <naruse@ruby-lang.org>
* ext/openssl/extconf.rb: assume it doesn't have SSLv2 related

View file

@ -1800,6 +1800,8 @@ AC_DEFUN([RUBY_TYPE_ATTRIBUTE], [dnl
])
])
RUBY_FUNC_ATTRIBUTE(const, CONSTFUNC)
RUBY_FUNC_ATTRIBUTE(pure, PUREFUNC)
RUBY_FUNC_ATTRIBUTE(noreturn, NORETURN)
RUBY_FUNC_ATTRIBUTE(deprecated, DEPRECATED)
RUBY_FUNC_ATTRIBUTE(deprecated("by "@%:@n), DEPRECATED_BY(n,x), rb_cv_func_deprecated_by)

View file

@ -278,7 +278,6 @@ rb_cref_t *rb_vm_cref_replace_with_duplicated_cref(void);
VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename);
void rb_vm_set_progname(VALUE filename);
void rb_thread_terminate_all(void);
VALUE rb_vm_top_self();
VALUE rb_vm_cbase(void);
#ifndef CharNext /* defined as CharNext[AW] on Windows. */

2
gc.c
View file

@ -2033,6 +2033,7 @@ rb_objspace_data_type_name(VALUE obj)
}
}
PUREFUNC(static inline int is_pointer_to_heap(rb_objspace_t *objspace, void *ptr);)
static inline int
is_pointer_to_heap(rb_objspace_t *objspace, void *ptr)
{
@ -2900,6 +2901,7 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
ATOMIC_SET(finalizing, 0);
}
PUREFUNC(static inline int is_id_value(rb_objspace_t *objspace, VALUE ptr));
static inline int
is_id_value(rb_objspace_t *objspace, VALUE ptr)
{

View file

@ -113,8 +113,8 @@ int rb_char_to_option_kcode(int c, int *option, int *kcode);
int rb_enc_replicate(const char *, rb_encoding *);
int rb_define_dummy_encoding(const char *);
int rb_enc_dummy_p(rb_encoding *enc);
int rb_enc_to_index(rb_encoding *enc);
PUREFUNC(int rb_enc_dummy_p(rb_encoding *enc));
PUREFUNC(int rb_enc_to_index(rb_encoding *enc));
int rb_enc_get_index(VALUE obj);
void rb_enc_set_index(VALUE obj, int encindex);
int rb_enc_find_index(const char *name);
@ -240,8 +240,8 @@ rb_enc_asciicompat_inline(rb_encoding *enc)
#define rb_enc_asciicompat(enc) rb_enc_asciicompat_inline(enc)
int rb_enc_casefold(char *to, const char *p, const char *e, rb_encoding *enc);
int rb_enc_toupper(int c, rb_encoding *enc);
int rb_enc_tolower(int c, rb_encoding *enc);
CONSTFUNC(int rb_enc_toupper(int c, rb_encoding *enc));
CONSTFUNC(int rb_enc_tolower(int c, rb_encoding *enc));
ID rb_intern3(const char*, long, rb_encoding*);
ID rb_interned_id_p(const char *, long, rb_encoding *);
int rb_enc_symname_p(const char*, rb_encoding*);
@ -251,7 +251,7 @@ long rb_str_coderange_scan_restartable(const char*, const char*, rb_encoding*, i
int rb_enc_str_asciionly_p(VALUE);
#define rb_enc_str_asciicompat_p(str) rb_enc_asciicompat(rb_enc_get(str))
VALUE rb_enc_from_encoding(rb_encoding *enc);
int rb_enc_unicode_p(rb_encoding *enc);
PUREFUNC(int rb_enc_unicode_p(rb_encoding *enc));
rb_encoding *rb_ascii8bit_encoding(void);
rb_encoding *rb_utf8_encoding(void);
rb_encoding *rb_usascii_encoding(void);
@ -260,13 +260,13 @@ rb_encoding *rb_filesystem_encoding(void);
rb_encoding *rb_default_external_encoding(void);
rb_encoding *rb_default_internal_encoding(void);
#ifndef rb_ascii8bit_encindex
int rb_ascii8bit_encindex(void);
CONSTFUNC(int rb_ascii8bit_encindex(void));
#endif
#ifndef rb_utf8_encindex
int rb_utf8_encindex(void);
CONSTFUNC(int rb_utf8_encindex(void));
#endif
#ifndef rb_usascii_encindex
int rb_usascii_encindex(void);
CONSTFUNC(int rb_usascii_encindex(void));
#endif
int rb_locale_encindex(void);
int rb_filesystem_encindex(void);

View file

@ -254,9 +254,9 @@ NORETURN(DEPRECATED(PRINTF_ARGS(void rb_compile_error_with_enc(const char*, int,
NORETURN(DEPRECATED(PRINTF_ARGS(void rb_compile_error_append(const char*, ...), 1, 2)));
NORETURN(void rb_error_frozen(const char*));
NORETURN(void rb_error_frozen_object(VALUE));
void rb_error_untrusted(VALUE);
CONSTFUNC(void rb_error_untrusted(VALUE));
void rb_check_frozen(VALUE);
void rb_check_trusted(VALUE);
CONSTFUNC(void rb_check_trusted(VALUE));
#define rb_check_frozen_internal(obj) do { \
VALUE frozen_obj = (obj); \
if (OBJ_FROZEN(frozen_obj)) { \
@ -293,7 +293,6 @@ const char *rb_sourcefile(void);
VALUE rb_check_funcall(VALUE, ID, int, const VALUE*);
NORETURN(void rb_error_arity(int, int, int));
#define rb_check_arity rb_check_arity /* for ifdef */
static inline int
rb_check_arity(int argc, int min, int max)
{
@ -301,6 +300,7 @@ rb_check_arity(int argc, int min, int max)
rb_error_arity(argc, min, max);
return argc;
}
#define rb_check_arity rb_check_arity /* for ifdef */
#if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
typedef struct {
@ -482,7 +482,7 @@ VALUE rb_str_encode_ospath(VALUE);
int rb_is_absolute_path(const char *);
/* gc.c */
NORETURN(void rb_memerror(void));
int rb_during_gc(void);
PUREFUNC(int rb_during_gc(void););
void rb_gc_mark_locations(const VALUE*, const VALUE*);
void rb_mark_tbl(struct st_table*);
void rb_mark_set(struct st_table*);
@ -580,7 +580,7 @@ VALUE rb_num_coerce_relop(VALUE, VALUE, ID);
VALUE rb_num_coerce_bit(VALUE, VALUE, ID);
VALUE rb_num2fix(VALUE);
VALUE rb_fix2str(VALUE, int);
VALUE rb_dbl_cmp(double, double);
CONSTFUNC(VALUE rb_dbl_cmp(double, double));
/* object.c */
int rb_eql(VALUE, VALUE);
VALUE rb_any_to_s(VALUE);
@ -592,17 +592,17 @@ VALUE rb_obj_clone(VALUE);
VALUE rb_obj_dup(VALUE);
VALUE rb_obj_init_copy(VALUE,VALUE);
VALUE rb_obj_taint(VALUE);
VALUE rb_obj_tainted(VALUE);
PUREFUNC(VALUE rb_obj_tainted(VALUE));
VALUE rb_obj_untaint(VALUE);
VALUE rb_obj_untrust(VALUE);
VALUE rb_obj_untrusted(VALUE);
PUREFUNC(VALUE rb_obj_untrusted(VALUE));
VALUE rb_obj_trust(VALUE);
VALUE rb_obj_freeze(VALUE);
VALUE rb_obj_frozen_p(VALUE);
PUREFUNC(VALUE rb_obj_frozen_p(VALUE));
VALUE rb_obj_id(VALUE);
VALUE rb_obj_class(VALUE);
VALUE rb_class_real(VALUE);
VALUE rb_class_inherited_p(VALUE, VALUE);
PUREFUNC(VALUE rb_class_real(VALUE));
PUREFUNC(VALUE rb_class_inherited_p(VALUE, VALUE));
VALUE rb_class_superclass(VALUE);
VALUE rb_class_get_superclass(VALUE);
VALUE rb_convert_type(VALUE,int,const char*,const char*);
@ -621,13 +621,13 @@ double rb_cstr_to_dbl(const char*, int);
double rb_str_to_dbl(VALUE, int);
/* parse.y */
ID rb_id_attrset(ID);
int rb_is_const_id(ID);
int rb_is_global_id(ID);
int rb_is_instance_id(ID);
int rb_is_attrset_id(ID);
int rb_is_class_id(ID);
int rb_is_local_id(ID);
int rb_is_junk_id(ID);
CONSTFUNC(int rb_is_const_id(ID));
CONSTFUNC(int rb_is_global_id(ID));
CONSTFUNC(int rb_is_instance_id(ID));
CONSTFUNC(int rb_is_attrset_id(ID));
CONSTFUNC(int rb_is_class_id(ID));
CONSTFUNC(int rb_is_local_id(ID));
CONSTFUNC(int rb_is_junk_id(ID));
int rb_symname_p(const char*);
int rb_sym_interned_p(VALUE);
VALUE rb_backref_get(void);
@ -784,7 +784,7 @@ VALUE rb_sym_to_s(VALUE);
long rb_str_strlen(VALUE);
VALUE rb_str_length(VALUE);
long rb_str_offset(VALUE, long);
size_t rb_str_capacity(VALUE);
PUREFUNC(size_t rb_str_capacity(VALUE););
VALUE rb_str_ellipsize(VALUE, long);
VALUE rb_str_scrub(VALUE, VALUE);
/* symbol.c */

View file

@ -130,7 +130,7 @@ FILE *rb_io_stdio_file(rb_io_t *fptr);
FILE *rb_fdopen(int, const char*);
int rb_io_modestr_fmode(const char *modestr);
int rb_io_modestr_oflags(const char *modestr);
int rb_io_oflags_fmode(int oflags);
CONSTFUNC(int rb_io_oflags_fmode(int oflags));
void rb_io_check_writable(rb_io_t*);
void rb_io_check_readable(rb_io_t*);
void rb_io_check_char_readable(rb_io_t *fptr);

View file

@ -342,10 +342,8 @@ ONIG_EXTERN
int onigenc_init P_((void));
ONIG_EXTERN
int onigenc_set_default_encoding P_((OnigEncoding enc));
ONIG_EXTERN
OnigEncoding onigenc_get_default_encoding P_((void));
ONIG_EXTERN
void onigenc_set_default_caseconv_table P_((const OnigUChar* table));
PUREFUNC(ONIG_EXTERN OnigEncoding onigenc_get_default_encoding P_((void)));
PUREFUNC(ONIG_EXTERN void onigenc_set_default_caseconv_table P_((const OnigUChar* table)));
ONIG_EXTERN
OnigUChar* onigenc_get_right_adjust_char_head_with_prev P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, const OnigUChar* end, const OnigUChar** prev));
ONIG_EXTERN

View file

@ -624,7 +624,7 @@ int rb_safe_level(void);
void rb_set_safe_level(int);
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
int ruby_safe_level_2_error(void) __attribute__((error("$SAFE=2 to 4 are obsolete")));
int ruby_safe_level_2_warning(void) __attribute__((warning("$SAFE=2 to 4 are obsolete")));
int ruby_safe_level_2_warning(void) __attribute__((const,warning("$SAFE=2 to 4 are obsolete")));
# ifdef RUBY_EXPORT
# define ruby_safe_level_2_warning() ruby_safe_level_2_error()
# endif
@ -650,7 +650,7 @@ int ruby_safe_level_2_warning(void) __attribute__((warning("$SAFE=2 to 4 are obs
#define rb_set_safe_level(level) rb_set_safe_level(RUBY_SAFE_LEVEL_CHECK(level, error))
#endif
void rb_set_safe_level_force(int);
void rb_secure_update(VALUE);
CONSTFUNC(void rb_secure_update(VALUE));
NORETURN(void rb_insecure_operation(void));
VALUE rb_errinfo(void);
@ -952,7 +952,7 @@ enum {
RMODULE_ENUM_END
};
double rb_float_value(VALUE);
PUREFUNC(double rb_float_value(VALUE));
VALUE rb_float_new(double);
VALUE rb_float_new_in_heap(double);

View file

@ -131,18 +131,18 @@ void st_free_table(st_table *);
void st_cleanup_safe(st_table *, st_data_t);
void st_clear(st_table *);
st_table *st_copy(st_table *);
int st_numcmp(st_data_t, st_data_t);
st_index_t st_numhash(st_data_t);
int st_locale_insensitive_strcasecmp(const char *s1, const char *s2);
int st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n);
CONSTFUNC(int st_numcmp(st_data_t, st_data_t));
CONSTFUNC(st_index_t st_numhash(st_data_t));
PUREFUNC(int st_locale_insensitive_strcasecmp(const char *s1, const char *s2));
PUREFUNC(int st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n));
#define st_strcasecmp st_locale_insensitive_strcasecmp
#define st_strncasecmp st_locale_insensitive_strncasecmp
size_t st_memsize(const st_table *);
st_index_t st_hash(const void *ptr, size_t len, st_index_t h);
st_index_t st_hash_uint32(st_index_t h, uint32_t i);
st_index_t st_hash_uint(st_index_t h, st_index_t i);
st_index_t st_hash_end(st_index_t h);
st_index_t st_hash_start(st_index_t h);
PUREFUNC(size_t st_memsize(const st_table *));
PUREFUNC(st_index_t st_hash(const void *ptr, size_t len, st_index_t h));
CONSTFUNC(st_index_t st_hash_uint32(st_index_t h, uint32_t i));
CONSTFUNC(st_index_t st_hash_uint(st_index_t h, st_index_t i));
CONSTFUNC(st_index_t st_hash_end(st_index_t h));
CONSTFUNC(st_index_t st_hash_start(st_index_t h));
#define st_hash_start(h) ((st_index_t)(h))
RUBY_SYMBOL_EXPORT_END

View file

@ -2088,8 +2088,6 @@ opt_not
(VALUE recv)
(VALUE val)
{
extern VALUE rb_obj_not(VALUE obj);
vm_search_method(ci, cc, recv);
if (check_cfunc(cc->me, rb_obj_not)) {

View file

@ -892,7 +892,7 @@ VALUE rb_invcmp(VALUE, VALUE);
struct rb_block_struct;
int rb_dvar_defined(ID, const struct rb_block_struct *);
int rb_local_defined(ID, const struct rb_block_struct *);
const char * rb_insns_name(int i);
CONSTFUNC(const char * rb_insns_name(int i));
VALUE rb_insns_name_array(void);
/* complex.c */
@ -913,7 +913,7 @@ void Init_ext(void);
/* encoding.c */
ID rb_id_encoding(void);
void rb_gc_mark_encodings(void);
CONSTFUNC(void rb_gc_mark_encodings(void));
rb_encoding *rb_enc_get_from_index(int index);
rb_encoding *rb_enc_check_str(VALUE str1, VALUE str2);
int rb_encdb_replicate(const char *alias, const char *orig);
@ -923,7 +923,7 @@ void rb_encdb_declare(const char *name);
void rb_enc_set_base(const char *name, const char *orig);
int rb_enc_set_dummy(int index);
void rb_encdb_set_unicode(int index);
int rb_data_is_encoding(VALUE obj);
PUREFUNC(int rb_data_is_encoding(VALUE obj));
/* enum.c */
VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
@ -1180,7 +1180,8 @@ rb_float_new_inline(double d)
/* object.c */
void rb_obj_copy_ivar(VALUE dest, VALUE obj);
VALUE rb_obj_equal(VALUE obj1, VALUE obj2);
CONSTFUNC(VALUE rb_obj_equal(VALUE obj1, VALUE obj2));
CONSTFUNC(VALUE rb_obj_not(VALUE obj));
VALUE rb_class_search_ancestor(VALUE klass, VALUE super);
NORETURN(void rb_undefined_alloc(VALUE klass));
double rb_num_to_dbl(VALUE val);
@ -1214,14 +1215,14 @@ int rb_is_attrset_name(VALUE name);
int rb_is_local_name(VALUE name);
int rb_is_method_name(VALUE name);
int rb_is_junk_name(VALUE name);
int rb_is_const_sym(VALUE sym);
int rb_is_class_sym(VALUE sym);
int rb_is_global_sym(VALUE sym);
int rb_is_instance_sym(VALUE sym);
int rb_is_attrset_sym(VALUE sym);
int rb_is_local_sym(VALUE sym);
int rb_is_method_sym(VALUE sym);
int rb_is_junk_sym(VALUE sym);
PUREFUNC(int rb_is_const_sym(VALUE sym));
PUREFUNC(int rb_is_class_sym(VALUE sym));
PUREFUNC(int rb_is_global_sym(VALUE sym));
PUREFUNC(int rb_is_instance_sym(VALUE sym));
PUREFUNC(int rb_is_attrset_sym(VALUE sym));
PUREFUNC(int rb_is_local_sym(VALUE sym));
PUREFUNC(int rb_is_method_sym(VALUE sym));
PUREFUNC(int rb_is_junk_sym(VALUE sym));
ID rb_make_internal_id(void);
void rb_gc_free_dsymbol(VALUE);
ID rb_id_attrget(ID id);
@ -1451,7 +1452,7 @@ VALUE rb_obj_is_thread(VALUE obj);
void rb_vm_mark(void *ptr);
void Init_BareVM(void);
void Init_vm_objects(void);
VALUE rb_vm_top_self(void);
PUREFUNC(VALUE rb_vm_top_self(void););
void rb_thread_recycle_stack_release(VALUE *);
void rb_vm_change_state(void);
void rb_vm_inc_const_missing_count(void);
@ -1465,6 +1466,8 @@ int rb_vm_add_root_module(ID id, VALUE module);
void rb_vm_check_redefinition_by_prepend(VALUE klass);
VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
VALUE ruby_vm_sysstack_error_copy(void);
PUREFUNC(st_table *rb_vm_fstring_table(void));
/* vm_dump.c */
void rb_print_backtrace(void);

View file

@ -6921,6 +6921,7 @@ typedef long timetick_int_t;
#define TIMETICK_INT2NUM(v) LONG2NUM(v)
#endif
CONSTFUNC(static timetick_int_t gcd_timetick_int(timetick_int_t, timetick_int_t));
static timetick_int_t
gcd_timetick_int(timetick_int_t a, timetick_int_t b)
{

View file

@ -129,30 +129,30 @@ ONIG_EXTERN int onigenc_ascii_apply_all_case_fold P_((OnigCaseFoldType flag, Oni
ONIG_EXTERN int onigenc_ascii_get_case_fold_codes_by_str P_((OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[], OnigEncoding enc));
ONIG_EXTERN int onigenc_apply_all_case_fold_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));
ONIG_EXTERN int onigenc_get_case_fold_codes_by_str_with_map P_((int map_size, const OnigPairCaseFoldCodes map[], int ess_tsett_flag, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));
ONIG_EXTERN int onigenc_not_support_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[], OnigEncoding enc));
ONIG_EXTERN int onigenc_is_mbc_newline_0x0a P_((const UChar* p, const UChar* end, OnigEncoding enc));
CONSTFUNC(ONIG_EXTERN int onigenc_not_support_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[], OnigEncoding enc)));
PUREFUNC(ONIG_EXTERN int onigenc_is_mbc_newline_0x0a P_((const UChar* p, const UChar* end, OnigEncoding enc)));
/* methods for single byte encoding */
ONIG_EXTERN int onigenc_ascii_mbc_case_fold P_((OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower, OnigEncoding enc));
ONIG_EXTERN int onigenc_single_byte_mbc_enc_len P_((const UChar* p, const UChar* e, OnigEncoding enc));
ONIG_EXTERN OnigCodePoint onigenc_single_byte_mbc_to_code P_((const UChar* p, const UChar* end, OnigEncoding enc));
ONIG_EXTERN int onigenc_single_byte_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
CONSTFUNC(ONIG_EXTERN int onigenc_single_byte_mbc_enc_len P_((const UChar* p, const UChar* e, OnigEncoding enc)));
PUREFUNC(ONIG_EXTERN OnigCodePoint onigenc_single_byte_mbc_to_code P_((const UChar* p, const UChar* end, OnigEncoding enc)));
CONSTFUNC(ONIG_EXTERN int onigenc_single_byte_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc)));
ONIG_EXTERN int onigenc_single_byte_code_to_mbc P_((OnigCodePoint code, UChar *buf, OnigEncoding enc));
ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s, const OnigUChar* end, OnigEncoding enc));
ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc));
ONIG_EXTERN int onigenc_ascii_is_code_ctype P_((OnigCodePoint code, unsigned int ctype, OnigEncoding enc));
CONSTFUNC(ONIG_EXTERN UChar* onigenc_single_byte_left_adjust_char_head P_((const UChar* start, const UChar* s, const OnigUChar* end, OnigEncoding enc)));
CONSTFUNC(ONIG_EXTERN int onigenc_always_true_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc)));
CONSTFUNC(ONIG_EXTERN int onigenc_always_false_is_allowed_reverse_match P_((const UChar* s, const UChar* end, OnigEncoding enc)));
CONSTFUNC(ONIG_EXTERN int onigenc_ascii_is_code_ctype P_((OnigCodePoint code, unsigned int ctype, OnigEncoding enc)));
/* methods for multi byte encoding */
ONIG_EXTERN OnigCodePoint onigenc_mbn_mbc_to_code P_((OnigEncoding enc, const UChar* p, const UChar* end));
ONIG_EXTERN int onigenc_mbn_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** p, const UChar* end, UChar* lower));
ONIG_EXTERN int onigenc_mb2_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
CONSTFUNC(ONIG_EXTERN int onigenc_mb2_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc)));
ONIG_EXTERN int onigenc_mb2_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
ONIG_EXTERN int onigenc_minimum_property_name_to_ctype P_((OnigEncoding enc, const UChar* p, const UChar* end));
ONIG_EXTERN int onigenc_unicode_property_name_to_ctype P_((OnigEncoding enc, const UChar* p, const UChar* end));
ONIG_EXTERN int onigenc_mb2_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
ONIG_EXTERN int onigenc_mb4_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc));
CONSTFUNC(ONIG_EXTERN int onigenc_mb4_code_to_mbclen P_((OnigCodePoint code, OnigEncoding enc)));
ONIG_EXTERN int onigenc_mb4_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
ONIG_EXTERN int onigenc_mb4_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));

1
st.c
View file

@ -1683,6 +1683,7 @@ st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n)
return 0;
}
PUREFUNC(static st_index_t strcasehash(st_data_t));
static st_index_t
strcasehash(st_data_t arg)
{

View file

@ -233,8 +233,6 @@ static int fstring_cmp(VALUE a, VALUE b);
static VALUE register_fstring(VALUE str);
st_table *rb_vm_fstring_table(void);
const struct st_hash_type rb_fstring_hash_type = {
fstring_cmp,
rb_str_hash,

3
vm.c
View file

@ -25,6 +25,7 @@
VALUE rb_str_concat_literals(size_t, const VALUE*);
PUREFUNC(static inline VALUE *VM_EP_LEP(VALUE *));
static inline VALUE *
VM_EP_LEP(VALUE *ep)
{
@ -60,6 +61,7 @@ rb_vm_ep_local_ep(VALUE *ep)
return VM_EP_LEP(ep);
}
PUREFUNC(static inline VALUE *VM_CF_LEP(const rb_control_frame_t * const cfp));
static inline VALUE *
VM_CF_LEP(const rb_control_frame_t * const cfp)
{
@ -72,6 +74,7 @@ VM_CF_PREV_EP(const rb_control_frame_t * const cfp)
return VM_EP_PREV_EP(cfp->ep);
}
PUREFUNC(static inline rb_block_t *VM_CF_BLOCK_PTR(const rb_control_frame_t * const cfp));
static inline rb_block_t *
VM_CF_BLOCK_PTR(const rb_control_frame_t * const cfp)
{

View file

@ -303,10 +303,8 @@ rb_current_receiver(void)
}
static inline void
stack_check(void)
stack_check(rb_thread_t *th)
{
rb_thread_t *th = GET_THREAD();
if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW) && ruby_stack_check()) {
rb_thread_raised_set(th, RAISED_STACKOVERFLOW);
rb_exc_raise(sysstack_error);
@ -342,7 +340,7 @@ rb_call0(VALUE recv, ID mid, int argc, const VALUE *argv,
if (call_status != MISSING_NONE) {
return method_missing(recv, mid, argc, argv, call_status);
}
stack_check();
stack_check(th);
return vm_call0(th, recv, mid, argc, argv, me);
}
@ -460,7 +458,7 @@ rb_check_funcall_default(VALUE recv, ID mid, int argc, const VALUE *argv, VALUE
return check_funcall_missing(th, klass, recv, mid, argc, argv,
respond, def);
}
stack_check();
stack_check(th);
return vm_call0(th, recv, mid, argc, argv, me);
}
@ -485,7 +483,7 @@ rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
(*hook)(ret != Qundef, recv, mid, argc, argv, arg);
return ret;
}
stack_check();
stack_check(th);
(*hook)(TRUE, recv, mid, argc, argv, arg);
return vm_call0(th, recv, mid, argc, argv, me);
}
@ -718,7 +716,7 @@ raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, VALUE obj,
rb_obj_class(argv[0]));
}
stack_check();
stack_check(th);
if (last_call_status & MISSING_PRIVATE) {
format = rb_fstring_cstr("private method `%s' called for %s%s%s");

View file

@ -374,6 +374,7 @@ vm_getspecial(rb_thread_t *th, VALUE *lep, rb_num_t key, rb_num_t type)
return val;
}
PUREFUNC(static rb_callable_method_entry_t *check_method_entry(VALUE obj, int can_be_svar));
static rb_callable_method_entry_t *
check_method_entry(VALUE obj, int can_be_svar)
{
@ -425,6 +426,9 @@ method_entry_cref(rb_callable_method_entry_t *me)
}
}
#if VM_CHECK_MODE == 0
PUREFUNC(static rb_cref_t *check_cref(VALUE, int));
#endif
static rb_cref_t *
check_cref(VALUE obj, int can_be_svar)
{
@ -1925,6 +1929,7 @@ find_refinement(VALUE refinements, VALUE klass)
return rb_hash_lookup(refinements, klass);
}
PUREFUNC(static rb_control_frame_t * current_method_entry(rb_thread_t *th, rb_control_frame_t *cfp));
static rb_control_frame_t *
current_method_entry(rb_thread_t *th, rb_control_frame_t *cfp)
{