Граф коммитов

7 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada d5ffa4e9a4
[DOC] mentioned category option 2020-12-08 22:13:04 +09:00
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
Nobuyoshi Nakada 63aadc237f [Feature #16254] Use `Primitive.func` style 2020-06-19 18:46:55 +09:00
Nobuyoshi Nakada d863f4bccd [Feature #16254] Use `__builtin.func` style 2020-06-19 18:46:55 +09:00
Kazuhiro NISHIYAMA 749915e940
Fix a typo [ci skip] 2020-01-02 12:12:05 +09:00
Nobuyoshi Nakada a2e8712349
Fix visibility as module_function 2019-12-13 20:51:58 +09:00
Nobuyoshi Nakada 0b5268afbc Moved Kernel#warn to warning.rb 2019-12-13 20:47:07 +09:00