https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
--- Comment #22 from Filipe Brandenburger <filbranden at google dot com> --- (In reply to Jan Engelhardt from comment #20) > Seems like the short route is to add a new attribute > ((warn_unused_result_with_void_cancelling)) that exhibits the "desired" > behavior of (void) cancelling the warning, and then make glibc use that. > Simple, no? I'd rather see ((warn_unused_result_without_void_cancelling)). Or, better yet, add both in and add a command-line flag to allow ((warn_unused_result)) to use one or the other. I still don't see the point of preventing (void) from cancelling it since you can just store the result on an otherwise unused "discard" variable, I mean, if the programmer *really* wants to ignore the result, they can do it in many ways, ((warn_unused_result)) is to prevent programming mistakes where the programmer *meant* to look at the results but mistakenly forgot it... I also fail to see what else a void cast can mean other than explicitly indicating that the programmer *knows* the function returns a non-empty value but decided to ignore it... Anyways, let's not go on that rant again... If you get to implement the new attribute that would be awesome! Cheers, Filipe