summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2021-12-06 16:31:02 +0100
committerRoland Reichwein <mail@reichwein.it>2021-12-06 16:31:02 +0100
commit955b3b84dd2dadd539dbc707c26c33ad3e63b374 (patch)
treee87107a2233bef7aac37438c39923366e9099f5e
parentf61b0aeafd2f5f2619ff21efb000026364c79230 (diff)
Fixes for new compiler versions
-rw-r--r--Makefile18
-rw-r--r--msbuild/compiler.props4
-rw-r--r--msbuild/libunicode.vcxproj6
-rw-r--r--msbuild/recode.vcxproj10
-rw-r--r--msbuild/test-unicode.vcxproj4
-rw-r--r--msbuild/validate.vcxproj6
-rw-r--r--src/test-unicode.cpp26
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<char8_t>
-#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 @@
<ClCompile>
<AdditionalIncludeDirectories>D:\ext\winnt\boost\boost-1_77_0;..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/utf-8 /D NOMINMAX /FS %(AdditionalOptions)</AdditionalOptions>
+ <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<LanguageStandard>stdcpp20</LanguageStandard>
+ <ConformanceMode>true</ConformanceMode>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ <WarningLevel>Level3</WarningLevel>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup />
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 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
- <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -64,13 +61,10 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
- <WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
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 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
- <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>
- </AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
- <WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>
- </AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Import Project="compiler.props" />
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 @@
<Import Project="compiler.props" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
- <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
@@ -66,12 +64,10 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
- <WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
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 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
- <WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@@ -67,13 +64,10 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
- <WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
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<types_collection_type> success_sets {
// Error cases: throwing upon convert to all other types
std::vector<std::basic_string<utf8_t>> 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<std::basic_string<char16_t>> 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<char, wchar_t>("\u732b")) == std::wstring{L"\u732b"});
BOOST_CHECK((unicode::convert<char, wchar_t>("\U0001F63A")) == std::wstring{L"\U0001F63A"});
BOOST_CHECK((unicode::convert<wchar_t, char32_t>(L"\U0001F63A")) == std::u32string{U"\U0001F63A"});
+#if (__cplusplus >= 202002L)
BOOST_CHECK((unicode::convert<wchar_t, utf8_t>(L"\U0001F63A")) == std::u8string{u8"\U0001F63A"});
-
+#else
+ BOOST_CHECK((unicode::convert<wchar_t, utf8_t>(L"\U0001F63A")) == std::string{"\U0001F63A"});
+#endif
+
BOOST_CHECK((unicode::convert<std::string, std::wstring>(std::string{"äöü"})) == std::wstring{L"äöü"});
BOOST_CHECK((unicode::convert<std::vector<char>, std::vector<wchar_t>>(std::vector<char>{})) == std::vector<wchar_t>{});