From 955b3b84dd2dadd539dbc707c26c33ad3e63b374 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Mon, 6 Dec 2021 16:31:02 +0100 Subject: Fixes for new compiler versions --- Makefile | 18 +++++++++--------- msbuild/compiler.props | 4 ++++ msbuild/libunicode.vcxproj | 6 ------ msbuild/recode.vcxproj | 10 ---------- msbuild/test-unicode.vcxproj | 4 ---- msbuild/validate.vcxproj | 6 ------ src/test-unicode.cpp | 26 ++++++++++++++++++++------ 7 files changed, 33 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index f3f072f..50c49b6 100644 --- a/Makefile +++ b/Makefile @@ -3,30 +3,30 @@ VERSION=$(shell dpkg-parsechangelog --show-field Version) DISTROS=base debian10 ubuntu2004 ubuntu2010 -ifeq ($(wildcard $(shell which clang++-11)),) +ifeq ($(wildcard $(shell which clang++-13)),) ifeq ($(wildcard $(shell which clang++)),) -CXX=g++-10 +CXX=g++-11 else CXX=clang++ endif else -CXX=clang++-11 +CXX=clang++-13 endif # boost is buggy for C++20: error: static_assert failed due to requirement 'detail::is_endian_reversible_inplace -#STANDARD=c++17 -STANDARD=c++20 +STANDARD=c++17 +#STANDARD=c++20 ifeq ($(CXXFLAGS),) -CXXFLAGS=-O0 -g -D_DEBUG -#CXXFLAGS=-O2 -DNDEBUG +#CXXFLAGS=-O0 -g -D_DEBUG +CXXFLAGS=-O2 -DNDEBUG endif CXXFLAGS+=-Wall -Iinclude -std=$(STANDARD) -ifeq ($(CXX),clang++-11) +ifeq ($(CXX),clang++-13) COMPILER_SUITE=clang -LIBS+=-fuse-ld=lld-11 +LIBS+=-fuse-ld=lld-13 endif ifeq ($(CXX),clang++) diff --git a/msbuild/compiler.props b/msbuild/compiler.props index dba065a..fe06776 100644 --- a/msbuild/compiler.props +++ b/msbuild/compiler.props @@ -4,7 +4,11 @@ D:\ext\winnt\boost\boost-1_77_0;..\include;%(AdditionalIncludeDirectories) /utf-8 /D NOMINMAX /FS %(AdditionalOptions) + /Zc:__cplusplus %(AdditionalOptions) stdcpp20 + true + true + Level3 diff --git a/msbuild/libunicode.vcxproj b/msbuild/libunicode.vcxproj index 22b75c1..f5387c3 100644 --- a/msbuild/libunicode.vcxproj +++ b/msbuild/libunicode.vcxproj @@ -51,11 +51,8 @@ - Level3 true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - stdcpp17 Console @@ -64,13 +61,10 @@ - Level3 true true true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - stdcpp17 Console diff --git a/msbuild/recode.vcxproj b/msbuild/recode.vcxproj index 4f3de3f..b0547cf 100644 --- a/msbuild/recode.vcxproj +++ b/msbuild/recode.vcxproj @@ -52,36 +52,26 @@ - Level3 true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - stdcpp17 Console true - - - Level3 true true true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - stdcpp17 Console true true true - - diff --git a/msbuild/test-unicode.vcxproj b/msbuild/test-unicode.vcxproj index 3f17ef3..144635e 100644 --- a/msbuild/test-unicode.vcxproj +++ b/msbuild/test-unicode.vcxproj @@ -53,10 +53,8 @@ - Level3 true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true /bigobj %(AdditionalOptions) @@ -66,12 +64,10 @@ - Level3 true true true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true Console diff --git a/msbuild/validate.vcxproj b/msbuild/validate.vcxproj index febeb56..66542d0 100644 --- a/msbuild/validate.vcxproj +++ b/msbuild/validate.vcxproj @@ -52,11 +52,8 @@ - Level3 true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - stdcpp17 Console @@ -67,13 +64,10 @@ - Level3 true true true NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - stdcpp17 Console diff --git a/src/test-unicode.cpp b/src/test-unicode.cpp index b5b48f0..ef68e02 100644 --- a/src/test-unicode.cpp +++ b/src/test-unicode.cpp @@ -39,11 +39,19 @@ std::vector success_sets { // Error cases: throwing upon convert to all other types std::vector> failure_strings_char8_t { // using u8"" here doesn't work on MSVC - u8"\x80", // utf-8 continuation byte - u8"\x81", // utf-8 continuation byte - u8"\xc3\xc3\xa4", // initial byte of utf-8 "ä", followed by valid utf-8 "ä" - u8"\xF8\x80\x80\x80\x80", // overlong encoding - u8"\xF7\xBF\xBF\xBF", // valid encoding of invalid code point +#if (__cplusplus >= 202002L) + (char8_t*)"\x80", // utf-8 continuation byte + (char8_t*)"\x81", // utf-8 continuation byte + (char8_t*)"\xc3\xc3\xa4", // initial byte of utf-8 "ä", followed by valid utf-8 "ä" + (char8_t*)"\xF8\x80\x80\x80\x80", // overlong encoding + (char8_t*)"\xF7\xBF\xBF\xBF", // valid encoding of invalid code point +#else + "\x80", // utf-8 continuation byte + "\x81", // utf-8 continuation byte + "\xc3\xc3\xa4", // initial byte of utf-8 "ä", followed by valid utf-8 "ä" + "\xF8\x80\x80\x80\x80", // overlong encoding + "\xF7\xBF\xBF\xBF", // valid encoding of invalid code point +#endif }; std::vector> failure_strings_char16_t { @@ -350,6 +358,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(random_sequences, T, types_collection_type) } BOOST_CHECK_MESSAGE(i > 1, "Not enough iterations done!"); + + std::cout << "random_sequences: Completed " << i << " iterations for long random code unit sequences for " << typeid(typename T::value_type).name() << std::endl; } // Test ISO and UTF encodings @@ -385,8 +395,12 @@ BOOST_AUTO_TEST_CASE(convert) BOOST_CHECK((unicode::convert("\u732b")) == std::wstring{L"\u732b"}); BOOST_CHECK((unicode::convert("\U0001F63A")) == std::wstring{L"\U0001F63A"}); BOOST_CHECK((unicode::convert(L"\U0001F63A")) == std::u32string{U"\U0001F63A"}); +#if (__cplusplus >= 202002L) BOOST_CHECK((unicode::convert(L"\U0001F63A")) == std::u8string{u8"\U0001F63A"}); - +#else + BOOST_CHECK((unicode::convert(L"\U0001F63A")) == std::string{"\U0001F63A"}); +#endif + BOOST_CHECK((unicode::convert(std::string{"äöü"})) == std::wstring{L"äöü"}); BOOST_CHECK((unicode::convert, std::vector>(std::vector{})) == std::vector{}); -- cgit v1.2.3