diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-01-07 16:35:35 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-06-30 10:47:01 +0900 |
commit | 21600a5f643d7edb3ce76e0257b92848ee86568e (patch) | |
tree | 97beff93c64d43a58c4a0d64c2ffa8a33904afda /internal | |
parent | 0b726924a4ac6a09b33d0f7d082c30d667b7564e (diff) |
Ensure that version number starts with digits
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3972
Diffstat (limited to 'internal')
-rw-r--r-- | internal/error.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/error.h b/internal/error.h index b1095b7496..6fbe31bb53 100644 --- a/internal/error.h +++ b/internal/error.h @@ -75,6 +75,7 @@ PRINTF_ARGS(void rb_warn_deprecated_to_remove(const char *removal, const char *f RBIMPL_ATTR_FORCEINLINE() static void rb_deprecated_method_to_be_removed(const char *removal) + RBIMPL_ATTR_DIAGNOSE_IF(!RUBY_VERSION_isdigit(removal[0]), "malformed version number", "error") RBIMPL_ATTR_DIAGNOSE_IF(RUBY_VERSION_SINCE(removal), "deprecated method to be removed", "error") { } @@ -82,7 +83,7 @@ rb_deprecated_method_to_be_removed(const char *removal) RBIMPL_ATTR_ERROR(("deprecated")) void rb_deprecated_method_to_be_removed(const char *); # define rb_deprecated_method_to_be_removed(removal) \ - (sizeof(char[1-2*RUBY_VERSION_SINCE(removal)])!=1 ? \ + (sizeof(char[1-2*(!RUBY_VERSION_isdigit(removal[0]) || RUBY_VERSION_SINCE(removal))])!=1 ? \ rb_deprecated_method_to_be_removed(removal) : \ RBIMPL_ASSERT_NOTHING) # endif |