From 4def9f12bec58e6c952361aac946fca80c27a3be Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 4 May 2009 21:00:57 +0200 Subject: Fixed a gcc 4.4 warning on switching a value outside the enum. These four enum values are used in variables of type Section, but aren't in it. With gcc 4.4, it displays a warning that the value is lower than the lowest value --- src/corelib/tools/qdatetime.cpp | 7 +++++++ src/corelib/tools/qdatetime_p.h | 14 ++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 09cc47f..7dd9060 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -4398,6 +4398,13 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const case DateSectionMask: qWarning("QDateTimeParser::sectionMaxSize: Invalid section %s", sectionName(s).toLatin1().constData()); + + case NoSectionIndex: + case FirstSectionIndex: + case LastSectionIndex: + case CalendarPopupIndex: + // these cases can't happen + break; } return -1; } diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h index ec931d3..3201958 100644 --- a/src/corelib/tools/qdatetime_p.h +++ b/src/corelib/tools/qdatetime_p.h @@ -138,13 +138,6 @@ public: PossibleBoth = 4 }; - enum { - NoSectionIndex = -1, - FirstSectionIndex = -2, - LastSectionIndex = -3, - CalendarPopupIndex = -4 - }; - enum Section { NoSection = 0x00000, AmPmSection = 0x00001, @@ -163,7 +156,12 @@ public: DateSectionMask = (DaySection|MonthSection|YearSection|YearSection2Digits|DayOfWeekSection), FirstSection = 0x02000|Internal, LastSection = 0x04000|Internal, - CalendarPopupSection = 0x08000|Internal + CalendarPopupSection = 0x08000|Internal, + + NoSectionIndex = -1, + FirstSectionIndex = -2, + LastSectionIndex = -3, + CalendarPopupIndex = -4 }; // duplicated from qdatetimeedit.h Q_DECLARE_FLAGS(Sections, Section) -- cgit v0.12