1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/include/ruby/internal
Jeremy Evans 346301e232 Add rb_category_warn{,ing} for warning messages with categories
This adds the following C-API functions that can be used to emit
warnings with categories included:

```c
void rb_category_warn(const char *, const char*, ...)
void rb_category_warning(const char*, const char*, ...)
```

Internally in error.c, there is an rb_warn_category function
that will call Warning.warn with the string and the category
keyword if it doesn't have an arity of 1, and will call
Warning.warn with just the string if it has an arity of 1.
This refactors the rb_warn_deprecated{,_to_remove} functions
to use rb_warn_category.

This makes Kernel#warn accept a category keyword and pass it
to Warning.warn, so that Ruby methods can more easily emit
warnings with categories.  rb_warn_category makes sure that
the passed category is a already defined category symbol
before calling Warning.warn.

The only currently defined warning category is :deprecated,
since that is what is already used.  More categories can be
added in later commits.
2020-09-28 08:38:06 -07:00
..
arithmetic Add RB_ prefix for size_t to number conversion. 2020-09-06 15:37:54 +12:00
attr sync NDEBUG, RUBY_DEBUG, and RUBY_NDEBUG (#3327) 2020-08-07 14:01:13 +09:00
compiler_is
core ROBJECT_IV_INDEX_TBL: convert into an inline function 2020-08-19 14:30:57 +09:00
has RBIMPL_HAS_CPP_ATTRIBUTE: handle SunPro 2020-08-21 11:04:54 +09:00
intern Removed rb_find_file_ext_safe and rb_find_file_safe 2020-09-23 09:09:36 +09:00
anyargs.h
arithmetic.h
assume.h Revert "RBIMPL_UNREACHABLE_RETURN: evaluate the argument" 2020-06-29 12:33:17 +09:00
cast.h
compiler_is.h
compiler_since.h
config.h Fix a typo [ci skip] 2020-08-29 12:31:05 +09:00
constant_p.h
core.h
ctype.h
dllexport.h
dosish.h
error.h Add rb_category_warn{,ing} for warning messages with categories 2020-09-28 08:38:06 -07:00
eval.h
event.h
fl_type.h should not check taint flag on rubyspec. 2020-09-25 12:52:53 +09:00
gc.h
glob.h
globals.h Use RUBY_DEBUG instead of NDEBUG 2020-05-26 03:21:14 +09:00
interpreter.h
iterator.h
memory.h ALLOCA_N: do not use RUBY_ALIGNOF 2020-09-25 11:38:33 +09:00
method.h
module.h
newobj.h
rgengc.h Use RUBY_DEBUG instead of NDEBUG 2020-05-26 03:21:14 +09:00
scan_args.h Added UNREACHABLE_RETURN 2020-05-21 13:31:36 +09:00
special_consts.h
static_assert.h
stdalign.h RBIMPL_ALIGNAS: reorder #ifdef blocks 2020-09-26 00:30:36 +09:00
stdbool.h
symbol.h
token_paste.h
value.h
value_type.h Use RUBY_DEBUG instead of NDEBUG 2020-05-26 03:21:14 +09:00
variable.h
warning_push.h
xmalloc.h