[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 4 07:44:03 PDT 2016
bkramer added inline comments.
Comment at: test/clang-tidy/google-global-names.cpp:13-14
@@ +12,4 @@
+// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'i' declared in the global namespace
+extern int ii = 0;
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'ii' declared in the global namespace
> This strikes me as being intentional enough to warrant not diagnosing because of the `extern` keyword.
The only case I see where this pattern is valuable is interfacing with C code. Not sure yet if we want to allow that or enforce extern "C" instead. Ideas?
an extern global in the global namespace still feels like something we should warn on :|
More information about the cfe-commits