axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Clark (JIRA)" <>
Subject [jira] Created: (AXIS2C-252) Use __attribute__ ((warn_unused_result)) to detect failure to check function return values
Date Wed, 06 Sep 2006 06:38:22 GMT
Use __attribute__ ((warn_unused_result)) to detect failure to check function return values

                 Key: AXIS2C-252
             Project: Axis2-C
          Issue Type: Bug
    Affects Versions: Current (Nightly)
            Reporter: James Clark

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:

     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

          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.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message