diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2021-11-10 15:42:57 +1300 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2021-11-10 19:21:05 +1300 |
commit | 81d0ce7e97af74a2086e143f9e349ee519bd1c4d (patch) | |
tree | 873f5bed9e2805e2d820923311d945898c566008 /io_buffer.c | |
parent | 4b8903421828cb9d4de139180563ae8d8f04e1ab (diff) |
Mark IO::Buffer as experimental.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4621
Diffstat (limited to 'io_buffer.c')
-rw-r--r-- | io_buffer.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/io_buffer.c b/io_buffer.c index 3455713f8d..521d9d8ea9 100644 --- a/io_buffer.c +++ b/io_buffer.c @@ -11,6 +11,7 @@ #include "internal/string.h" #include "internal/bits.h" +#include "internal/error.h" VALUE rb_cIOBuffer; size_t RUBY_IO_BUFFER_PAGE_SIZE; @@ -121,8 +122,25 @@ static inline void io_buffer_unmap(void* base, size_t size) #endif } +static void io_buffer_experimental(void) +{ + static int warned = 0; + + if (warned) return; + + warned = 1; + + if (rb_warning_category_enabled_p(RB_WARN_CATEGORY_EXPERIMENTAL)) { + rb_category_warn(RB_WARN_CATEGORY_EXPERIMENTAL, + "IO::Buffer is experimental and both the Ruby and C interface may change in the future!" + ); + } +} + static void io_buffer_initialize(struct rb_io_buffer *data, void *base, size_t size, enum rb_io_buffer_flags flags, VALUE source) { + io_buffer_experimental(); + data->flags = flags; data->size = size; |