Fznamznon wrote:
@mikaelholmen , thanks for the report. These warnings are kind of expected,
there is no big difference between `struct S1 s01 = { 1, {1} };` and `struct S1
s02 = { .d1.a = 1 };` in both cases field `b` of `d1` is not initialized. But
they are not expected for C, since we aim t
mikaelholmen wrote:
Hi @Fznamznon and others!
It looks like this patch not only avoids a false positive, but it also causes
warnigns on stuff it didn't warn on before.
So if I add the following to clang/test/Sema/missing-field-initializers.c
```
struct S1 {
long int l;
struct { int a, b; }
@@ -802,9 +845,25 @@ InitListChecker::FillInEmptyInitializations(const
InitializedEntity &Entity,
}
}
} else {
+ InitListExpr *SForm =
+ ILE->isSyntacticForm() ? ILE : ILE->getSyntacticForm();
// The fields beyond ILE->getNumInits() are d
@@ -727,6 +729,44 @@ void InitListChecker::FillInEmptyInitForField(unsigned
Init, FieldDecl *Field,
if (hadError || VerifyOnly) {
// Do nothing
} else if (Init < NumInits) {
zygoloid wrote:
Hm, right, we still call this with `Init >= NumInits` w
@@ -654,11 +655,17 @@ void InitListChecker::FillInEmptyInitForBase(
}
}
-void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field,
-const InitializedEntity &ParentEntity,
-
https://github.com/Fznamznon updated
https://github.com/llvm/llvm-project/pull/70829
>From ac30780250875802d13450d17e6959f9e2ad3a70 Mon Sep 17 00:00:00 2001
From: "Podchishchaeva, Mariya"
Date: Tue, 31 Oct 2023 09:27:51 -0700
Subject: [PATCH 1/2] [clang] Fix false positive -Wmissing-field-initi