Modify

Opened 5 years ago

Closed 5 years ago

#7644 closed Bugs (fixed)

[-Wswitch] warnings with gcc 4.7.2 with C++11 enabled.

Reported by: steven.lemay@… Owned by: John Maddock
Milestone: To Be Determined Component: regex
Version: Boost 1.52.0 Severity: Problem
Keywords: -Wswitch Cc:

Description

In file included from ./boost/regex/v4/regex_traits.hpp:39:0,

from ./boost/regex/regex_traits.hpp:27, from ./boost/regex/v4/regex.hpp:39, from ./boost/regex.hpp:31, from libs\regex\build\..\src\winstances.cpp:30:

./boost/regex/v4/cpp_regex_traits.hpp: In instantiation of 'boost::re_detail::parser_buf<charT, traits>::pos_type boost::re_detail::parser_buf<charT, traits>::seekoff(boost::re_detail::parser_buf<charT, traits>::off_type, std::_Iosb<int>::seekdir, std::_Iosb<int>::openmode) [with charT = wchar_t; traits = std::char_traits<wchar_t>; boost::re_detail::parser_buf<charT, traits>::pos_type = std::fpos<_Mbstatet>; boost::re_detail::parser_buf<charT, traits>::off_type = long int; std::_Iosb<int>::seekdir = std::_Iosb<int>::_Seekdir; std::_Iosb<int>::openmode = std::_Iosb<int>::_Openmode]': ./boost/regex/v4/regex_split.hpp:168:1: required from here ./boost/regex/v4/cpp_regex_traits.hpp:117:4: warning: case value '0' not in enumerated type 'std::_Iosb<int>::seekdir {aka std::_Iosb<int>::_Seekdir}' [-Wswitch] ./boost/regex/v4/cpp_regex_traits.hpp:129:4: warning: case value '1' not in enumerated type 'std::_Iosb<int>::seekdir {aka std::_Iosb<int>::_Seekdir}' [-Wswitch] ./boost/regex/v4/cpp_regex_traits.hpp:123:4: warning: case value '2' not in enumerated type 'std::_Iosb<int>::seekdir {aka std::_Iosb<int>::_Seekdir}' [-Wswitch]

Attachments (0)

Change History (2)

comment:1 Changed 5 years ago by tvaneerd@…

ie:

--- a/boost/regex/v4/cpp_regex_traits.hpp
+++ b/boost/regex/v4/cpp_regex_traits.hpp
@@ -112,7 +112,10 @@ parser_buf<charT, traits>::seekoff(off_type off, ::std::ios_base::seekdir way, :
    std::ptrdiff_t size = this->egptr() - this->eback();
    std::ptrdiff_t pos = this->gptr() - this->eback();
    charT* g = this->eback();
-   switch(way)
+
+   // cast to avoid gcc '-Wswitch',
+   // as ios_base::beg/cur/end are not necesssarily values of 'way' enum type ios_base::seekdir
+   switch(static_cast<int>(way))
    {
    case ::std::ios_base::beg:
       if((off < 0) || (off > size))}}}

comment:2 Changed 5 years ago by John Maddock

Resolution: fixed
Status: newclosed

(In [81620]) Suppress GCC warning and update History log. Regenerate docs. Fixes #7644.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Maddock.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.