diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-18 06:45:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-18 06:45:50 +0000 |
commit | 862bad2d2aa7eda686b41c050de22f049760f35a (patch) | |
tree | 063668aab5bb37aa4be56848fc9021221728080e /include/ruby | |
parent | 6795b09fb98fa13eb246b44e670573bda12e35f9 (diff) | |
download | ruby-862bad2d2aa7eda686b41c050de22f049760f35a.tar.gz |
ruby.h: error only in the core
* include/ruby/ruby.h (RUBY_SAFE_LEVEL_CHECK): make only
rb_set_safe_level(4) an error always but make rb_secure(4) an error
only in the core. [ruby-dev:47517] [Bug #8652]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby')
-rw-r--r-- | include/ruby/ruby.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 974bfd97fd..17f9ba3f41 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -567,14 +567,19 @@ void rb_secure(int); int rb_safe_level(void); void rb_set_safe_level(int); #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) -int ruby_safe_level_4(void) __attribute__((error("$SAFE=4 is obsolete"))); +int ruby_safe_level_4_error(void) __attribute__((error("$SAFE=4 is obsolete"))); +# ifdef RUBY_EXPORT +# define ruby_safe_level_4_warning() ruby_safe_level_4_error() +# else +int ruby_safe_level_4_warning(void) __attribute__((warning("$SAFE=4 is obsolete"))); +# endif #define RUBY_SAFE_LEVEL_INVALID_P(level) \ __extension__(__builtin_constant_p(level) && \ ((level) < 0 || RUBY_SAFE_LEVEL_MAX < (level))) -#define RUBY_SAFE_LEVEL_CHECK(level) \ - (RUBY_SAFE_LEVEL_INVALID_P(level) ? ruby_safe_level_4() : (level)) -#define rb_secure(level) rb_secure(RUBY_SAFE_LEVEL_CHECK(level)) -#define rb_set_safe_level(level) rb_set_safe_level(RUBY_SAFE_LEVEL_CHECK(level)) +#define RUBY_SAFE_LEVEL_CHECK(level, type) \ + (RUBY_SAFE_LEVEL_INVALID_P(level) ? ruby_safe_level_4_##type() : (level)) +#define rb_secure(level) rb_secure(RUBY_SAFE_LEVEL_CHECK(level, warning)) +#define rb_set_safe_level(level) rb_set_safe_level(RUBY_SAFE_LEVEL_CHECK(level, error)) #endif void rb_set_safe_level_force(int); void rb_secure_update(VALUE); |