diff options
author | Jason Thorpe <thorpej@wasabisystems.com> | 2002-05-23 15:48:05 +0000 |
---|---|---|
committer | Jason Thorpe <thorpej@gcc.gnu.org> | 2002-05-23 15:48:05 +0000 |
commit | b34c78814983ef7dcb1b6baacb335836c960ac15 (patch) | |
tree | ec1ff9d3e5c1ac88998d2453691cca3c42bc0416 /gcc/c-common.h | |
parent | 9547983155087b81454e9149ad37c2945f8137b9 (diff) | |
download | gcc-b34c78814983ef7dcb1b6baacb335836c960ac15.zip gcc-b34c78814983ef7dcb1b6baacb335836c960ac15.tar.gz gcc-b34c78814983ef7dcb1b6baacb335836c960ac15.tar.bz2 |
c-common.c (warn_nonnull): Declare.
* 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.
From-SVN: r53790
Diffstat (limited to 'gcc/c-common.h')
-rw-r--r-- | gcc/c-common.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/c-common.h b/gcc/c-common.h index 320d03d..834d785 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -426,6 +426,11 @@ extern int warn_format_nonliteral; extern int warn_format_security; +/* Warn about NULL being passed to argument slots marked as requiring + non-NULL. */ + +extern int warn_nonnull; + /* Warn about possible violations of sequence point rules. */ extern int warn_sequence_point; @@ -522,6 +527,12 @@ extern const char *fname_as_string PARAMS ((int)); extern tree fname_decl PARAMS ((unsigned, tree)); extern const char *fname_string PARAMS ((unsigned)); +extern void check_function_arguments PARAMS ((tree, tree)); +extern void check_function_arguments_recurse PARAMS ((void (*) (void *, + tree, + unsigned HOST_WIDE_INT), + void *, tree, + unsigned HOST_WIDE_INT)); extern void check_function_format PARAMS ((int *, tree, tree)); extern void set_Wformat PARAMS ((int)); extern tree handle_format_attribute PARAMS ((tree *, tree, tree, |