================
@@ -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)) {
----------------
erichkeane wrote:

I'm not asking to add a level/'if'.  I'm asking for declaring a set of bools 
above this 'if' that better reflect what is being tested.  With 
HasDesignatedInit/CPlusPlus checks only being vaguely related, and the 'sort' 
of the checks not really being clear, I am asking for the list of '!'s to be 
shorter/grouped into a couple of 'bools' with descriptive names.

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