Move non-portable pragmas to rubyspec.h

In the extension libraries in spec/ruby/optional/capi, do not care
about deprecated declarations.
This commit is contained in:
Nobuyoshi Nakada 2023-12-25 14:08:21 +09:00
Родитель 863ded45a1
Коммит b641b7e640
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 3582D74E1FEE4465
6 изменённых файлов: 23 добавлений и 21 удалений

Просмотреть файл

@ -196,10 +196,6 @@ static VALUE copy_ary(RB_BLOCK_CALL_FUNC_ARGLIST(el, new_ary)) {
return rb_ary_push(new_ary, el);
}
// Suppress deprecations warnings for rb_iterate(), we want to test it while it exists
RBIMPL_WARNING_PUSH()
RBIMPL_WARNING_IGNORED(-Wdeprecated-declarations)
static VALUE array_spec_rb_iterate(VALUE self, VALUE ary) {
VALUE new_ary = rb_ary_new();
@ -255,8 +251,6 @@ static VALUE array_spec_rb_block_call_then_yield(VALUE self, VALUE obj) {
return Qnil;
}
RBIMPL_WARNING_POP()
static VALUE array_spec_rb_mem_clear(VALUE self, VALUE obj) {
VALUE ary[1];
ary[0] = obj;

Просмотреть файл

@ -271,15 +271,12 @@ static VALUE encoding_spec_rb_enc_str_asciionly_p(VALUE self, VALUE str) {
}
}
RBIMPL_WARNING_PUSH()
RBIMPL_WARNING_IGNORED(-Wformat-security)
static VALUE encoding_spec_rb_enc_raise(VALUE self, VALUE encoding, VALUE exception_class, VALUE format) {
rb_encoding *e = rb_to_encoding(encoding);
const char *f = RSTRING_PTR(format);
rb_enc_raise(e, exception_class, "%s", f);
}
RBIMPL_WARNING_POP()
static VALUE encoding_spec_rb_uv_to_utf8(VALUE self, VALUE buf, VALUE num) {
int len = rb_uv_to_utf8(RSTRING_PTR(buf), NUM2INT(num));

Просмотреть файл

@ -155,13 +155,9 @@ static VALUE object_specs_rb_obj_method(VALUE self, VALUE obj, VALUE method) {
}
#ifndef RUBY_VERSION_IS_3_2
// Suppress deprecations warnings for rb_obj_taint(), we want to test it while it exists
RBIMPL_WARNING_PUSH()
RBIMPL_WARNING_IGNORED(-Wdeprecated-declarations)
static VALUE object_spec_rb_obj_taint(VALUE self, VALUE obj) {
return rb_obj_taint(obj);
}
RBIMPL_WARNING_POP()
#endif
static VALUE so_require(VALUE self) {

Просмотреть файл

@ -11,6 +11,29 @@
# include <version.h>
#endif
/* copied from ext/-test-/cxxanyargs/cxxanyargs.cpp */
#if 0 /* Ignore deprecation warnings */
#elif defined(_MSC_VER)
#pragma warning(disable : 4996)
#elif defined(__INTEL_COMPILER)
#pragma warning(disable : 1786)
#elif defined(__clang__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__SUNPRO_CC)
#pragma error_messages (off,symdeprecated)
#else
// :FIXME: improve here for your compiler.
#endif
#ifndef RUBY_VERSION_MAJOR
#define RUBY_VERSION_MAJOR RUBY_API_VERSION_MAJOR
#define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR

Просмотреть файл

@ -255,10 +255,6 @@ VALUE string_spec_rb_str_new5(VALUE self, VALUE str, VALUE ptr, VALUE len) {
}
#ifndef RUBY_VERSION_IS_3_2
// Suppress deprecations warnings for rb_tainted_str_new(), we want to test it while it exists
RBIMPL_WARNING_PUSH()
RBIMPL_WARNING_IGNORED(-Wdeprecated-declarations)
VALUE string_spec_rb_tainted_str_new(VALUE self, VALUE str, VALUE len) {
return rb_tainted_str_new(RSTRING_PTR(str), FIX2INT(len));
}
@ -266,8 +262,6 @@ VALUE string_spec_rb_tainted_str_new(VALUE self, VALUE str, VALUE len) {
VALUE string_spec_rb_tainted_str_new2(VALUE self, VALUE str) {
return rb_tainted_str_new2(RSTRING_PTR(str));
}
RBIMPL_WARNING_POP()
#endif
VALUE string_spec_rb_str_plus(VALUE self, VALUE str1, VALUE str2) {

Просмотреть файл

@ -26,8 +26,6 @@ static VALUE thread_spec_rb_thread_alone(VALUE self) {
return rb_thread_alone() ? Qtrue : Qfalse;
}
RBIMPL_WARNING_IGNORED(-Wdeprecated-declarations)
/* This is unblocked by unblock_func(). */
static void* blocking_gvl_func(void* data) {
int rfd = *(int *)data;