2
0
mirror of https://github.com/boostorg/nowide.git synced 2026-02-22 03:22:32 +00:00

Add BOOST_NOWIDE_FALLTHROUGH for Boost < 1.64

This commit is contained in:
Alexander Grund
2020-01-06 09:41:47 +01:00
parent 920e60c6da
commit ca2091a884
2 changed files with 12 additions and 5 deletions

View File

@@ -13,6 +13,7 @@
#include <boost/config.hpp>
#include <boost/nowide/replacement.hpp>
#include <boost/version.hpp>
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_NOWIDE_DYN_LINK)
#ifdef BOOST_NOWIDE_SOURCE
@@ -63,5 +64,11 @@
#define BOOST_NOWIDE_USE_FSTREAM_REPLACEMENTS 0
#endif
#if BOOST_VERSION < 106500 && defined(BOOST_GCC) && BOOST_GCC_VERSION >= 70000
#define BOOST_NOWIDE_FALLTHROUGH __attribute__((fallthrough))
#else
#define BOOST_NOWIDE_FALLTHROUGH BOOST_FALLTHROUGH
#endif
#endif // boost/nowide/config.hpp
// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4

View File

@@ -8,7 +8,7 @@
#ifndef BOOST_NOWIDE_UTF_HPP_INCLUDED
#define BOOST_NOWIDE_UTF_HPP_INCLUDED
#include <boost/config.hpp>
#include <boost/nowide/config.hpp>
#include <boost/cstdint.hpp>
namespace boost {
@@ -219,7 +219,7 @@ namespace nowide {
if(!is_trail(tmp))
return illegal;
c = (c << 6) | (tmp & 0x3F);
BOOST_FALLTHROUGH;
BOOST_NOWIDE_FALLTHROUGH;
case 2:
if(BOOST_UNLIKELY(p == e))
return incomplete;
@@ -227,7 +227,7 @@ namespace nowide {
if(!is_trail(tmp))
return illegal;
c = (c << 6) | (tmp & 0x3F);
BOOST_FALLTHROUGH;
BOOST_NOWIDE_FALLTHROUGH;
case 1:
if(BOOST_UNLIKELY(p == e))
return incomplete;
@@ -269,8 +269,8 @@ namespace nowide {
switch(trail_size)
{
case 3: c = (c << 6) | (static_cast<unsigned char>(*p++) & 0x3F); BOOST_FALLTHROUGH;
case 2: c = (c << 6) | (static_cast<unsigned char>(*p++) & 0x3F); BOOST_FALLTHROUGH;
case 3: c = (c << 6) | (static_cast<unsigned char>(*p++) & 0x3F); BOOST_NOWIDE_FALLTHROUGH;
case 2: c = (c << 6) | (static_cast<unsigned char>(*p++) & 0x3F); BOOST_NOWIDE_FALLTHROUGH;
case 1: c = (c << 6) | (static_cast<unsigned char>(*p++) & 0x3F);
}