================
@@ -2363,8 +2356,11 @@ void InitListChecker::CheckStructUnionTypes(
   }
 
   // Emit warnings for missing struct field initializers.
-  if (!VerifyOnly && InitializedSomething && CheckForMissingFields &&
-      !RD->isUnion()) {
+  // This check is disabled for designated initializers in C.
+  // This matches gcc behaviour.
+  if (!VerifyOnly && InitializedSomething && !RD->isUnion() &&
+      !IList->isIdiomaticZeroInitializer(SemaRef.getLangOpts()) &&
+      !(HasDesignatedInit && !SemaRef.getLangOpts().CPlusPlus)) {
----------------
vvd170501 wrote:

@erichkeane, I did something like this before 
83864610d6b6470a0f229c516821d8344d994562, but this adds another indentation 
level.

It's possible to calculate `DisableCheck` before the `if` statement, but it'll 
probably be less optimal than the current solution - if `VerifyOnly` is true, 
`DisableCheck` is not needed.

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

Reply via email to