summaryrefslogtreecommitdiff
path: root/spec/ruby/optional/capi/ext/object_spec.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2021-09-09 21:44:06 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2021-09-10 20:00:06 +0900
commitb0f01202677da255f2004b4d6de43088202a0f8b (patch)
tree4258302edc23fc98b2300b680fa83118edea3c21 /spec/ruby/optional/capi/ext/object_spec.c
parentb563b9c48f09093b94554867fe8a71de6c27a37b (diff)
spec/ruby/optional/capi/ext: support ruby < 3
RBIMPL_WARNING_PUSH is a 3.0 feature. Rubyspec OTOH has to support 2.x.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4815
Diffstat (limited to 'spec/ruby/optional/capi/ext/object_spec.c')
-rw-r--r--spec/ruby/optional/capi/ext/object_spec.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/spec/ruby/optional/capi/ext/object_spec.c b/spec/ruby/optional/capi/ext/object_spec.c
index eae2446976..05ce44508d 100644
--- a/spec/ruby/optional/capi/ext/object_spec.c
+++ b/spec/ruby/optional/capi/ext/object_spec.c
@@ -151,19 +151,27 @@ static VALUE object_specs_rb_obj_method(VALUE self, VALUE obj, VALUE method) {
return rb_obj_method(obj, method);
}
-
-RBIMPL_WARNING_PUSH()
-#if RBIMPL_HAS_WARNING("-Wdeprecated-declarations") || RBIMPL_COMPILER_SINCE(GCC, 4, 6, 0)
-/* GCC 4.5 introduced __attribute__((__deprecated__)) */
-/* GCC 4.6 introduced #pragma GCC diagnostic push */
-RBIMPL_WARNING_IGNORED(-Wdeprecated-declarations)
+#if defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#elif defined(__clang__) && defined(__has_warning)
+# if __has_warning("-Wdeprecated-declarations")
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wdeprecated-declarations"
+# endif
#endif
static VALUE object_spec_rb_obj_taint(VALUE self, VALUE obj) {
return rb_obj_taint(obj);
}
-RBIMPL_WARNING_POP()
+#if defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+# pragma GCC diagnostic pop
+#elif defined(__clang__) && defined(__has_warning)
+# if __has_warning("-Wdeprecated-declarations")
+# pragma clang diagnostic pop
+# endif
+#endif
static VALUE so_require(VALUE self) {
rb_require("fixtures/foo");