Skip to content

Commit

Permalink
⛔ Unused variable warnings
Browse files Browse the repository at this point in the history
- C++17 constexpr and comparison operators also sucks, so there's that...!
  • Loading branch information
ThePhD committed Feb 22, 2021
1 parent e1c1bcb commit 59f2dff
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
13 changes: 12 additions & 1 deletion include/ztd/text/unicode_code_point.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace ztd { namespace text {
/// or with the value 0 (if parentheses/brackets are provided for intentional value initialization).
///
//////
constexpr __unicode_code_point() noexcept = default;
__unicode_code_point() noexcept = default;

//////
/// @brief Constructs a code point value with the given code point value.
Expand Down Expand Up @@ -119,6 +119,17 @@ namespace ztd { namespace text {
return __left._M_scalar == __right._M_scalar;
}

//////
/// @brief Check if two unicode code points are not equal.
///
/// @param[in] __left Left hand value of inequality operator.
/// @param[in] __right Right hand value of inequality operator.
//////
friend constexpr bool operator!=(
const __unicode_code_point& __left, const __unicode_code_point& __right) {
return __left._M_scalar != __right._M_scalar;
}

//////
/// @brief Check if one unicode code point is less than the other.
///
Expand Down
13 changes: 12 additions & 1 deletion include/ztd/text/unicode_scalar_value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace ztd { namespace text {
/// with the value 0 (if parentheses/brackets are provided for intentional value initialization).
///
//////
constexpr __unicode_scalar_value() noexcept = default;
__unicode_scalar_value() noexcept = default;

//////
/// @brief Constructs a scalar value with the given code point value.
Expand Down Expand Up @@ -124,6 +124,17 @@ namespace ztd { namespace text {
return __left._M_scalar == __right._M_scalar;
}

//////
/// @brief Check if two unicode code points are not equal.
///
/// @param[in] __left Left hand value of inequality operator.
/// @param[in] __right Right hand value of inequality operator.
//////
friend constexpr bool operator!=(
const __unicode_scalar_value& __left, const __unicode_scalar_value& __right) {
return __left._M_scalar != __right._M_scalar;
}

//////
/// @brief Check if one unicode scalar value is less than the other.
///
Expand Down
5 changes: 5 additions & 0 deletions tests/basic_compile_time/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ if (MSVC)
else()
target_compile_options(ztd.text.tests.basic_compile_time
PRIVATE -std=c++2a -Wall -Werror -Wpedantic -fexec-charset=UTF-8)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(ztd.text.tests.basic_compile_time
PRIVATE -fconstexpr-steps=2097152)
endif()
endif()
endif()
target_include_directories(ztd.text.tests.basic_compile_time
PRIVATE
Expand Down
5 changes: 5 additions & 0 deletions tests/basic_run_time/source/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,22 @@
TEST_CASE("text/text/basic", "basic usages of text do not explode") {
SECTION("execution") {
ztd::text::text txt;
(void)txt;
}
SECTION("wide_execution") {
ztd::text::wtext txt;
(void)txt;
}
SECTION("utf8") {
ztd::text::u8text txt;
(void)txt;
}
SECTION("utf16") {
ztd::text::u16text txt;
(void)txt;
}
SECTION("utf32") {
ztd::text::u32text txt;
(void)txt;
}
}
5 changes: 5 additions & 0 deletions tests/basic_run_time/source/text_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,22 @@
TEST_CASE("text/text_view/basic", "basic usages of text_view do not explode") {
SECTION("execution") {
ztd::text::text_view txt;
(void)txt;
}
SECTION("wide_execution") {
ztd::text::wtext_view txt;
(void)txt;
}
SECTION("utf8") {
ztd::text::u8text_view txt;
(void)txt;
}
SECTION("utf16") {
ztd::text::u16text_view txt;
(void)txt;
}
SECTION("utf32") {
ztd::text::u32text_view txt;
(void)txt;
}
}

0 comments on commit 59f2dff

Please sign in to comment.