Skip to content

Commit a164a34

Browse files
committed
Resurrect a deprecated code for fixing tests for now
Revert "Remove deprecated code to fix RUBY_DEBUG build failures" This reverts commit 9614bea. And changed 3.4 to 3.5. To be fixed properly later.
1 parent 596db9c commit a164a34

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

process.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,27 @@ pst_bitand(VALUE st1, VALUE st2)
900900
if (mask < 0) {
901901
rb_raise(rb_eArgError, "negative mask value: %d", mask);
902902
}
903+
#define WARN_SUGGEST(suggest) \
904+
rb_warn_deprecated_to_remove_at(3.5, "Process::Status#&", suggest)
905+
906+
switch (mask) {
907+
case 0x80:
908+
WARN_SUGGEST("Process::Status#coredump?");
909+
break;
910+
case 0x7f:
911+
WARN_SUGGEST("Process::Status#signaled? or Process::Status#termsig");
912+
break;
913+
case 0xff:
914+
WARN_SUGGEST("Process::Status#exited?, Process::Status#stopped? or Process::Status#coredump?");
915+
break;
916+
case 0xff00:
917+
WARN_SUGGEST("Process::Status#exitstatus or Process::Status#stopsig");
918+
break;
919+
default:
920+
WARN_SUGGEST("other Process::Status predicates");
921+
break;
922+
}
923+
#undef WARN_SUGGEST
903924
status &= mask;
904925

905926
return INT2NUM(status);
@@ -934,6 +955,21 @@ pst_rshift(VALUE st1, VALUE st2)
934955
if (places < 0) {
935956
rb_raise(rb_eArgError, "negative shift value: %d", places);
936957
}
958+
#define WARN_SUGGEST(suggest) \
959+
rb_warn_deprecated_to_remove_at(3.5, "Process::Status#>>", suggest)
960+
961+
switch (places) {
962+
case 7:
963+
WARN_SUGGEST("Process::Status#coredump?");
964+
break;
965+
case 8:
966+
WARN_SUGGEST("Process::Status#exitstatus or Process::Status#stopsig");
967+
break;
968+
default:
969+
WARN_SUGGEST("other Process::Status attributes");
970+
break;
971+
}
972+
#undef WARN_SUGGEST
937973
status >>= places;
938974

939975
return INT2NUM(status);

0 commit comments

Comments
 (0)