pascalj wrote:

Thanks for your feedback!

>     * what about "static" non const global variables

Good point, forgot about these. If both are allowed, it is more about the 
internal linkage than it is about the namespace. I renamed the option to 
`AllowInternalLinkage` and permit variables in anonymous namespaces and static 
global variables, since they're equivalent (AFAICT). 

> I'm fine for having an options that control behavior of the check. But please 
> note that there are other aspects of "I.2: Avoid non-const global variables" 
> rule that anonymous namespace or static does not solve. Like race-conditions 
> in multithread env. Or even to force developer not to use global objects to 
> pass data between functions.
> 
> Even that I see many times that warnings from this check are being nolinted, 
> I still think that it's doing good job.

I completely agree with both you and @carlosgalvezp: this is neither an option 
that should be enabled by default, nor should people prefer it over nolinting 
without some thought. However, I see not much harm in giving someone the choice 
to do so. In the end, all of clang-tidy's checks are optional to some degree.

Having said that: if the maintainers prefer not to have this option, this is 
also fine with me.

https://github.com/llvm/llvm-project/pull/93827
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to