https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94379

--- Comment #2 from Petr Skocik <pskocik at gmail dot com> ---
Excellent! 

For optional super extra coolness, this might work (and clang doesn't do this)
with statement expressions too so that statement expression-based macros could
be
marked warn_unused_result through it too.


typedef struct  __attribute((__warn_unused_result__)) { int x; } 
    wur_retval_t;

wur_retval_t foo(void){ int x=41; return (wur_retval_t){x+1}; }
#define foo_macro() ({  int x=41; (wur_retval_t){x+1}; })

void use(void){
    foo();  //warn unused result ✓
    foo_macro(); //perhaps should "warn unused result" too?
}

Reply via email to