diff --git a/.circleci/config.yml b/.circleci/config.yml index 4f720752..a9a16245 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -44,6 +44,19 @@ jobs: - run: ./ci/install_bazel.sh - run: ./ci/do_ci.sh bazel.test + # Verify that we can work on architectures that default to use an unsigned char + # See https://github.com/lightstep/lightstep-tracer-cpp/issues/246 + # https://github.com/lightstep/lightstep-tracer-cpp/pull/245 + unsigned_char_test: + resource_class: xlarge + docker: + - image: ubuntu:18.04 + steps: + - checkout + - run: ./ci/setup_build_environment.sh + - run: ./ci/install_bazel.sh + - run: ./ci/do_ci.sh bazel.unsigned_char.test + asan: resource_class: xlarge docker: @@ -294,6 +307,7 @@ workflows: - cmake_no_grpc - cmake_with_grpc - test + - unsigned_char_test - asan - tsan - windows diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 89a6ff59..83827ec4 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -79,6 +79,10 @@ elif [[ "$1" == "bazel.test" ]]; then bazel build -c dbg $BAZEL_OPTIONS -- //... -//benchmark/... bazel test -c dbg $BAZEL_TEST_OPTIONS //... exit 0 +elif [[ "$1" == "bazel.unsigned_char.test" ]]; then + bazel build -c dbg --copt -funsigned-char $BAZEL_OPTIONS -- //... -//benchmark/... + bazel test -c dbg --copt -funsigned-char $BAZEL_TEST_OPTIONS //... + exit 0 elif [[ "$1" == "bazel.asan" ]]; then setup_clang_toolchain bazel test -c dbg \ diff --git a/src/common/utility.cpp b/src/common/utility.cpp index 3c97a1da..dda85bca 100644 --- a/src/common/utility.cpp +++ b/src/common/utility.cpp @@ -51,7 +51,8 @@ timeval ToTimeval(std::chrono::microseconds microseconds) { static void WriteEscapedString(std::ostringstream& writer, opentracing::string_view s) { writer << '"'; - for (char c : s) { + for (auto c_prime : s) { + auto c = static_cast(c_prime); switch (c) { case '"': writer << R"(\")"; @@ -72,7 +73,8 @@ static void WriteEscapedString(std::ostringstream& writer, writer << R"(\t)"; break; default: - if ('\x00' <= c && c <= '\x1f') { + if (static_cast('\x00') <= c && + c <= static_cast('\x1f')) { writer << R"(\u)"; writer << std::hex << std::setw(4) << std::setfill('0') << static_cast(c);