Ruby: include/ruby/internal/error.h Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

error.h
Go to the documentation of this file.
1#ifndef RBIMPL_ERROR_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_ERROR_H
23#include "ruby/internal/dllexport.h"
24#include "ruby/internal/value.h"
25#include "ruby/backward/2/attributes.h"
26
27 RBIMPL_SYMBOL_EXPORT_BEGIN()
28
29 VALUE rb_errinfo(void);
30void rb_set_errinfo(VALUE);
31
32typedef enum {
33 RB_WARN_CATEGORY_NONE,
34 RB_WARN_CATEGORY_DEPRECATED,
35 RB_WARN_CATEGORY_EXPERIMENTAL,
36 RB_WARN_CATEGORY_ALL_BITS = 0x6 /* no RB_WARN_CATEGORY_NONE bit */
37} rb_warning_category_t;
38
39/* for rb_readwrite_sys_fail first argument */
40 enum rb_io_wait_readwrite {RB_IO_WAIT_READABLE, RB_IO_WAIT_WRITABLE};
41#define RB_IO_WAIT_READABLE RB_IO_WAIT_READABLE
42#define RB_IO_WAIT_WRITABLE RB_IO_WAIT_WRITABLE
43
44 PRINTF_ARGS(NORETURN(void rb_raise(VALUE, const char*, ...)), 2, 3);
45 PRINTF_ARGS(NORETURN(void rb_fatal(const char*, ...)), 1, 2);
46 COLDFUNC PRINTF_ARGS(NORETURN(void rb_bug(const char*, ...)), 1, 2);
47 NORETURN(void rb_bug_errno(const char*, int));
48 NORETURN(void rb_sys_fail(const char*));
49 NORETURN(void rb_sys_fail_str(VALUE));
50 NORETURN(void rb_mod_sys_fail(VALUE, const char*));
51 NORETURN(void rb_mod_sys_fail_str(VALUE, VALUE));
52 NORETURN(void rb_readwrite_sys_fail(enum rb_io_wait_readwrite, const char*));
53 NORETURN(void rb_iter_break(void));
54 NORETURN(void rb_iter_break_value(VALUE));
55 NORETURN(void rb_exit(int));
56 NORETURN(void rb_notimplement(void));
57 VALUE rb_syserr_new(int, const char *);
58 VALUE rb_syserr_new_str(int n, VALUE arg);
59 NORETURN(void rb_syserr_fail(int, const char*));
60 NORETURN(void rb_syserr_fail_str(int, VALUE));
61 NORETURN(void rb_mod_syserr_fail(VALUE, int, const char*));
62 NORETURN(void rb_mod_syserr_fail_str(VALUE, int, VALUE));
63 NORETURN(void rb_readwrite_syserr_fail(enum rb_io_wait_readwrite, int, const char*));
64 NORETURN(void rb_unexpected_type(VALUE,int));
65
66 VALUE *rb_ruby_verbose_ptr(void);
67 VALUE *rb_ruby_debug_ptr(void);
68#define ruby_verbose (*rb_ruby_verbose_ptr())
69#define ruby_debug (*rb_ruby_debug_ptr())
70
71/* reports if `-W' specified */
72 PRINTF_ARGS(void rb_warning(const char*, ...), 1, 2);
73 PRINTF_ARGS(void rb_category_warning(rb_warning_category_t, const char*, ...), 2, 3);
74 PRINTF_ARGS(void rb_compile_warning(const char *, int, const char*, ...), 3, 4);
75 PRINTF_ARGS(void rb_category_compile_warn(rb_warning_category_t, const char *, int, const char*, ...), 4, 5);
76 PRINTF_ARGS(void rb_sys_warning(const char*, ...), 1, 2);
77/* reports always */
78 COLDFUNC PRINTF_ARGS(void rb_warn(const char*, ...), 1, 2);
79 COLDFUNC PRINTF_ARGS(void rb_category_warn(rb_warning_category_t, const char*, ...), 2, 3);
80 PRINTF_ARGS(void rb_compile_warn(const char *, int, const char*, ...), 3, 4);
81
82 RBIMPL_SYMBOL_EXPORT_END()
83
84#endif /* RBIMPL_ERROR_H */
attributes.h
Various attribute-related macros.
COLDFUNC
#define COLDFUNC
Definition: attributes.h:110
NORETURN
#define NORETURN(x)
Definition: attributes.h:152
PRINTF_ARGS
#define PRINTF_ARGS(decl, string_index, first_to_check)
Definition: attributes.h:112
rb_category_warn
#define rb_category_warn(category,...)
Definition: bigdecimal.h:163
dllexport.h
Tewaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:86
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:77
rb_notimplement
void rb_notimplement(void)
Definition: error.c:2960
rb_syserr_fail
void rb_syserr_fail(int, const char *)
Definition: error.c:3029
rb_raise
void rb_raise(VALUE, const char *,...)
Definition: error.c:2917
rb_mod_sys_fail_str
void rb_mod_sys_fail_str(VALUE, VALUE)
Definition: error.c:3095
rb_compile_warn
void rb_compile_warn(const char *, int, const char *,...)
Definition: error.c:351
rb_category_compile_warn
void rb_category_compile_warn(rb_warning_category_t, const char *, int, const char *,...)
Definition: error.c:380
rb_mod_sys_fail
void rb_mod_sys_fail(VALUE, const char *)
Definition: error.c:3087
rb_bug
void rb_bug(const char *,...)
Definition: error.c:768
rb_sys_warning
void rb_sys_warning(const char *,...)
Definition: error.c:3173
rb_syserr_new
VALUE rb_syserr_new(int, const char *)
Definition: error.c:3015
rb_syserr_new_str
VALUE rb_syserr_new_str(int n, VALUE arg)
Definition: error.c:3023
rb_set_errinfo
void rb_set_errinfo(VALUE)
Sets the current exception ($!) to the given value.
Definition: eval.c:1925
rb_syserr_fail_str
void rb_syserr_fail_str(int, VALUE)
Definition: error.c:3035
rb_sys_fail_str
void rb_sys_fail_str(VALUE)
Definition: error.c:3047
rb_fatal
void rb_fatal(const char *,...)
Definition: error.c:2968
rb_unexpected_type
void rb_unexpected_type(VALUE, int)
Definition: error.c:987
rb_category_warning
void rb_category_warning(rb_warning_category_t, const char *,...)
Definition: error.c:450
rb_bug_errno
void rb_bug_errno(const char *, int)
Definition: error.c:796
rb_warn
void rb_warn(const char *,...)
Definition: error.c:408
rb_compile_warning
void rb_compile_warning(const char *, int, const char *,...)
Definition: error.c:366
rb_mod_syserr_fail
void rb_mod_syserr_fail(VALUE, int, const char *)
Definition: error.c:3103
rb_errinfo
VALUE rb_errinfo(void)
The current exception in the current thread.
Definition: eval.c:1911
rb_sys_fail
void rb_sys_fail(const char *)
Definition: error.c:3041
rb_mod_syserr_fail_str
void rb_mod_syserr_fail_str(VALUE, int, VALUE)
Definition: error.c:3111
rb_warning
void rb_warning(const char *,...)
Definition: error.c:439
rb_warning_category_t
rb_warning_category_t
Definition: error.h:32
RB_WARN_CATEGORY_DEPRECATED
@ RB_WARN_CATEGORY_DEPRECATED
Definition: error.h:34
RB_WARN_CATEGORY_ALL_BITS
@ RB_WARN_CATEGORY_ALL_BITS
Definition: error.h:36
RB_WARN_CATEGORY_EXPERIMENTAL
@ RB_WARN_CATEGORY_EXPERIMENTAL
Definition: error.h:35
RB_WARN_CATEGORY_NONE
@ RB_WARN_CATEGORY_NONE
Definition: error.h:33
rb_readwrite_syserr_fail
void rb_readwrite_syserr_fail(enum rb_io_wait_readwrite, int, const char *)
Definition: io.c:13122
rb_iter_break
void rb_iter_break(void)
Definition: vm.c:1786
rb_readwrite_sys_fail
void rb_readwrite_sys_fail(enum rb_io_wait_readwrite, const char *)
Definition: io.c:13116
rb_exit
void rb_exit(int)
Definition: process.c:4416
rb_io_wait_readwrite
rb_io_wait_readwrite
Definition: error.h:40
rb_ruby_verbose_ptr
VALUE * rb_ruby_verbose_ptr(void)
Definition: vm.c:3768
rb_iter_break_value
void rb_iter_break_value(VALUE)
Definition: vm.c:1792
RB_IO_WAIT_WRITABLE
#define RB_IO_WAIT_WRITABLE
Definition: error.h:42
rb_ruby_debug_ptr
VALUE * rb_ruby_debug_ptr(void)
Definition: vm.c:3775
RB_IO_WAIT_READABLE
#define RB_IO_WAIT_READABLE
Definition: error.h:41
value.h
Defines VALUE and ID.
VALUE
unsigned long VALUE
Definition: value.h:38