[Bug c/99972] missing -Wunused-result on a call to a locally redeclared warn_unused_result function

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 8 16:54:47 GMT 2021


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

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
The code (obviously) needs to be compiled as C to show the C bug (the C++ front
end is also buggy but differently; pr99974 tracks that):

$ gcc -S -Wall pr99972.c
pr99972.c: In function ‘gwur’:
pr99972.c:20:3: warning: ignoring return value of ‘fwur’ declared with
attribute ‘warn_unused_result’ [-Wunused-result]
   20 |   fwur ();   // -Wunused-result (good)
      |   ^~~~~~~


More information about the Gcc-bugs mailing list