Disable -Wmaybe-uninitialized for GCC

This commit is contained in:
Nigel Tao committed 2019-02-24 17:22:14 +11:00
1 parent ffeb2bff63
commit fbd1ae8391
2 files changed
+72

No files matched your search

+9
View File
@@ -1006,9 +1006,18 @@ func (g *gen) writeInitializerImpl(b *buffer, n *a.Struct) error {
b.writes("}\n\n")
b.writes("if ((initialize_flags & WUFFS_INITIALIZE__ALREADY_ZEROED) != 0) {\n")
b.writes(" // The whole point of this if-check is to detect an uninitialized *self.\n")
b.writes(" // We disable the warning on GCC. Clang-5.0 does not have this warning.\n")
b.writes(" #if !defined(__clang__) && defined(__GNUC__)\n")
b.writes(" #pragma GCC diagnostic push\n")
b.writes(" #pragma GCC diagnostic ignored \"-Wmaybe-uninitialized\"\n")
b.writes(" #endif\n")
b.writes(" if (self->private_impl.magic != 0) {\n")
b.writes(" return wuffs_base__error__initialize_falsely_claimed_already_zeroed;\n")
b.writes(" }\n")
b.writes(" #if !defined(__clang__) && defined(__GNUC__)\n")
b.writes(" #pragma GCC diagnostic pop\n")
b.writes(" #endif\n")
b.writes("} else {\n")
b.writes(" void* p = &(self->private_impl);\n")
b.writes(" size_t n = sizeof(self->private_impl);\n")