[cfe-commits] r158683 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/Sema/inline.c test/SemaCXX/inline.cpp

Jordan Rose jordan_rose at apple.com
Wed Jun 20 14:34:20 PDT 2012


All right, will add another heuristic: if the function being used is also inline this gets downgraded to an Extension, not an ExtWarn.

(I have already disabled this completely in C++ mode, though.)

Jordan


On Jun 20, 2012, at 14:31 , Jim Grosbach <grosbach at apple.com> wrote:

> I'm seeing many, many warnings compiling LLVM with this warning, in particular from things like the ctype macros (isascii(), isupper(), et. al.). The common theme is static inline functions in headers. Consider:
> 
> $ cat fail.h
> static inline int foo() { return 0; }
> 
> class test {
> public:
>  int blah() const {
>    return foo();
>  }
> };
> $ cat fail.cpp
> #include "fail.h"
> $ clang++ fail.cpp -c
> In file included from fail.cpp:1:
> ./fail.h:6:12: warning: function 'foo' has internal linkage but is used in an inline method with external linkage [-Winternal-linkage-in-inline]
>    return foo();
>           ^
> ./fail.h:1:19: note: 'foo' declared here
> static inline int foo() { return 0; }
>                  ^
> 1 warning generated.
> 
> This strikes me as a false positive.
> 
> -Jim




More information about the cfe-commits mailing list