public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Sebor <msebor@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-1819] PR middle-end/101216 - spurious notes for function calls Date: Fri, 25 Jun 2021 23:01:52 +0000 (GMT) [thread overview] Message-ID: <20210625230152.3FBB33857401@sourceware.org> (raw) https://gcc.gnu.org/g:fd51b344ca86c9673db0161d4a383cccdb2f429c commit r12-1819-gfd51b344ca86c9673db0161d4a383cccdb2f429c Author: Martin Sebor <msebor@redhat.com> Date: Fri Jun 25 17:01:01 2021 -0600 PR middle-end/101216 - spurious notes for function calls PR middle-end/101216 gcc/ChangeLog: * calls.c (maybe_warn_rdwr_sizes): Use the no_warning constant. gcc/testsuite/ChangeLog: * gcc.dg/Wnonnull-7.c: New test. Diff: --- gcc/calls.c | 6 +++--- gcc/testsuite/gcc.dg/Wnonnull-7.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gcc/calls.c b/gcc/calls.c index 27e8c451635..f8a4b79e7f8 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2054,7 +2054,7 @@ maybe_warn_rdwr_sizes (rdwr_map *rwm, tree fndecl, tree fntype, tree exp) *sizstr = '\0'; /* Set if a warning has been issued for the current argument. */ - opt_code arg_warned = N_OPTS; + opt_code arg_warned = no_warning; location_t loc = EXPR_LOCATION (exp); tree ptr = access.second.ptr; if (*sizstr @@ -2080,7 +2080,7 @@ maybe_warn_rdwr_sizes (rdwr_map *rwm, tree fndecl, tree fntype, tree exp) exp, sizidx + 1, sizstr)) arg_warned = OPT_Wstringop_overflow_; - if (arg_warned != N_OPTS) + if (arg_warned != no_warning) { append_attrname (access, attrstr, sizeof attrstr); /* Remember a warning has been issued and avoid warning @@ -2152,7 +2152,7 @@ maybe_warn_rdwr_sizes (rdwr_map *rwm, tree fndecl, tree fntype, tree exp) arg_warned = OPT_Wnonnull; } - if (arg_warned) + if (arg_warned != no_warning) { append_attrname (access, attrstr, sizeof attrstr); /* Remember a warning has been issued and avoid warning diff --git a/gcc/testsuite/gcc.dg/Wnonnull-7.c b/gcc/testsuite/gcc.dg/Wnonnull-7.c new file mode 100644 index 00000000000..e7b331a904c --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wnonnull-7.c @@ -0,0 +1,15 @@ +/* PR middle-end/101216 - spurious notes for function calls + { dg-do compile } + { dg-options "-O2 -w" } */ + +__attribute__ ((access (write_only, 1, 2))) char* +getcwd (char *, __SIZE_TYPE__); + +char* f (void) +{ + char a[8]; + return getcwd (0, 8); +} + +/* Expect no messages of any kind on output. + { dg-bogus "" "" { target *-*-* } 0 } */
reply other threads:[~2021-06-25 23:01 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210625230152.3FBB33857401@sourceware.org \ --to=msebor@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).