public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "filbranden at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/66425] (void) cast doesn't suppress __attribute__((warn_unused_result))
Date: Thu, 20 Aug 2015 06:05:00 -0000	[thread overview]
Message-ID: <bug-66425-4-2Nlw97xaiR@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66425-4@http.gcc.gnu.org/bugzilla/>

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


  parent reply	other threads:[~2015-08-20  6:05 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05  0:38 [Bug c/66425] New: " rusty at rustcorp dot com.au
2015-06-05  7:21 ` [Bug c/66425] " manu at gcc dot gnu.org
2015-06-11  0:51 ` filbranden at google dot com
2015-06-11  5:39 ` pinskia at gcc dot gnu.org
2015-06-11  5:52 ` koct9i at gmail dot com
2015-06-11  5:55 ` filbranden at google dot com
2015-06-11  6:06 ` pinskia at gcc dot gnu.org
2015-06-11  6:37 ` filbranden at google dot com
2015-06-11  6:46 ` filbranden at google dot com
2015-06-11  6:49 ` lucas.de.marchi at gmail dot com
2015-06-11  8:41 ` manu at gcc dot gnu.org
2015-06-11 14:10 ` schwab@linux-m68k.org
2015-06-11 14:25 ` manu at gcc dot gnu.org
2015-06-11 15:08 ` lucas.de.marchi at gmail dot com
2015-06-11 15:49 ` joseph at codesourcery dot com
2015-06-11 16:57 ` filbranden at google dot com
2015-06-14 17:29 ` segher at gcc dot gnu.org
2015-08-20  5:35 ` rusty at rustcorp dot com.au
2015-08-20  6:05 ` filbranden at google dot com [this message]
2020-03-28 11:07 ` pskocik at gmail dot com
2021-07-27 19:33 ` ndesaulniers at google dot com
2023-04-22 21:20 ` achurch+gcc at achurch dot org
2023-04-23  7:07 ` sjames at gcc dot gnu.org
2023-04-23  7:53 ` achurch+gcc at achurch dot org
2023-04-23 20:00 ` segher at gcc dot gnu.org
2023-04-23 21:51 ` achurch+gcc at achurch dot org
2023-04-23 22:03 ` pinskia at gcc dot gnu.org
2023-04-23 23:06 ` achurch+gcc at achurch dot org
2023-04-24  6:45 ` rusty at rustcorp dot com.au
2023-04-24  8:21 ` achurch+gcc at achurch dot org
2023-04-24  8:26 ` jakub at gcc dot gnu.org
2023-04-24  8:35 ` fw at gcc dot gnu.org
2023-04-24  9:06 ` segher at gcc dot gnu.org
2023-04-24  9:18 ` jengelh at inai dot de
2023-04-24  9:41 ` achurch+gcc at achurch dot org
2023-08-09 22:33 ` romato.san1337 at gmail dot com
2023-08-09 23:09 ` ed at catmur dot uk
2023-08-10  9:23 ` muecker at gwdg dot de
2023-08-10 12:25 ` romato.san1337 at gmail dot com
2023-08-10 18:12 ` ed at catmur dot uk
2023-08-17 13:09 ` romato.san1337 at gmail dot com
2023-09-06 11:07 ` segher at gcc dot gnu.org
2023-09-06 11:51 ` achurch+gcc at achurch dot org
2024-02-14 11:32 ` groessler_christian at yahoo dot de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-66425-4-2Nlw97xaiR@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).