Skip to content

Check deprecated functions at compilation time#3972

Merged
nobu merged 4 commits intoruby:masterfrom
nobu:deprecated_to_remove_at
Jun 30, 2021
Merged

Check deprecated functions at compilation time#3972
nobu merged 4 commits intoruby:masterfrom
nobu:deprecated_to_remove_at

Conversation

@nobu
Copy link
Member

@nobu nobu commented Dec 22, 2020

Currently rb_warn_deprecated_to_remove shows the deprecation warning with the version to remove. Often we can miss it however, especially as now deprecation warnings are suppressed by default. It's better to notice automatically, probably at build-time.

This is not perfect, but it can detect the miss at least a few jobs in the CIs.

Also, this changes the message not to print the future version, as @shyouhei said.

Proper annotation of when to remove a feature helps us a lot ("don't delete it now" sign), but can rarely be useful to end users. Let's just use the info internally.

Feature #17432

@nobu nobu requested a review from shyouhei December 22, 2020 07:45
@nobu nobu force-pushed the deprecated_to_remove_at branch from a3ee015 to ae242f4 Compare December 22, 2020 10:10
@nobu
Copy link
Member Author

nobu commented Dec 23, 2020

Failed with -DRUBY_DEBUG as expected.
https://github.com/ruby/ruby/pull/3972/checks?check_run_id=1599477241#step:11:145

In file included from ../src/dir.c:111:
../src/dir.c: In function ‘rb_dir_exists_p’:
../src/internal/error.h:78:6: error: call to ‘rb_deprecated_method_to_be_removed’ declared with attribute error: deprecated
   78 |      rb_deprecated_method_to_be_removed(removal) : \
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/internal/error.h:78:6: note: in definition of macro ‘rb_warn_deprecated_to_remove_at’
   78 |      rb_deprecated_method_to_be_removed(removal) : \
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@nobu nobu force-pushed the deprecated_to_remove_at branch 2 times, most recently from c7362be to f140533 Compare December 23, 2020 16:41
@nobu nobu force-pushed the deprecated_to_remove_at branch from f140533 to 6b35d1c Compare April 5, 2021 06:16
@nobu nobu force-pushed the deprecated_to_remove_at branch from 6b35d1c to 5c37d1a Compare June 30, 2021 00:54
@nobu nobu merged commit 94bd3bd into ruby:master Jun 30, 2021
@nobu nobu deleted the deprecated_to_remove_at branch June 30, 2021 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant