diff options
author | 卜部昌平 <[email protected]> | 2021-09-09 12:20:40 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2021-09-10 20:00:06 +0900 |
commit | fd12bc1896bd4a78b9ff376fd685a009254b153f (patch) | |
tree | 6631b1370060a92d73d8767e66cb099ca7bc9c7a /include/ruby | |
parent | de2afff1b9233b5b23ca1f6442a4b880e160cffb (diff) |
ruby_scan_oct, ruby_scan_hex: are not pure
Silly bug, they write back consumed bytes through passed pointers. Must
never be pure functions.
ruby_scan_oct does not refer any static variables so it can still be
__declspec(noalias), while ruby_scan_hex is not because it reads from
ruby_digit36_to_number_table.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4815
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/util.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/include/ruby/util.h b/include/ruby/util.h index dfe215eed7..b2bc1a09f6 100644 --- a/include/ruby/util.h +++ b/include/ruby/util.h @@ -23,12 +23,11 @@ # include <sys/types.h> /* ssize_t */ #endif +#include "ruby/internal/attr/noalias.h" #include "ruby/internal/attr/nodiscard.h" #include "ruby/internal/attr/nonnull.h" -#include "ruby/internal/attr/pure.h" #include "ruby/internal/attr/restrict.h" #include "ruby/internal/attr/returns_nonnull.h" -#include "ruby/internal/config.h" #include "ruby/internal/dllexport.h" #include "ruby/defines.h" @@ -74,7 +73,7 @@ unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *r /** @old{ruby_scan_oct} */ #define scan_oct(s,l,e) ((int)ruby_scan_oct((s),(l),(e))) -RBIMPL_ATTR_PURE() +RBIMPL_ATTR_NOALIAS() RBIMPL_ATTR_NONNULL(()) /** * Interprets the passed string as an octal unsigned integer. Stops when @@ -97,7 +96,6 @@ unsigned long ruby_scan_oct(const char *str, size_t len, size_t *consumed); /** @old{ruby_scan_hex} */ #define scan_hex(s,l,e) ((int)ruby_scan_hex((s),(l),(e))) -RBIMPL_ATTR_PURE() RBIMPL_ATTR_NONNULL(()) /** * Interprets the passed string a hexadecimal unsigned integer. Stops when |