Fix c99 compatibility: use __typeof__ instead of typeof in public headers
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 11 Jun 2012 14:16:35 +0000 (10:16 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 11 Jun 2012 14:17:59 +0000 (10:17 -0400)
Reported-by: John Steele Scott <toojays@toojays.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-bp.h
urcu-pointer.h
urcu/compiler.h
urcu/hlist.h
urcu/list.h
urcu/rcuhlist.h
urcu/rculfhash.h
urcu/rculist.h
urcu/static/urcu-pointer.h
urcu/system.h

index 5e42312e3ff6760b6637e56b08e073c63c3975d5..833688f7b553089deb21e7a32187bb83d5b5fdf3 100644 (file)
--- a/urcu-bp.h
+++ b/urcu-bp.h
@@ -93,7 +93,7 @@ extern void rcu_read_unlock(void);
 extern void *rcu_dereference_sym_bp(void *p);
 #define rcu_dereference_bp(p)                                               \
        ({                                                                   \
-               typeof(p) _________p1 = URCU_FORCE_CAST(typeof(p),           \
+               __typeof__(p) _________p1 = URCU_FORCE_CAST(__typeof__(p),   \
                        rcu_dereference_sym_bp(URCU_FORCE_CAST(void *, p))); \
                (_________p1);                                               \
        })
@@ -101,10 +101,10 @@ extern void *rcu_dereference_sym_bp(void *p);
 extern void *rcu_cmpxchg_pointer_sym_bp(void **p, void *old, void *_new);
 #define rcu_cmpxchg_pointer_bp(p, old, _new)                                \
        ({                                                                   \
-               typeof(*(p)) _________pold = (old);                          \
-               typeof(*(p)) _________pnew = (_new);                         \
-               typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)),     \
-                       rcu_cmpxchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p),\
+               __typeof__(*(p)) _________pold = (old);                      \
+               __typeof__(*(p)) _________pnew = (_new);                     \
+               __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
+                       rcu_cmpxchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \
                                                _________pold,               \
                                                _________pnew));             \
                (_________p1);                                               \
@@ -113,8 +113,8 @@ extern void *rcu_cmpxchg_pointer_sym_bp(void **p, void *old, void *_new);
 extern void *rcu_xchg_pointer_sym_bp(void **p, void *v);
 #define rcu_xchg_pointer_bp(p, v)                                           \
        ({                                                                   \
-               typeof(*(p)) _________pv = (v);                              \
-               typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)),     \
+               __typeof__(*(p)) _________pv = (v);                          \
+               __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)),\
                        rcu_xchg_pointer_sym_bp(URCU_FORCE_CAST(void **, p), \
                                             _________pv));                  \
                (_________p1);                                               \
@@ -123,8 +123,8 @@ extern void *rcu_xchg_pointer_sym_bp(void **p, void *v);
 extern void *rcu_set_pointer_sym_bp(void **p, void *v);
 #define rcu_set_pointer_bp(p, v)                                            \
        ({                                                                   \
-               typeof(*(p)) _________pv = (v);                              \
-               typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)),     \
+               __typeof__(*(p)) _________pv = (v);                          \
+               __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
                        rcu_set_pointer_sym_bp(URCU_FORCE_CAST(void **, p),  \
                                            _________pv));                   \
                (_________p1);                                               \
