https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
--- Comment #50 from Florian Weimer <fw at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #49) > All that means is for APIs for which cast to void as silencing is meant to > be ok should be using [[nodiscard]] rather than > __attribute__((warn_unused_result)). APIs which do not want that should > keep using warn_unused_result. When that attribute was being added, the > glibc folks that requested it specially asked for casts to void not being a > way to silence the attribute because the attributes were added to functions > where users really should use the return value rather than silently ignore > it. I don't think these folks work on glibc anymore. 8-) For glibc, I think we will use nodiscard by default (outside non-fortify mode) in most cases where we use __wur now (and some), and restrict __attribute__ ((warn_unused_result)) to old compilers in fortify mode. Other libraries should probably do the same. The __attribute__ ((warn_unused_result)) remaisn too problematic because it encourages non-portable code to suppress it, such as __attribute__ ((unused)).