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

            Bug ID: 100343
           Summary: add -Wundefined-inline for inline function is used but
                    not defined
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

Clang provides -Wundefined-inline to control the warning about used inline
functions for which no definition has been provided.  GCC doesn't provide any
option to control the warning.  This is a request to add -Wundefined-inline
with the same effect as in Clang, both in C++ and in C.

$ (set -x && cat t.C && clang -S -Wall t.C && gcc -S -Wall t.C)
+ cat t.C
inline int f ();
int g () { return f (); }
+ clang -S -Wall t.C
t.C:1:12: warning: inline function 'f' is not defined [-Wundefined-inline]
inline int f ();
           ^
t.C:2:19: note: used here
int g () { return f (); }
                  ^
1 warning generated.
+ /build/gcc-master/gcc/xgcc -B /build/gcc-master/gcc -S -Wall t.C
t.C:1:12: warning: inline function ‘int f()’ used but never defined
    1 | inline int f ();
      |            ^

Reply via email to