From f326c16bb288642246232ac173e2faa7cd4fad02 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Fri, 4 Oct 2024 14:08:11 +0200 Subject: Enable clang-analyzer-cplusplus.StringChecker check. --- .clang-tidy | 2 +- test/utils/hermeticity/test_storage_config.hpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 3034f0e1..acd90baa 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,7 +3,7 @@ Checks: >- *,-abseil-*,-altera-*,-android-*,-boost-*,-cert-*,-darwin-*,-fuchsia-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-zircon-* WarningsAsErrors: >- bugprone-*,-bugprone-easily-swappable-parameters,-bugprone-unchecked-optional-access, - clang-analyzer-*,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-analyzer-cplusplus.StringChecker, + clang-analyzer-*,-clang-analyzer-cplusplus.NewDeleteLeaks, clang-diagnostic-*,-clang-diagnostic-unused-command-line-argument, hicpp-*, performance-*,-performance-avoid-endl, diff --git a/test/utils/hermeticity/test_storage_config.hpp b/test/utils/hermeticity/test_storage_config.hpp index 5f5ecab4..4335592c 100644 --- a/test/utils/hermeticity/test_storage_config.hpp +++ b/test/utils/hermeticity/test_storage_config.hpp @@ -41,9 +41,13 @@ class TestStorageConfig final { * there. Hence we set the storage root to a fixed location under * TEST_TMPDIR which is set by the test launcher. */ + char const* const env_tmpdir = std::getenv("TEST_TMPDIR"); + if (env_tmpdir == nullptr) { + Logger::Log(LogLevel::Debug, "missing TEST_TMPDIR env variable"); + std::exit(EXIT_FAILURE); + } auto const test_tempdir = - std::filesystem::path{std::string{std::getenv("TEST_TMPDIR")}} / - ".test_build_root"; + std::filesystem::path{std::string{env_tmpdir}} / ".test_build_root"; auto temp_dir = TmpDir::Create(test_tempdir); if (temp_dir == nullptr) { -- cgit v1.2.3