Suppress all -Wmissing-field-initializers in the test suite

There were many dozens of such warnings given for the various arrays
used in the tests and it just doesn't seem feasible nor desirable to fix
them all, so just suppress the warnings for all these arrays to get rid
of them with recent (7+?) versions of gcc.
This commit is contained in:
Vadim Zeitlin
2019-02-02 17:25:37 +01:00
parent 9a7a89b7b2
commit 2a907769fb
3 changed files with 40 additions and 0 deletions

View File

@@ -299,6 +299,8 @@ void CmdLineTestCase::ArgumentsCollection()
void CmdLineTestCase::Usage()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
// check that Usage() returns roughly what we expect (don't check all the
// details, its format can change in the future)
static const wxCmdLineEntryDesc desc[] =
@@ -319,6 +321,8 @@ void CmdLineTestCase::Usage()
{ wxCMD_LINE_NONE }
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
wxCmdLineParser p(desc);
const wxArrayString usageLines = wxSplit(p.GetUsageString(), '\n');
@@ -348,6 +352,8 @@ void CmdLineTestCase::Usage()
void CmdLineTestCase::Found()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const wxCmdLineEntryDesc desc[] =
{
{ wxCMD_LINE_SWITCH, "v", "verbose", "be verbose" },
@@ -359,6 +365,8 @@ void CmdLineTestCase::Found()
{ wxCMD_LINE_NONE }
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
wxCmdLineParser p(desc);
p.SetCmdLine ("-v --output hello -s 2 --date=2014-02-17 -f 0.2 input-file.txt");

View File

@@ -699,6 +699,8 @@ void DateTimeTestCase::TestTimeFormat()
3*3600 + 30*60
};
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const Date formatTestDates[] =
{
{ 29, wxDateTime::May, 1976, 18, 30, 00, 0.0, wxDateTime::Inv_WeekDay },
@@ -717,6 +719,8 @@ void DateTimeTestCase::TestTimeFormat()
#endif
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
for ( unsigned idxtz = 0; idxtz < WXSIZEOF(timeZonesOffsets); ++idxtz )
{
wxDateTime::TimeZone tz(timeZonesOffsets[idxtz]);
@@ -917,6 +921,8 @@ void DateTimeTestCase::TestTimeParse()
void DateTimeTestCase::TestTimeZoneParse()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct
{
const char *str;
@@ -964,6 +970,8 @@ void DateTimeTestCase::TestTimeZoneParse()
{ "17:37+04:0" },
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
for ( size_t n = 0; n < WXSIZEOF(parseTestTimeZones); ++n )
{
wxDateTime dt;
@@ -986,6 +994,8 @@ void DateTimeTestCase::TestTimeZoneParse()
void DateTimeTestCase::TestTimeSpanFormat()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct TimeSpanFormatTestData
{
long h, min, sec, msec;
@@ -1009,6 +1019,8 @@ void DateTimeTestCase::TestTimeSpanFormat()
{ 0, 0, -1, 0, "%H:%M:%S", "-00:00:01" },
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
for ( size_t n = 0; n < WXSIZEOF(testSpans); n++ )
{
const TimeSpanFormatTestData& td = testSpans[n];
@@ -1037,6 +1049,8 @@ void DateTimeTestCase::TestTimeTicks()
// test parsing dates in RFC822 format
void DateTimeTestCase::TestParseRFC822()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct ParseTestData
{
const char *rfc822;
@@ -1081,6 +1095,8 @@ void DateTimeTestCase::TestParseRFC822()
},
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
for ( unsigned n = 0; n < WXSIZEOF(parseTestDates); n++ )
{
const char * const datestr = parseTestDates[n].rfc822;
@@ -1109,6 +1125,8 @@ void DateTimeTestCase::TestParseRFC822()
// test parsing dates in free format
void DateTimeTestCase::TestDateParse()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct ParseTestData
{
const char *str;
@@ -1129,6 +1147,8 @@ void DateTimeTestCase::TestDateParse()
{ "2 . . " },
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
// special cases
wxDateTime dt;
CPPUNIT_ASSERT( dt.ParseDate(wxT("today")) );
@@ -1164,6 +1184,8 @@ void DateTimeTestCase::TestDateParse()
void DateTimeTestCase::TestDateParseISO()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct
{
const char *str;
@@ -1199,6 +1221,8 @@ void DateTimeTestCase::TestDateParseISO()
{ "" },
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
for ( size_t n = 0; n < WXSIZEOF(parseTestDates); n++ )
{
wxDateTime dt;
@@ -1238,6 +1262,8 @@ void DateTimeTestCase::TestDateParseISO()
void DateTimeTestCase::TestDateTimeParse()
{
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct ParseTestData
{
const char *str;
@@ -1270,6 +1296,8 @@ void DateTimeTestCase::TestDateTimeParse()
},
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
// the test strings here use "PM" which is not available in all locales so
// we need to use "C" locale for them
CLocaleSetter cloc;

View File

@@ -612,6 +612,8 @@ typedef wxLongLong_t TestValue_t;
typedef long TestValue_t;
#endif
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
static const struct ToLongData
{
const wxChar *str;
@@ -667,6 +669,8 @@ static const struct ToLongData
{ wxT("0x11"), 17, Number_Ok, 16 },
};
wxGCC_WARNING_RESTORE(missing-field-initializers)
void StringTestCase::ToLong()
{
long l;