diff options
author | Bernd Schmidt <bernds@redhat.com> | 2016-01-13 20:03:26 +0000 |
---|---|---|
committer | Bernd Schmidt <bernds@gcc.gnu.org> | 2016-01-13 20:03:26 +0000 |
commit | 3342fd71e0465ab4a702480a35043b295fc6fa21 (patch) | |
tree | c35775b90eda0d70234de508315954e7ece5b4b0 /gcc/testsuite/c-c++-common | |
parent | 2ad3adf102641812fe09742f545f8565bebd74ac (diff) | |
download | gcc-3342fd71e0465ab4a702480a35043b295fc6fa21.zip gcc-3342fd71e0465ab4a702480a35043b295fc6fa21.tar.gz gcc-3342fd71e0465ab4a702480a35043b295fc6fa21.tar.bz2 |
Improve warning locations (PR66208)
PR c/66208
* c-common.c (check_function_nonnull): Remove unnecessary declaration.
Add new arg loc and pass it down as context.
(check_nonnull_arg): Don't mark ctx arg as unused. Use it as a pointer
to the location to use for the warning.
(check_function_arguments): New arg loc. All callers changed. Pass
it to check_function_nonnull.
* c-common.h (check_function_arguments): Adjust declaration.
testsuite/
PR c/66208
* c-c++-common/pr66208.c: New file.
From-SVN: r232345
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r-- | gcc/testsuite/c-c++-common/pr66208.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/pr66208.c b/gcc/testsuite/c-c++-common/pr66208.c new file mode 100644 index 0000000..d394c42 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr66208.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-Wnonnull" } */ + +void foox (char*, ...) __attribute__ ((nonnull (1))); +#define foo(p) foox (p, "p is null") /* { dg-warning "null argument" } */ + +void baz (void) +{ + foo (0); /* { dg-message "note: in expansion" } */ +} |