index 1e1e6bf8a157dff00edcfda519a773b1e0a4a32d..03bfe793c6aaf339a03d7aa0e64bed0b105a8646 100644 (file)
@@ -67,7 +67,7 @@ extern "C" {
 extern void *rcu_dereference_sym(void *p);
 #define rcu_dereference(p)                                                  \
        ({                                                                   \
-               typeof(p) _________p1 = URCU_FORCE_CAST(typeof(p),           \
+               __typeof__(p) _________p1 =     URCU_FORCE_CAST(__typeof__(p), \
                        rcu_dereference_sym(URCU_FORCE_CAST(void *, p)));    \
                (_________p1);                                               \
        })
@@ -75,10 +75,10 @@ extern void *rcu_dereference_sym(void *p);
 extern void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new);
 #define rcu_cmpxchg_pointer(p, old, _new)                                   \
        ({                                                                   \
-               typeof(*(p)) _________pold = (old);                          \
-               typeof(*(p)) _________pnew = (_new);                         \
-               typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)),     \
-                       rcu_cmpxchg_pointer_sym(URCU_FORCE_CAST(void **, p),\
+               __typeof__(*(p)) _________pold = (old);                      \
+               __typeof__(*(p)) _________pnew = (_new);                     \
+               __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
+                       rcu_cmpxchg_pointer_sym(URCU_FORCE_CAST(void **, p), \
                                                _________pold,               \
                                                _________pnew));             \
                (_________p1);                                               \
@@ -87,8 +87,8 @@ extern void *rcu_cmpxchg_pointer_sym(void **p, void *old, void *_new);
 extern void *rcu_xchg_pointer_sym(void **p, void *v);
 #define rcu_xchg_pointer(p, v)                                              \
        ({                                                                   \
-               typeof(*(p)) _________pv = (v);                              \
-               typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)),     \
+               __typeof__(*(p)) _________pv = (v);                          \
+               __typeof__(*(p)) _________p1 = URCU_FORCE_CAST(__typeof__(*(p)), \
                        rcu_xchg_pointer_sym(URCU_FORCE_CAST(void **, p),    \
                                             _________pv));                  \
                (_________p1);                                               \
@@ -103,7 +103,7 @@ extern void *rcu_xchg_pointer_sym(void **p, void *v);
 extern void *rcu_set_pointer_sym(void **p, void *v);
 #define rcu_set_pointer(p, v)                                               \
        do {                                                                 \
-               typeof(*(p)) _________pv = (v);                              \
+               __typeof__(*(p)) _________pv = (v);                          \
                (void) rcu_set_pointer_sym(URCU_FORCE_CAST(void **, p),      \
                                            _________pv);                    \
        } while (0)
index fc2425cd5ff2f4c0aaf8f83d4c820d36ec2a9424..974885a73f36c08e322bb6606bb3cd0e8e964ddd 100644 (file)
@@ -38,7 +38,7 @@
  * use is to mediate communication between process-level code and irq/NMI
  * handlers, all running on the same CPU.
  */
-#define CMM_ACCESS_ONCE(x)     (*(volatile typeof(x) *)&(x))
+#define CMM_ACCESS_ONCE(x)     (*(volatile __typeof__(x) *)&(x))
 
 #ifndef caa_max
 #define caa_max(a,b) ((a)>(b)?(a):(b))
@@ -65,7 +65,7 @@
  */
 #define caa_container_of(ptr, type, member)                            \
        ({                                                              \
-               const typeof(((type *) NULL)->member) * __ptr = (ptr);  \
+               const __typeof__(((type *) NULL)->member) * __ptr = (ptr); \
                (type *)((char *)__ptr - offsetof(type, member));       \
        })
 
index 82015b36fa1aa32a795fa556df52f76d9a342121..d7d5c87f1c28d1c3710ed1d1bb4a08f0751b3a55 100644 (file)
@@ -62,16 +62,16 @@ static inline void cds_hlist_del (struct cds_hlist_node *elem)
 
 #define cds_hlist_for_each_entry(entry, pos, head, member)                     \
        for (pos = (head)->next,                                        \
-                    entry = cds_hlist_entry(pos, typeof(*entry), member);      \
+                    entry = cds_hlist_entry(pos, __typeof__(*entry), member);  \
             pos != NULL;                                               \
             pos = pos->next,                                   \
-                    entry = cds_hlist_entry(pos, typeof(*entry), member))
+                    entry = cds_hlist_entry(pos, __typeof__(*entry), member))
 
 #define cds_hlist_for_each_entry_safe(entry, pos, p, head, member)             \
        for (pos = (head)->next,                                        \
-                    entry = cds_hlist_entry(pos, typeof(*entry), member);      \
+                    entry = cds_hlist_entry(pos, __typeof__(*entry), member);  \
             (pos != NULL) && ({ p = pos->next; 1;});                   \
             pos = p,                                                   \
-                    entry = cds_hlist_entry(pos, typeof(*entry), member))
+                    entry = cds_hlist_entry(pos, __typeof__(*entry), member))
 
 #endif /* _KCOMPAT_HLIST_H */
