public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "slyfox at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/109755] New: -Wunused-function underline points at a class, not the unused method itself
Date: Sat, 06 May 2023 07:17:47 +0000	[thread overview]
Message-ID: <bug-109755-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109755

            Bug ID: 109755
           Summary: -Wunused-function underline points at a class, not the
                    unused method itself
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Noticed when reduced example manually. Was a bit confused by an underline under
the class and not the method:

// $ cat a.cc
namespace {
    struct Foo {
        void m1();
        void m2();
    };
    void Foo::m1() {}
    void Foo::m2() {}
}

int main() {
    Foo o;
    o.m1();
}

$ gcc -c a.cc -Wall
a.cc:7:10: warning: 'void {anonymous}::Foo::m2()' defined but not used
[-Wunused-function]
    7 |     void Foo::m2() {}
      |          ^~~

Here it's not visible, but m2 is correctly highlighted in 'void
{anonymous}::Foo::m2()' string (good). But the underlying cursor points at the
'Foo' only. I think it should point at the whole 'Foo::m2' instead.

For example:

    7 |     void Foo::m2() {}
      |          ^~~~~~~

WDYT?

GCC is built from r14-539-g143e6695b20d35.

$ gcc -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-14.0.0/bin/gcc
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-14.0.0/libexec/gcc/x86_64-unknown-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 99999999 (experimental) (GCC)

             reply	other threads:[~2023-05-06  7:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-06  7:17 slyfox at gcc dot gnu.org [this message]
2023-05-06 17:24 ` [Bug c++/109755] " pinskia at gcc dot gnu.org

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=bug-109755-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).