balazske wrote:

> We have the `cppcoreguidelines-interfaces-global-init` check, which seems to 
> be broadly similar to this one. Can you compare and contrast the two?

`cppcoreguidelines-interfaces-global-init` finds global variables that are 
initialized with another global variable that has no definition in the current 
TU. The new `misc-static-initialization-cycle` can find 2 or more global 
variables where all have initialization in the current TU and depend on each 
other. The `cppcoreguidelines-interfaces-global-init` is somewhat like an 
extension of the `misc-static-initialization-cycle` for the case when more TUs 
are involved. (Not exactly but to some extent.) Both checks can be related to 
CERT rule [DCL56-CPP. Avoid cycles during initialization of static 
objects](https://wiki.sei.cmu.edu/confluence/display/cplusplus/DCL56-CPP.+Avoid+cycles+during+initialization+of+static+objects).
 I actually planned to add later an option to the new check that would detect 
uninitialized global variables too, this is probably not needed 
(`cppcoreguidelines-interfaces-global-init` can be used instead).

https://github.com/llvm/llvm-project/pull/175342
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to