Return-Path: Delivered-To: apmail-ws-axis-c-dev-archive@www.apache.org Received: (qmail 53508 invoked from network); 2 Apr 2007 15:04:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Apr 2007 15:04:54 -0000 Received: (qmail 8983 invoked by uid 500); 2 Apr 2007 15:05:01 -0000 Delivered-To: apmail-ws-axis-c-dev-archive@ws.apache.org Received: (qmail 8955 invoked by uid 500); 2 Apr 2007 15:05:00 -0000 Mailing-List: contact axis-c-dev-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Apache AXIS C Developers List" Reply-To: "Apache AXIS C Developers List" Delivered-To: mailing list axis-c-dev@ws.apache.org Received: (qmail 8941 invoked by uid 99); 2 Apr 2007 15:05:00 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Apr 2007 08:05:00 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Apr 2007 08:04:52 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 48F7B714049 for ; Mon, 2 Apr 2007 08:04:32 -0700 (PDT) Message-ID: <27079398.1175526272265.JavaMail.jira@brutus> Date: Mon, 2 Apr 2007 08:04:32 -0700 (PDT) From: "Dinesh Premalal (JIRA)" To: axis-c-dev@ws.apache.org Subject: [jira] Commented: (AXIS2C-252) Use __attribute__ ((warn_unused_result)) to detect failure to check function return values In-Reply-To: <5896176.1157524702359.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AXIS2C-252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12486037 ] Dinesh Premalal commented on AXIS2C-252: ---------------------------------------- Do we want to add this attribute to the functions, that we expose to outside world. I think, it is enough to add it for internal functions. > Use __attribute__ ((warn_unused_result)) to detect failure to check function return values > ------------------------------------------------------------------------------------------ > > Key: AXIS2C-252 > URL: https://issues.apache.org/jira/browse/AXIS2C-252 > Project: Axis2-C > Issue Type: Bug > Affects Versions: Current (Nightly) > Reporter: James Clark > Fix For: 1.0.0 > > > I've noticed several cases where the return values of functions which should be checked aren't being checked. Things should be set up so that these cases can be detected automatically. I think the way to do this is to leverage gcc's warn_unused_result attribute. Here's the relevant excerpt from the gcc manual: > `warn_unused_result' > The `warn_unused_result' attribute causes a warning to be emitted > if a caller of the function with this attribute does not use its > return value. This is useful for functions where not checking the > result is either a security problem or always a bug, such as > `realloc'. > int fn () __attribute__ ((warn_unused_result)); > int foo () > { > if (fn () < 0) return -1; > fn (); > return 0; > } > results in warning on line 5. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org For additional commands, e-mail: axis-c-dev-help@ws.apache.org