index 04dad80929ef1d6f2ec1a3adcd302d8f2f962533..f27ff7ba7900ddcf17ba9be95087d1bd4fee1c5f 100644 (file)
@@ -154,20 +154,20 @@ cds_list_splice (struct cds_list_head *add, struct cds_list_head *head)
        pos = p, p = pos->prev)
 
 #define cds_list_for_each_entry(pos, head, member)                             \
-       for (pos = cds_list_entry((head)->next, typeof(*pos), member);  \
+       for (pos = cds_list_entry((head)->next, __typeof__(*pos), member); \
             &pos->member != (head);                                    \
-            pos = cds_list_entry(pos->member.next, typeof(*pos), member))
+            pos = cds_list_entry(pos->member.next, __typeof__(*pos), member))
 
 #define cds_list_for_each_entry_reverse(pos, head, member)                     \
-       for (pos = cds_list_entry((head)->prev, typeof(*pos), member);  \
+       for (pos = cds_list_entry((head)->prev, __typeof__(*pos), member); \
             &pos->member != (head);                                    \
-            pos = cds_list_entry(pos->member.prev, typeof(*pos), member))
+            pos = cds_list_entry(pos->member.prev, __typeof__(*pos), member))
 
 #define cds_list_for_each_entry_safe(pos, p, head, member)                     \
-       for (pos = cds_list_entry((head)->next, typeof(*pos), member),  \
-                    p = cds_list_entry(pos->member.next,typeof(*pos), member); \
+       for (pos = cds_list_entry((head)->next, __typeof__(*pos), member), \
+                    p = cds_list_entry(pos->member.next, __typeof__(*pos), member); \
             &pos->member != (head);                                    \
-            pos = p, p = cds_list_entry(pos->member.next, typeof(*pos), member))
+            pos = p, p = cds_list_entry(pos->member.next, __typeof__(*pos), member))
 
 static inline int cds_list_empty(struct cds_list_head *head)
 {
index 83b13632536cb15a3a398505da960f4e3417c086..8549550e7fab3358fd031b30ed87ff67244f1472 100644 (file)
@@ -57,9 +57,9 @@ static inline void cds_hlist_del_rcu(struct cds_hlist_node *elem)
 
 #define cds_hlist_for_each_entry_rcu(entry, pos, head, member)         \
        for (pos = rcu_dereference((head)->next),                       \
-                    entry = cds_hlist_entry(pos, typeof(*entry), member);      \
+                    entry = cds_hlist_entry(pos, __typeof__(*entry), member);  \
             pos != NULL;                                               \
             pos = rcu_dereference(pos->next),                          \
-                    entry = cds_hlist_entry(pos, typeof(*entry), member))
+                    entry = cds_hlist_entry(pos, __typeof__(*entry), member))
 
 #endif /* _URCU_RCUHLIST_H */
index 2938e5ec6235883acc9efb9b029e135035f7a10e..03ce5932b4837aa8d4c5f68f6b9cee47dcddcb10 100644 (file)
@@ -450,21 +450,21 @@ void cds_lfht_resize(struct cds_lfht *ht, unsigned long new_size);
 #define cds_lfht_for_each_entry(ht, iter, pos, member)                 \
        for (cds_lfht_first(ht, iter),                                  \
                        pos = caa_container_of(cds_lfht_iter_get_node(iter), \
-                                       typeof(*(pos)), member);        \
+                                       __typeof__(*(pos)), member);    \
                &(pos)->member != NULL;                                 \
                cds_lfht_next(ht, iter),                                \
                        pos = caa_container_of(cds_lfht_iter_get_node(iter), \
-                                       typeof(*(pos)), member))
+                                       __typeof__(*(pos)), member))
 
 #define cds_lfht_for_each_entry_duplicate(ht, hash, match, key,                \
                                iter, pos, member)                      \
        for (cds_lfht_lookup(ht, hash, match, key, iter),               \
                        pos = caa_container_of(cds_lfht_iter_get_node(iter), \
-                                       typeof(*(pos)), member);        \
+                                       __typeof__(*(pos)), member);    \
                &(pos)->member != NULL;                                 \
                cds_lfht_next_duplicate(ht, match, key, iter),          \
                        pos = caa_container_of(cds_lfht_iter_get_node(iter), \
-                                       typeof(*(pos)), member))
+                                       __typeof__(*(pos)), member))
 
 #ifdef __cplusplus
 }
