From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: attribute warn_unused_result Date: Sat, 05 Feb 2011 11:01:37 -0500 Message-ID: References: <83r5bobz2k.fsf@gnu.org> <4D4B4EEA.50907@cs.ucla.edu> <83hbckb3u4.fsf@gnu.org> <83pqr6amfh.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1296921713 4394 80.91.229.12 (5 Feb 2011 16:01:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 5 Feb 2011 16:01:53 +0000 (UTC) Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 05 17:01:49 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Plka4-0001X6-Kr for ged-emacs-devel@m.gmane.org; Sat, 05 Feb 2011 17:01:49 +0100 Original-Received: from localhost ([127.0.0.1]:48821 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Plka4-0001qm-2a for ged-emacs-devel@m.gmane.org; Sat, 05 Feb 2011 11:01:48 -0500 Original-Received: from [140.186.70.92] (port=59605 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PlkZz-0001qd-Ch for emacs-devel@gnu.org; Sat, 05 Feb 2011 11:01:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PlkZx-0007aD-RW for emacs-devel@gnu.org; Sat, 05 Feb 2011 11:01:43 -0500 Original-Received: from tomts16-srv.bellnexxia.net ([209.226.175.4]:36646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PlkZw-0007ZB-6L; Sat, 05 Feb 2011 11:01:40 -0500 Original-Received: from toip4.srvr.bell.ca ([209.226.175.87]) by tomts16-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20110205160138.WRIZ19437.tomts16-srv.bellnexxia.net@toip4.srvr.bell.ca>; Sat, 5 Feb 2011 11:01:38 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAOP9TE1GNcMI/2dsb2JhbAClMnO5e4VaBIR6ijWBfA Original-Received: from unknown (HELO ceviche.home) ([70.53.195.8]) by toip4.srvr.bell.ca with ESMTP; 05 Feb 2011 11:01:37 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 97FD9660DC; Sat, 5 Feb 2011 11:01:37 -0500 (EST) In-Reply-To: <83pqr6amfh.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 05 Feb 2011 10:57:22 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Solaris 8 (1) X-Received-From: 209.226.175.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:135618 Archived-At: >> > 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