[libcxx] r246150 - Remove a switch statement, and replace with a bunch of ifs to silence a warning about 'all the enumeration values covered'. No functional change.

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 27 08:42:12 PDT 2015


On Aug 27, 2015 7:38 AM, "Marshall Clow via cfe-commits" <
cfe-commits at lists.llvm.org> wrote:
>
> Author: marshall
> Date: Thu Aug 27 09:37:22 2015
> New Revision: 246150
>
> URL: http://llvm.org/viewvc/llvm-project?rev=246150&view=rev
> Log:
> Remove a switch statement, and replace with a bunch of ifs to silence a
warning about 'all the enumeration values covered'. No functional change.

Just for the record you can also supports this'd warning by casting the
switch expression to an integer type. (If I've correctly understood the
warning your getting)

>
> Modified:
>     libcxx/trunk/include/locale
>
> Modified: libcxx/trunk/include/locale
> URL:
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=246150&r1=246149&r2=246150&view=diff
>
==============================================================================
> --- libcxx/trunk/include/locale (original)
> +++ libcxx/trunk/include/locale Thu Aug 27 09:37:22 2015
> @@ -4316,18 +4316,9 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::s
>      int __width = __cv_->encoding();
>      if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) ||
sync())
>          return pos_type(off_type(-1));
> -    // __width > 0 || __off == 0
> -    switch (__way)
> -    {
> -    case ios_base::beg:
> -        break;
> -    case ios_base::cur:
> -        break;
> -    case ios_base::end:
> -        break;
> -    default:
> +    // __width > 0 || __off == 0, now check __way
> +    if (__way != ios_base::beg && __way != ios_base::cur && __way !=
ios_base::end)
>          return pos_type(off_type(-1));
> -    }
>      pos_type __r = __bufptr_->pubseekoff(__width * __off, __way, __om);
>      __r.state(__st_);
>      return __r;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150827/0d02b2ac/attachment.html>


More information about the cfe-commits mailing list