unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
Subject: Re: attribute warn_unused_result
Date: Sat, 05 Feb 2011 11:01:37 -0500	[thread overview]
Message-ID: <jwvfws2v5kn.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83pqr6amfh.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 05 Feb 2011 10:57:22 +0200")

>> > impossible to tell the compiler not to emit this warning by the
>> > "usual" C technique of using a cast.
>> Looks like a bug in gcc.  I'd be surprised if they accept this
>> qualification, but really what's the point of emitting a warning when
>> the user explicitly put a cast to void?
> You can google about this: the GCC maintainers explicitly think this
> isn't a bug, but a feature.  They say that the warning was provided to
> uncover the cases where lazy programmers cast function calls to void
> to avoid diagnostics, without considering the implications.

That's brain dead: lazy programmers don't bother to add a `void'.

> They say that if you don't want this warning, you should not declare
> functions with this attribute.

That's also brain dead: declaring functions with this attribute is
adding good information, so it should be done wherever possible and
should not come with any negative consequences such as "when you really
don't care about the result, then please obfuscate your code, oh and
keep an eye on it, because a future gcc version may try and be even more
clever in uncovering code obfuscation, so you'll have to obfuscate it
even more to avoid the warning".

Anyway... Richard, could you try and get the gcc people to their senses?

>> I don't see how/why you'd consider it a misfeature of glibc.
> See above.  It's glibc headers that declare the functions with this
> attribute.

And it's a good thing they do.

> Personally, I think it's wrong to force _FORTIFY_SOURCE on all the
> users of a general-purpose system, but that's me.

I think the wrong part is to force users to obfuscate their code.


        Stefan



      reply	other threads:[~2011-02-05 16:01 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03 14:57 attribute warn_unused_result Eli Zaretskii
2011-02-03 18:53 ` Stefan Monnier
2011-02-03 19:33   ` Paul Eggert
2011-02-03 20:42     ` Chad Brown
2011-02-03 21:30       ` Eli Zaretskii
2011-02-03 21:58         ` Paul Eggert
2011-02-04  0:17           ` Lennart Borgman
2011-02-04  8:18           ` Eli Zaretskii
2011-02-05 16:30             ` Chong Yidong
2011-02-03 21:40       ` Paul Eggert
2011-02-04  8:41         ` Eli Zaretskii
2011-02-04  8:51           ` Paul Eggert
2011-02-04 21:05         ` Stefan Monnier
2011-02-05  8:50           ` Eli Zaretskii
2011-02-03 21:47       ` Lennart Borgman
2011-02-04 21:08         ` Stefan Monnier
2011-02-04 21:15           ` Lennart Borgman
2011-02-05  9:03             ` Eli Zaretskii
2011-02-05  8:59           ` Eli Zaretskii
2011-02-03 22:08       ` Andy Moreton
2011-02-03 23:00         ` Paul Eggert
2011-02-03 21:16     ` Eli Zaretskii
2011-02-03 21:14   ` Eli Zaretskii
2011-02-04  0:57     ` Paul Eggert
2011-02-04  8:29       ` Eli Zaretskii
2011-02-04 15:50         ` Tom Tromey
2011-02-04 16:38           ` Eli Zaretskii
2011-02-04 17:12             ` Tom Tromey
2011-02-05  0:11             ` Paul Eggert
2011-02-05  9:18               ` Eli Zaretskii
     [not found]               ` <yyxvd0yxwv1.fsf@fencepost.gnu.org>
2011-02-06  1:34                 ` Paul Eggert
2011-02-06  4:07                   ` Eli Zaretskii
2011-02-06  7:04                     ` Paul Eggert
2011-02-06 10:21                       ` Eli Zaretskii
2011-02-06 18:58                         ` Paul Eggert
2011-02-06 19:27                           ` Eli Zaretskii
2011-02-06 20:11                             ` Paul Eggert
2011-02-06 21:26                               ` Eli Zaretskii
2011-02-04 21:14         ` Stefan Monnier
2011-02-05  8:57           ` Eli Zaretskii
2011-02-05 16:01             ` Stefan Monnier [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvfws2v5kn.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).