Modify

Ticket #7644 (closed Bugs: fixed)

Opened 18 months ago

Last modified 17 months ago

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

Reported by: steven.lemay@… Owned by: johnmaddock
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

Change History

comment:1 Changed 17 months 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 17 months ago by johnmaddock

  • Status changed from new to closed
  • Resolution set to fixed

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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.