schrc3b6 added a comment.

In D111909#3069668 <https://reviews.llvm.org/D111909#3069668>, @whisperity 
wrote:

> Will `int I;` being in a header, with no initialiser, be caught?

Currently it will be caught.

  1 warning generated.
  ./foo.h:1:5: warning: variable 'i' defined in a header file; variable 
definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
  int i;

I guess you don't want that to be cought if it is actually a tentative 
definition. If I remember correctly for clang and gcc -fno-common is the 
default.
I think we could do one of two things here either create no warning if there is 
a VarDelc without initialization or we could try to detect common linkage.
I will have a look if I can detect a change from inside the checker if the 
linkage of the variable changes via the fcommon compiler flag.

> It would be interesting to add a test for this.

I will do so.

Thanks for the feedback.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111909/new/

https://reviews.llvm.org/D111909

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to