public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109755] New: -Wunused-function underline points at a class, not the unused method itself
@ 2023-05-06  7:17 slyfox at gcc dot gnu.org
  2023-05-06 17:24 ` [Bug c++/109755] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-05-06  7:17 UTC (permalink / raw)
  To: gcc-bugs

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/109755] -Wunused-function underline points at a class, not the unused method itself
  2023-05-06  7:17 [Bug c++/109755] New: -Wunused-function underline points at a class, not the unused method itself slyfox at gcc dot gnu.org
@ 2023-05-06 17:24 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-06 17:24 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-05-06
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, it is not just anonymous namespaces nor class methods..
Another example showing it happens with namespaces static functions too:
```
namespace g { static void f();}
static void g::f(){}
```

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-06 17:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-06  7:17 [Bug c++/109755] New: -Wunused-function underline points at a class, not the unused method itself slyfox at gcc dot gnu.org
2023-05-06 17:24 ` [Bug c++/109755] " pinskia at gcc dot gnu.org

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).