================
@@ -2138,6 +2138,8 @@ static void handleConstructorAttr(Sema &S, Decl *D, const 
ParsedAttr &AL) {
   if (AL.getNumArgs() &&
       !S.checkUInt32Argument(AL, AL.getArgAsExpr(0), priority))
     return;
+  S.Diag(D->getLocation(), diag::warn_global_constructor)
----------------
AaronBallman wrote:

How I see it is:

>From GCC's docs: "The constructor attribute causes the function to be called 
>automatically before execution enters main ()."

And `-Wglobal-constructors` is meant to tell you "this has a constructor which 
will fire before main" which matters for global and thread local variables, so 
the `constructor` attribute is sort of morally equivalent.

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

Reply via email to