aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-05 07:11:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-05 07:11:34 +0000
commit5c19519e8c3482720313334d3eac45ca5abfb3f3 (patch)
tree20c25fd0dbaa373c3cec00fd72d8f94f3a160ab5
parentdeca1d8007e88775f5dd92074026fd06dc385045 (diff)
downloadruby-5c19519e8c3482720313334d3eac45ca5abfb3f3.tar.gz
proc.c: suppress a warning
* proc.c (call_method_data_safe): suppress clobbered warning by old gcc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--proc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/proc.c b/proc.c
index d3f94e4849..9bef504815 100644
--- a/proc.c
+++ b/proc.c
@@ -18,6 +18,12 @@
* versions */
#define PROC_NEW_REQUIRES_BLOCK 0
+#if !defined(__GNUC__) || __GNUC__ < 5
+# define NO_CLOBBERED(v) (*(volatile VALUE *)&(v))
+#else
+# define NO_CLOBBERED(v) (v)
+#endif
+
const rb_cref_t *rb_vm_cref_in_context(VALUE self, VALUE cbase);
struct METHOD {
@@ -1980,7 +1986,9 @@ call_method_data_safe(rb_thread_t *th, const struct METHOD *data,
TH_PUSH_TAG(th);
if ((state = TH_EXEC_TAG()) == 0) {
- result = call_method_data(th, data, argc, argv, pass_procval);
+ /* result is used only if state == 0, no exceptions is caught. */
+ /* otherwise it doesn't matter even if clobbered. */
+ NO_CLOBBERED(result) = call_method_data(th, data, argc, argv, pass_procval);
}
TH_POP_TAG();
rb_set_safe_level_force(safe);