whisperity added a comment.

It would be interesting to add a test for this. I've recently came across the 
fact that Clang doesn't support //common linkage// definitions, namely that in 
**C** (but not in C++), if you do the following:

  int I;
  void f1(void) {}



  int I;
  void f2(void) {}

and compile these two source files and link them together, the two `I`s will 
refer in the resulting binary to the same symbol. (You must not put an 
initialiser here!) Will `int I;` being in a header, with no initialiser, be 
caught?



================
Comment at: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h:26
+///   - `CheckCCode`: Adds C99 to the minimum Language Requirements for this
+///     Checker. Disabled by default because this Checker wasn't build for C.
 ///   - `HeaderFileExtensions`: a semicolon-separated list of filename
----------------



================
Comment at: 
clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst:109
+   When `true` C99 is added to the minimum language requirements for this 
+   Cecker. Default is `false` because this Checker was not build for C.
----------------



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