index 575e1fb0d8f4f836166695f80b732898d8c0265a..3604a96d0619d082ef7c3c2d46a4cff421c04c2e 100644 (file)
@@ -71,8 +71,8 @@ static inline void cds_list_del_rcu(struct cds_list_head *elem)
 /* Iterate through elements of the list.
  */
 #define cds_list_for_each_entry_rcu(pos, head, member)                         \
-       for (pos = cds_list_entry(rcu_dereference((head)->next), typeof(*pos), member); \
+       for (pos = cds_list_entry(rcu_dereference((head)->next), __typeof__(*pos), member);     \
             &pos->member != (head);                                    \
-            pos = cds_list_entry(rcu_dereference(pos->member.next), typeof(*pos), member))
+            pos = cds_list_entry(rcu_dereference(pos->member.next), __typeof__(*pos), member))
 
 #endif /* _URCU_RCULIST_H */
index 906caa009c708c13cc2f9a6b0c1e989416e3aed7..48dc5bf506d86b06ddb1b5b4cf72066508634493 100644 (file)
@@ -62,7 +62,7 @@ extern "C" {
  */
 
 #define _rcu_dereference(p)     ({                                     \
-                               typeof(p) _________p1 = CMM_LOAD_SHARED(p); \
+                               __typeof__(p) _________p1 = CMM_LOAD_SHARED(p); \
                                cmm_smp_read_barrier_depends();         \
                                (_________p1);                          \
                                })
@@ -77,8 +77,8 @@ extern "C" {
 
 #define _rcu_cmpxchg_pointer(p, old, _new)                             \
        ({                                                              \
-               typeof(*p) _________pold = (old);                       \
-               typeof(*p) _________pnew = (_new);                      \
+               __typeof__(*p) _________pold = (old);                   \
+               __typeof__(*p) _________pnew = (_new);                  \
                if (!__builtin_constant_p(_new) ||                      \
                    ((_new) != NULL))                                   \
                        cmm_wmb();                                              \
@@ -93,7 +93,7 @@ extern "C" {
 
 #define _rcu_xchg_pointer(p, v)                                \
        ({                                              \
-               typeof(*p) _________pv = (v);           \
+               __typeof__(*p) _________pv = (v);       \
                if (!__builtin_constant_p(v) ||         \
                    ((v) != NULL))                      \
                        cmm_wmb();                              \
@@ -103,7 +103,7 @@ extern "C" {
 
 #define _rcu_set_pointer(p, v)                         \
        do {                                            \
-               typeof(*p) _________pv = (v);           \
+               __typeof__(*p) _________pv = (v);       \
                if (!__builtin_constant_p(v) ||         \
                    ((v) != NULL))                      \
                        cmm_wmb();                              \
index acce7e978cc9ba5d392c252612c53880ddab329f..2a45f22d9615593eda4c2c8c0ec369e500f9535c 100644 (file)
@@ -49,7 +49,7 @@
  */
 #define CMM_STORE_SHARED(x, v)         \
        ({                              \
-               typeof(x) _v = _CMM_STORE_SHARED(x, v); \
+               __typeof__(x) _v = _CMM_STORE_SHARED(x, v);     \
                cmm_smp_wmc();          \
                _v;                     \
        })
This page took 0.034301 seconds and 4 git commands to generate.