[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: disabling warn_unused_result attribute with FORTIFY_SOURCE?
- From: Mamoru Tasaka <mtasaka ioa s u-tokyo ac jp>
- To: Development discussions related to Fedora Core <fedora-devel-list redhat com>
- Subject: Re: disabling warn_unused_result attribute with FORTIFY_SOURCE?
- Date: Thu, 15 Mar 2007 13:33:29 +0900
Kevin Kofler wrote:
Matthew Miller <mattdm <at> mattdm.org> writes:
Unlike other warnings, though, there doesn't seem to be a way to turn it
off. Is there one I'm missing?
The _easy_ way to get rid of the warnings is to cast the unused results to
void.
I may be wrong, however, my recognition is that this warning
cannot be got rid of by casting to void.
-----------------------------------------
[tasaka1 localhost TEMP]$ cat attri_unused.c
int foo1(){
return 2;
}
int foo1 () __attribute__ ((warn_unused_result));
int main(){
(void) foo1();
return 0;
}
[tasaka1 localhost TEMP]$ LANG=C gcc -o attri_unused attri_unused.c -Wp,-D_FORTIFY_SOURCE=2
attri_unused.c: In function 'main':
attri_unused.c:9: warning: ignoring return value of 'foo1', declared with attribute
warn_unused_result
-----------------------------------------
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]