mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Enable -Wpedantic, fix unconditional use of C++14 extension
This commit is contained in:
parent
4be81d3588
commit
ba6d33fb8c
@ -332,7 +332,7 @@ if (BUILD_TESTING AND NOT_SUBPROJECT)
|
|||||||
|
|
||||||
# Add desired warnings
|
# Add desired warnings
|
||||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
|
||||||
target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code )
|
target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code -Wpedantic)
|
||||||
if (CATCH_ENABLE_WERROR)
|
if (CATCH_ENABLE_WERROR)
|
||||||
target_compile_options( SelfTest PRIVATE -Werror)
|
target_compile_options( SelfTest PRIVATE -Werror)
|
||||||
endif()
|
endif()
|
||||||
|
@ -15,6 +15,13 @@
|
|||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
const uint32_t byte_2_lead = 0xC0;
|
||||||
|
const uint32_t byte_3_lead = 0xE0;
|
||||||
|
const uint32_t byte_4_lead = 0xF0;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
StringRef::StringRef( char const* rawChars ) noexcept
|
StringRef::StringRef( char const* rawChars ) noexcept
|
||||||
@ -79,13 +86,12 @@ namespace Catch {
|
|||||||
// Make adjustments for uft encodings
|
// Make adjustments for uft encodings
|
||||||
for( size_type i=0; i < m_size; ++i ) {
|
for( size_type i=0; i < m_size; ++i ) {
|
||||||
char c = m_start[i];
|
char c = m_start[i];
|
||||||
if( ( c & 0b11000000 ) == 0b11000000 ) {
|
if( ( c & byte_2_lead ) == byte_2_lead ) {
|
||||||
if( ( c & 0b11100000 ) == 0b11000000 )
|
noChars--;
|
||||||
|
if (( c & byte_3_lead ) == byte_3_lead )
|
||||||
|
noChars--;
|
||||||
|
if( ( c & byte_4_lead ) == byte_4_lead )
|
||||||
noChars--;
|
noChars--;
|
||||||
else if( ( c & 0b11110000 ) == 0b11100000 )
|
|
||||||
noChars-=2;
|
|
||||||
else if( ( c & 0b11111000 ) == 0b11110000 )
|
|
||||||
noChars-=3;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return noChars;
|
return noChars;
|
||||||
|
Loading…
Reference in New Issue
Block a user