Re: disabling warn_unused_result attribute with FORTIFY_SOURCE?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-----------------------------------------

--
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux