I have some trouble to understand the usage of optimization barrier code in the following sequence:
   struct globals;
/* '*const' ptr makes gcc optimize code much better.
 * Magic prevents ptr_to_globals from going into rodata.
 * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */
extern struct globals *const ptr_to_globals;
/* At least gcc 3.4.6 on mipsel system needs optimization barrier */
#define barrier() __asm__ __volatile__("":::"memory")
#define SET_PTR_TO_GLOBALS(x) do { \
    (*(struct globals**)&ptr_to_globals) = (void*)(x); \
    barrier(); \
} while (0)
Is this something necessary becaause of the "while (0) condition?
 
     
    