From 0785a5d47395490b73a880416b232001ca92fdc0 Mon Sep 17 00:00:00 2001 From: tasn Date: Thu, 23 Aug 2012 14:24:32 +0000 Subject: [PATCH] Eo: Remove volatile from the GCC issue workaround. It seems that just setting to a temp var is enough to make GCC not optimise it out. It seems GCC's problem is with the void cast. Also, fixed another place that had the same issue. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/PROTO/eobj@75624 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Eo.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/lib/Eo.h b/src/lib/Eo.h index f2a425b..08f0a1a 100644 --- a/src/lib/Eo.h +++ b/src/lib/Eo.h @@ -191,6 +191,7 @@ typedef struct _Eo_Event_Description Eo_Event_Description; EAPI const Eo_Class * \ class_get_func_name(void) \ { \ + const Eo_Class *_tmp_parent_class; \ static volatile char lk_init = 0; \ static Eina_Lock _my_lock; \ static const Eo_Class * volatile _my_class = NULL; \ @@ -209,8 +210,8 @@ class_get_func_name(void) \ return _my_class; \ } \ eina_lock_release(&_eo_class_creation_lock); \ - (void) parent_class; \ - _my_class = eo_class_new(class_desc, parent_class, __VA_ARGS__); \ + _tmp_parent_class = parent_class; \ + _my_class = eo_class_new(class_desc, _tmp_parent_class, __VA_ARGS__); \ eina_lock_release(&_my_lock); \ \ eina_lock_take(&_eo_class_creation_lock); \ @@ -559,11 +560,13 @@ EAPI void eo_error_set_internal(const Eo *obj, const char *file, int line); * @param parent the parent to set to the object. * @param ... The ops to run. * @return An handle to the new object on success, NULL otherwise. + * + * @see #eo_add_custom */ #define eo_add(klass, parent, ...) \ ({ \ - volatile const Eo_Class *_tmp_klass = klass; \ - eo_add_internal((const Eo_Class *) _tmp_klass, parent, eo_constructor(), ## __VA_ARGS__, EO_NOOP); \ + const Eo_Class *_tmp_klass = klass; \ + eo_add_internal(_tmp_klass, parent, eo_constructor(), ## __VA_ARGS__, EO_NOOP); \ }) /** @@ -573,11 +576,13 @@ EAPI void eo_error_set_internal(const Eo *obj, const char *file, int line); * @param parent the parent to set to the object. * @param ... The ops to run. With the constructor being first. * @return An handle to the new object on success, NULL otherwise. + * + * @see #eo_add */ #define eo_add_custom(klass, parent, ...) \ ({ \ - volatile const Eo_Class *_tmp_klass = klass; \ - eo_add_internal((const Eo_Class *) _tmp_klass, parent, ## __VA_ARGS__, EO_NOOP); \ + const Eo_Class *_tmp_klass = klass; \ + eo_add_internal(_tmp_klass, parent, ## __VA_ARGS__, EO_NOOP); \ }) /** -- 2.7.4