X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=include%2Furcu%2Fstatic%2Fpointer.h;h=465a6101bcb12b5708ccfb90334b00969bf6b0c3;hb=36cad2d0c02180dd4fbe4974f40fa2782b1db3e6;hp=ca9a2f9836760dd01207508d2615ee9f43d4e555;hpb=81562423503c71c206a3303cf53e3b11f8ca034b;p=urcu.git diff --git a/include/urcu/static/pointer.h b/include/urcu/static/pointer.h index ca9a2f9..465a610 100644 --- a/include/urcu/static/pointer.h +++ b/include/urcu/static/pointer.h @@ -90,9 +90,15 @@ extern "C" { # define __URCU_DEREFERENCE_USE_ATOMIC_CONSUME #endif +/* + * If p is const (the pointer itself, not what it points to), using + * __typeof__(p) would declare a const variable, leading to + * -Wincompatible-pointer-types errors. Using `+ 0` makes it an rvalue and + * gets rid of the const-ness. + */ #ifdef __URCU_DEREFERENCE_USE_ATOMIC_CONSUME # define _rcu_dereference(p) __extension__ ({ \ - __typeof__(p) _________p1; \ + __typeof__(p + 0) _________p1; \ __atomic_load(&(p), &_________p1, __ATOMIC_CONSUME); \ (_________p1); \ })