mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Introduce "COLDFUNC" function attribute.
* include/ruby/defines.h: introduce "COLDFUNC" function attribute on several compilers for called unlikely functions. Apply to rb_memerror, rb_warn and rb_bug. A patch form methodmissing <lourens@bearmetal.eu>. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
756914e57e
commit
eb79191f16
3 changed files with 13 additions and 3 deletions
|
@ -89,6 +89,16 @@ extern "C" {
|
|||
#define RB_UNLIKELY(x) (x)
|
||||
#endif /* __GNUC__ >= 3 */
|
||||
|
||||
/*
|
||||
cold attribute for code layout improvements
|
||||
RUBY_FUNC_ATTRIBUTE not used because MSVC does not like nested func macros
|
||||
*/
|
||||
#if defined(__clang__) || GCC_VERSION_SINCE(4, 3, 0)
|
||||
#define COLDFUNC __attribute__((cold))
|
||||
#else
|
||||
#define COLDFUNC
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined __MINGW_PRINTF_FORMAT
|
||||
#define PRINTF_ARGS(decl, string_index, first_to_check) \
|
||||
|
|
|
@ -479,7 +479,7 @@ VALUE rb_file_directory_p(VALUE,VALUE);
|
|||
VALUE rb_str_encode_ospath(VALUE);
|
||||
int rb_is_absolute_path(const char *);
|
||||
/* gc.c */
|
||||
NORETURN(void rb_memerror(void));
|
||||
COLDFUNC NORETURN(void rb_memerror(void));
|
||||
PUREFUNC(int rb_during_gc(void));
|
||||
void rb_gc_mark_locations(const VALUE*, const VALUE*);
|
||||
void rb_mark_tbl(struct st_table*);
|
||||
|
|
|
@ -1901,7 +1901,7 @@ enum rb_io_wait_readwrite {RB_IO_WAIT_READABLE, RB_IO_WAIT_WRITABLE};
|
|||
|
||||
PRINTF_ARGS(NORETURN(void rb_raise(VALUE, const char*, ...)), 2, 3);
|
||||
PRINTF_ARGS(NORETURN(void rb_fatal(const char*, ...)), 1, 2);
|
||||
PRINTF_ARGS(NORETURN(void rb_bug(const char*, ...)), 1, 2);
|
||||
COLDFUNC PRINTF_ARGS(NORETURN(void rb_bug(const char*, ...)), 1, 2);
|
||||
NORETURN(void rb_bug_errno(const char*, int));
|
||||
NORETURN(void rb_sys_fail(const char*));
|
||||
NORETURN(void rb_sys_fail_str(VALUE));
|
||||
|
@ -1925,7 +1925,7 @@ PRINTF_ARGS(void rb_warning(const char*, ...), 1, 2);
|
|||
PRINTF_ARGS(void rb_compile_warning(const char *, int, const char*, ...), 3, 4);
|
||||
PRINTF_ARGS(void rb_sys_warning(const char*, ...), 1, 2);
|
||||
/* reports always */
|
||||
PRINTF_ARGS(void rb_warn(const char*, ...), 1, 2);
|
||||
COLDFUNC PRINTF_ARGS(void rb_warn(const char*, ...), 1, 2);
|
||||
PRINTF_ARGS(void rb_compile_warn(const char *, int, const char*, ...), 3, 4);
|
||||
|
||||
#define RUBY_BLOCK_CALL_FUNC_TAKES_BLOCKARG 1
|
||||
|
|
Loading…
Reference in a new issue