Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From 5729874fa5059c39aa97cfa08fddf107b7a65c9e Mon Sep 17 00:00:00 2001 |
| 2 | From: Miguel Gaio <mgaio35@gmail.com> |
| 3 | Date: Wed, 3 Oct 2018 10:22:16 +0200 |
| 4 | Subject: [PATCH] Fix convert from char on ARM build |
| 5 | |
| 6 | Some platforms set the signedness of char to unsigned (eg. ARM). |
| 7 | Convert from char should not assume the signedness of char. |
| 8 | |
| 9 | Fix build issue with -Werror,-Wtautological-unsigned-zero-compare flags. |
| 10 | |
| 11 | Signed-off-by: Miguel Gaio <mgaio35@gmail.com> |
| 12 | |
| 13 | Upstream-Status: Accepted [Commit f1faaa9c107113692301ad8bb56084460ef1a2ff] |
| 14 | |
| 15 | Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> |
| 16 | --- |
| 17 | include/internal/catch_tostring.cpp | 6 +++--- |
| 18 | 1 file changed, 3 insertions(+), 3 deletions(-) |
| 19 | |
| 20 | diff --git a/include/internal/catch_tostring.cpp b/include/internal/catch_tostring.cpp |
| 21 | index 4e0c027d..8cbabbf2 100644 |
| 22 | --- a/include/internal/catch_tostring.cpp |
| 23 | +++ b/include/internal/catch_tostring.cpp |
| 24 | @@ -205,7 +205,7 @@ std::string StringMaker<bool>::convert(bool b) { |
| 25 | return b ? "true" : "false"; |
| 26 | } |
| 27 | |
| 28 | -std::string StringMaker<char>::convert(char value) { |
| 29 | +std::string StringMaker<signed char>::convert(signed char value) { |
| 30 | if (value == '\r') { |
| 31 | return "'\\r'"; |
| 32 | } else if (value == '\f') { |
| 33 | @@ -222,8 +222,8 @@ std::string StringMaker<char>::convert(char value) { |
| 34 | return chstr; |
| 35 | } |
| 36 | } |
| 37 | -std::string StringMaker<signed char>::convert(signed char c) { |
| 38 | - return ::Catch::Detail::stringify(static_cast<char>(c)); |
| 39 | +std::string StringMaker<char>::convert(char c) { |
| 40 | + return ::Catch::Detail::stringify(static_cast<signed char>(c)); |
| 41 | } |
| 42 | std::string StringMaker<unsigned char>::convert(unsigned char c) { |
| 43 | return ::Catch::Detail::stringify(static_cast<char>(c)); |
| 44 | -- |
| 45 | 2.19.1 |
| 46 | |