Silence some clang-tidy warnings.

- Thread-unsafe std::getenv and std::setlocale doesn't matter for us.
- It is unlikely that we can make main() less complex without making it more
  complex elsewhere.
- Thread-unsafe std::strerror stays unsolved for now.
This commit is contained in:
tastytea 2021-06-29 01:53:12 +02:00
parent 49de44f729
commit c99c01162d
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 4 additions and 3 deletions

View File

@ -184,7 +184,7 @@ std::string unescape_html(const std::string_view html)
std::string_view get_env(const std::string_view name) std::string_view get_env(const std::string_view name)
{ {
const char *env = std::getenv(name.data()); const char *env = std::getenv(name.data()); // NOLINT(concurrency-mt-unsafe)
if (env != nullptr) if (env != nullptr)
{ {
return env; return env;

View File

@ -48,6 +48,7 @@
constexpr int EXIT_FATAL{2}; // NOLINT(readability-identifier-naming) constexpr int EXIT_FATAL{2}; // NOLINT(readability-identifier-naming)
// NOLINTNEXTLINE(readability-function-cognitive-complexity)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
using namespace epubgrep; using namespace epubgrep;
@ -59,7 +60,7 @@ int main(int argc, char *argv[])
// locale_generator("").name.c_str() returns "*" instead of "". That's why // locale_generator("").name.c_str() returns "*" instead of "". That's why
// the global C locale isn't changed. So we have to set it additionally. // the global C locale isn't changed. So we have to set it additionally.
std::setlocale(LC_ALL, ""); std::setlocale(LC_ALL, ""); // NOLINT(concurrency-mt-unsafe)
boost::locale::generator locale_generator; boost::locale::generator locale_generator;
locale_generator.add_messages_path("translations"); locale_generator.add_messages_path("translations");
locale_generator.add_messages_path("/usr/share/locale"); locale_generator.add_messages_path("/usr/share/locale");
@ -174,7 +175,7 @@ int main(int argc, char *argv[])
catch (const std::ifstream::failure &e) catch (const std::ifstream::failure &e)
{ {
LOG(log::sev::error) LOG(log::sev::error)
<< std::strerror(errno) << std::strerror(errno) // FIXME: Not thread safe.
<< format(translate(" (while opening {0:s})").str(), << format(translate(" (while opening {0:s})").str(),
filepath); filepath);
return EXIT_FAILURE; return EXIT_FAILURE;