diff options
author | Jade Lovelace <lix@jade.fyi> | 2024-03-29 20:26:38 -0700 |
---|---|---|
committer | Jade Lovelace <lix@jade.fyi> | 2024-03-29 20:26:38 -0700 |
commit | 1fa6a3e3354bd98707303476b5a54147ccdd533a (patch) | |
tree | c3804cca7a9ec266de780019a95180e20387c92f /src/libutil | |
parent | 99f159c5367e423097fe4347375bdfc4f76d2c0c (diff) |
Fix various clang-tidy lints
* some things that can throw are marked noexcept
yet the linter seems to think not. Maybe they can't throw in practice.
I would rather not have the UB possibility in pretty obvious cold
paths.
* various default-case-missing complaints
* a fair pile of casts from integer to character, which are in fact
deliberate.
* an instance of <https://clang.llvm.org/extra/clang-tidy/checks/bugprone/move-forwarding-reference.html>
* bugprone-not-null-terminated-result on handing a string to curl in
chunks of bytes. our usage is fine.
* reassigning a unique_ptr by CRIMES instead of using release(), then
using release() and ignoring the result. wild. let's use release() for
its intended purpose.
Change-Id: Ic3e7affef12383576213a8a7c8145c27e662513d
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/logging.cc | 4 | ||||
-rw-r--r-- | src/libutil/source-path.cc | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/libutil/logging.cc b/src/libutil/logging.cc index 691b77e95..0e63f9bd6 100644 --- a/src/libutil/logging.cc +++ b/src/libutil/logging.cc @@ -69,8 +69,8 @@ public: case lvlWarn: c = '4'; break; case lvlNotice: case lvlInfo: c = '5'; break; case lvlTalkative: case lvlChatty: c = '6'; break; - case lvlDebug: case lvlVomit: c = '7'; break; - default: c = '7'; break; // should not happen, and missing enum case is reported by -Werror=switch-enum + case lvlDebug: case lvlVomit: + default: c = '7'; break; // default case should not happen, and missing enum case is reported by -Werror=switch-enum } prefix = std::string("<") + c + ">"; } diff --git a/src/libutil/source-path.cc b/src/libutil/source-path.cc index e6721f808..cfaac20c0 100644 --- a/src/libutil/source-path.cc +++ b/src/libutil/source-path.cc @@ -50,6 +50,7 @@ InputAccessor::DirEntries SourcePath::readDirectory() const case DT_REG: type = InputAccessor::Type::tRegular; break; case DT_LNK: type = InputAccessor::Type::tSymlink; break; case DT_DIR: type = InputAccessor::Type::tDirectory; break; + default: break; // unknown type } res.emplace(entry.name, type); } |