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")
+63
View File
@@ -4999,9 +4999,18 @@ wuffs_adler32__hasher__initialize(wuffs_adler32__hasher* self,
}
if ((initialize_flags & WUFFS_INITIALIZE__ALREADY_ZEROED) != 0) {
// The whole point of this if-check is to detect an uninitialized *self.
// We disable the warning on GCC. Clang-5.0 does not have this warning.
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
if (self->private_impl.magic != 0) {
return wuffs_base__error__initialize_falsely_claimed_already_zeroed;
}
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} else {
void* p = &(self->private_impl);
size_t n = sizeof(self->private_impl);
@@ -6010,9 +6019,18 @@ wuffs_crc32__ieee_hasher__initialize(wuffs_crc32__ieee_hasher* self,
}
if ((initialize_flags & WUFFS_INITIALIZE__ALREADY_ZEROED) != 0) {
// The whole point of this if-check is to detect an uninitialized *self.
// We disable the warning on GCC. Clang-5.0 does not have this warning.
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
if (self->private_impl.magic != 0) {
return wuffs_base__error__initialize_falsely_claimed_already_zeroed;
}
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} else {
void* p = &(self->private_impl);
size_t n = sizeof(self->private_impl);
@@ -6300,9 +6318,18 @@ wuffs_deflate__decoder__initialize(wuffs_deflate__decoder* self,
}
if ((initialize_flags & WUFFS_INITIALIZE__ALREADY_ZEROED) != 0) {
// The whole point of this if-check is to detect an uninitialized *self.
// We disable the warning on GCC. Clang-5.0 does not have this warning.
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
if (self->private_impl.magic != 0) {
return wuffs_base__error__initialize_falsely_claimed_already_zeroed;
}
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} else {
void* p = &(self->private_impl);
size_t n = sizeof(self->private_impl);
@@ -8098,9 +8125,18 @@ wuffs_lzw__decoder__initialize(wuffs_lzw__decoder* self,
}
if ((initialize_flags & WUFFS_INITIALIZE__ALREADY_ZEROED) != 0) {
// The whole point of this if-check is to detect an uninitialized *self.
// We disable the warning on GCC. Clang-5.0 does not have this warning.
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
if (self->private_impl.magic != 0) {
return wuffs_base__error__initialize_falsely_claimed_already_zeroed;
}
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} else {
void* p = &(self->private_impl);
size_t n = sizeof(self->private_impl);
@@ -8684,9 +8720,18 @@ wuffs_gif__decoder__initialize(wuffs_gif__decoder* self,
}
if ((initialize_flags & WUFFS_INITIALIZE__ALREADY_ZEROED) != 0) {
// The whole point of this if-check is to detect an uninitialized *self.
// We disable the warning on GCC. Clang-5.0 does not have this warning.
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
if (self->private_impl.magic != 0) {
return wuffs_base__error__initialize_falsely_claimed_already_zeroed;
}
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} else {
void* p = &(self->private_impl);
size_t n = sizeof(self->private_impl);
@@ -10862,9 +10907,18 @@ wuffs_gzip__decoder__initialize(wuffs_gzip__decoder* self,
}
if ((initialize_flags & WUFFS_INITIALIZE__ALREADY_ZEROED) != 0) {
// The whole point of this if-check is to detect an uninitialized *self.
// We disable the warning on GCC. Clang-5.0 does not have this warning.
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
if (self->private_impl.magic != 0) {
return wuffs_base__error__initialize_falsely_claimed_already_zeroed;
}
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} else {
void* p = &(self->private_impl);
size_t n = sizeof(self->private_impl);
@@ -11348,9 +11402,18 @@ wuffs_zlib__decoder__initialize(wuffs_zlib__decoder* self,
}
if ((initialize_flags & WUFFS_INITIALIZE__ALREADY_ZEROED) != 0) {
// The whole point of this if-check is to detect an uninitialized *self.
// We disable the warning on GCC. Clang-5.0 does not have this warning.
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
if (self->private_impl.magic != 0) {
return wuffs_base__error__initialize_falsely_claimed_already_zeroed;
}
#if !defined(__clang__) && defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
} else {
void* p = &(self->private_impl);
size_t n = sizeof(self->private_impl);