From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1D6AB431FD0 for ; Thu, 22 Dec 2011 12:14:52 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CCiWpi9J6w23 for ; Thu, 22 Dec 2011 12:14:51 -0800 (PST) Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU [18.9.25.15]) by olra.theworths.org (Postfix) with ESMTP id 64C95431FB6 for ; Thu, 22 Dec 2011 12:14:51 -0800 (PST) X-AuditID: 1209190f-b7f8a6d000000914-54-4ef38fbaff34 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id EC.7D.02324.ABF83FE4; Thu, 22 Dec 2011 15:14:50 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id pBMKEnq1013291; Thu, 22 Dec 2011 15:14:50 -0500 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id pBMKEmqd005829 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Thu, 22 Dec 2011 15:14:49 -0500 (EST) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1Rdp3R-0000Ch-4Q; Thu, 22 Dec 2011 15:15:53 -0500 Date: Thu, 22 Dec 2011 15:15:53 -0500 From: Austin Clements To: David Edmondson Subject: Re: [RFC][PATCH] notmuch: Workaround to allow ignoring non-void function return. Message-ID: <20111222201553.GK10376@mit.edu> References: <1324503532-5799-1-git-send-email-dme@dme.org> <20111222070345.GI10376@mit.edu> <20111222190305.GA324@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmplleLIzCtJLcpLzFFi42IR4hRV1t3V/9nP4PZGHYt9d7YwWVy/OZPZ gclj1/O/TB7PVt1iDmCK4rJJSc3JLEst0rdL4MqYfOQbW8Fp7oorHe9ZGhjfc3QxcnJICJhI TLx5hw3CFpO4cG89kM3FISSwj1Fi9amrjBDOBkaJye+eQ2VOMkl8e/oDylnCKLHt3VVWkH4W AVWJ98t/gc1iE9CQ2LZ/OSOILSKgKPH/2wp2EJtZQFri2+9mJhBbWCBa4uqP4ywgNq+AjsSr 5+9YIYY+YpSYOHkBE0RCUOLkzCcsEM1aEjf+vQSKc4ANWv4P7AdOARuJqW1HwOaLCqhITDm5 jW0Co9AsJN2zkHTPQuhewMi8ilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdELzezRC81pXQTIzi0 Jfl3MH47qHSIUYCDUYmHt7Los58Qa2JZcWXuIUZJDiYlUV6dPqAQX1J+SmVGYnFGfFFpTmrx IUYJDmYlEd4KRqAcb0piZVVqUT5MSpqDRUmcV03rnZ+QQHpiSWp2ampBahFMVoaDQ0mCNxUY w0KCRanpqRVpmTklCGkmDk6Q4TxAwyNAaniLCxJzizPTIfKnGBWlxHndQBICIImM0jy4Xljq ecUoDvSKMK8ySBUPMG3Bdb8CGswENHib8weQwSWJCCmpBsYpPpWqB+LCL39KPvXw/w59Sz4F fw7NQxNn9k1+Kj034vd+F+bFqZEb9e2e/g+1VjoaufcFt39uuqZ+iNjz+REimT3Hana6fu5w mnPO4H/A9xcM0x1NP38+F9LyujQ45l520vo9VYcPfN1Z+aRKI5v971pWi+UfO5ybjxxvcjSN CvPS4+ns/6rEUpyRaKjFXFScCABu8T57GAMAAA== Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2011 20:14:52 -0000 Quoth David Edmondson on Dec 22 at 7:25 pm: > On Thu, 22 Dec 2011 14:03:05 -0500, Austin Clements wrote: > > > In general I agree, but what would we do if writing an error message to > > > stderr fails? > > > > This was discussed on IRC, but calls to write(2) should never be bare. > > I believe it's marked warn_unused_result not because libc is so > > concerned with people checking for error returns (otherwise all sorts > > of things would be marked warn_unused_result) but because even a > > successful write can be a short write. Hence, not checking the result > > is a bug, even if you don't care about errors. > > As I said, the principle is sound. What would do in this specific case? > > static void > handle_sigint (unused (int sig)) > { > static char msg[] = "Stopping... \n"; > > write(2, msg, sizeof(msg)-1); > interrupted = 1; > } > > Just this? > > if (write(2, msg, sizeof(msg)-1) { > /* Appease the compiler. */; > } Maybe I missed something, but what's wrong with using a standard write loop (like j4ni suggested on IRC)? In my mind this isn't about appeasing the compiler; the compiler is pointing out a real bug. Patch coming in a moment... I'm not sure what to do about the specific case of fwrite, though judging by http://sourceware.org/bugzilla/show_bug.cgi?id=11959 I'm not the only person who thinks that fwrite being warn_unused_result is odd.