summaryrefslogtreecommitdiff
path: root/eval_intern.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-04 08:34:12 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-04-04 08:34:12 (GMT)
commite18259424ea6f1baafacab442d57c05d51c2548b (patch)
treee054a11ce590506a78cb7083e82d7859a2df92a5 /eval_intern.h
parent9dd0113023283583441fc4f3cc571c275ec5ec0b (diff)
eval_intern.h: VAR_INITIALIZED
* eval_intern.h (VAR_INITIALIZED): macro to suppress maybe-uninitialized warnings by gcc 4.7 and 4.8. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval_intern.h')
-rw-r--r--eval_intern.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/eval_intern.h b/eval_intern.h
index f81f922..f19c252 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -128,6 +128,14 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
#define PUSH_TAG() TH_PUSH_TAG(GET_THREAD())
#define POP_TAG() TH_POP_TAG()
+#if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ == 7 || __GNUC_MINOR__ == 8)
+# define VAR_FROM_MEMORY(var) __extension__(*(__typeof__(var) volatile *)&(var))
+# define VAR_INITIALIZED(var) ((var) = VAR_FROM_MEMORY(var))
+#else
+# define VAR_FROM_MEMORY(var) (var)
+# define VAR_INITIALIZED(var) ((void)&(var))
+#endif
+
/* clear th->state, and return the value */
static inline int
rb_threadptr_tag_state(rb_thread_t *th)
@@ -150,7 +158,7 @@ rb_threadptr_tag_jump(rb_thread_t *th, int st)
[ISO/IEC 9899:1999] 7.13.1.1
*/
#define TH_EXEC_TAG() \
- (ruby_setjmp(_tag.buf) ? rb_threadptr_tag_state(_th) : (TH_REPUSH_TAG(), 0))
+ (ruby_setjmp(_tag.buf) ? rb_threadptr_tag_state(VAR_FROM_MEMORY(_th)) : (TH_REPUSH_TAG(), 0))
#define EXEC_TAG() \
TH_EXEC_TAG()