Eo: Remove volatile from the GCC issue workaround.
authortasn <tasn>
Thu, 23 Aug 2012 14:24:32 +0000 (14:24 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 23 Aug 2012 14:24:32 +0000 (14:24 +0000)
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

index f2a425b..08f0a1a 100644 (file)
@@ -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); \
     })
 
 /**