This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] __attribute__((nonnull))


On Thu, May 23, 2002 at 12:53:18AM +0100, Joseph S. Myers wrote:

 > The functions nonnull_check_p and check_nonnull_arg need comments 
 > explaining what they do.

Ok, added some additional comments in a few other places, as well.

 > It looks like, if a function has more than one nonnull attribute, only one
 > gets used for checking.  While giving more than one such attribute to a
 > function may not be very useful - since multiple arguments can get
 > specified in one attribute - they should all be used if more than one is
 > given.

D'oh, yup.  Fixed, and testsuite updated to test multiple attributes.

       * c-common.c (warn_nonnull): Declare.
       (c_common_attribute_table): Add "nonnull" attribute.
       (handle_nonnull_attribute, check_function_nonnull, nonnull_check_p,
       check_nonnull_arg, get_nonnull_operand, check_function_arguments,
       check_function_arguments_recurse): New functions.
       * c-common.h (warn_nonnull): Declare extern.
       (check_function_arguments, check_function_arguments_recurse): New
       prototypes.
       * c-decl.c (c_decode_option): Add -Wnonnull option.
       * c-format.c (set_Wformat): Set warn_nonnull if enabling
       format checking.
       (format_check_context): New structure.
       (check_format_info_recurse): Remove recursion and rename to...
       (check_format_arg): ...this.  Update comment.
       (check_format_info): Use check_function_arguments_recurse.
       * c-typeck.c (build_function_call): Call check_function_arguments
       instead of check_function_format.
       * doc/extend.texi: Document "nonnull" attribute.
       * doc/invoke.texi: Docuemnt -Wnonnull option.
       * testsuite/gcc.dg/nonnull-1.c: New test.
       * testsuite/gcc.dg/nonnull-2.c: New test.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

Attachment: nonnull-patch-5
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]