casting to (void) doesn't avoid the unused_result warning. testcase:
=== Cut ===
extern int foo() __attribute__((warn_unused_result));
int main()
{
(void) foo();
return 0;
}
=== Cut ===
g++ -Wall -W -O2 -c unused.cc
unused.cc: In function 'int main()':
unused.cc:4: warning: ignoring return value of 'int foo()', declared with
attribute warn_unused_result
--
Summary: can't voidify __attribute__((warn_unused_result))
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mueller at kde dot org
GCC host triplet: i686-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509