https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116729
Bug ID: 116729 Summary: [[maybe_unused]] doesn't prevent warning for unused function declarations Product: gcc Version: 14.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: himehaieto at gmail dot com Target Milestone: --- Created attachment 59118 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59118&action=edit unused.i In the attached code are two unused functions annotated with [[maybe_unused]] - one that is fully defined, and the other that is simply a forward declaration. The warning is properly suppressed for the defined function, but not the declared one. Both warnings are successfully suppressed when compiling with clang. Additional reproducibility information is included below. `uname -a`: Linux votocon 4.19.0-21-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64 GNU/Linux `lsb_release -a`: Distributor ID: Devuan Description: Devuan GNU/Linux 5 (daedalus) Release: 5 Codename: daedalus gcc configure options: ../../configure --prefix=/opt/gcc/14.2.0 --enable-lto compiler command/options: gcc --std=c23 -Wall unused.c