[Bug c/83559] [8 regression] -Wsuggest-attribute=const conflicts with -Wattributes warning about const attribute on function returning void
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jan 1 18:25:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83559
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-01-01
Ever confirmed|0 |1
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The new -Wattributes warning is the (deliberate) result of r255469. The only
meaningful effect a call can have to a function that's declared with the const
attribute is return a value. Calls to such functions that ignore the returned
value are eliminated (and diagnosed with -Wunused-value). Likewise, calls to
const functions that return void are eliminated (though without a warning,
which seems like an omission). As a result, it makes little sense to declare a
function to be both const and return void, and -Wsuggest-attribute=const should
not be issued for const functions.
More information about the Gcc-bugs
mailing list