https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79696
Eric Gallager <egallager at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pinskia at gcc dot gnu.org --- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #1) > -Wunused-result warns on the attribute warn_unused_result usage. If these > functions are not marked that way in glibc, it is maybe a glibc bug. > I don't think we should mark these as warn_unused_result really. GNU Coding Standards say to always check the result of malloc() and realloc() in the "Writing Robust Programs" section: https://www.gnu.org/prep/standards/html_node/Semantics.html#Semantics (this is why xmalloc and xrealloc are used instead in libiberty and gnulib and everywhere) Based on this, I think it makes sense to mark them as warn_unused_result. (on a tangential note, I think it'd make sense to add a -Wgcs flag that warns about all the checkable coding guidelines mentioned in the GNU Coding Standards)