Merge changes Ib62d3d68,Ic3e7affe into main
* changes: Make things that can throw not noexcept anymore Fix various clang-tidy lints
This commit is contained in:
commit
73507a7167
|
@ -108,7 +108,7 @@ DerivationGoal::DerivationGoal(const StorePath & drvPath, const BasicDerivation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DerivationGoal::~DerivationGoal()
|
DerivationGoal::~DerivationGoal() noexcept(false)
|
||||||
{
|
{
|
||||||
/* Careful: we should never ever throw an exception from a
|
/* Careful: we should never ever throw an exception from a
|
||||||
destructor. */
|
destructor. */
|
||||||
|
|
|
@ -215,7 +215,7 @@ struct DerivationGoal : public Goal
|
||||||
DerivationGoal(const StorePath & drvPath, const BasicDerivation & drv,
|
DerivationGoal(const StorePath & drvPath, const BasicDerivation & drv,
|
||||||
const OutputsSpec & wantedOutputs, Worker & worker,
|
const OutputsSpec & wantedOutputs, Worker & worker,
|
||||||
BuildMode buildMode = bmNormal);
|
BuildMode buildMode = bmNormal);
|
||||||
virtual ~DerivationGoal();
|
virtual ~DerivationGoal() noexcept(false);
|
||||||
|
|
||||||
void timedOut(Error && ex) override;
|
void timedOut(Error && ex) override;
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ public:
|
||||||
: worker(worker)
|
: worker(worker)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual ~Goal()
|
virtual ~Goal() noexcept(false)
|
||||||
{
|
{
|
||||||
trace("goal destroyed");
|
trace("goal destroyed");
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ void handleDiffHook(
|
||||||
const Path LocalDerivationGoal::homeDir = "/homeless-shelter";
|
const Path LocalDerivationGoal::homeDir = "/homeless-shelter";
|
||||||
|
|
||||||
|
|
||||||
LocalDerivationGoal::~LocalDerivationGoal()
|
LocalDerivationGoal::~LocalDerivationGoal() noexcept(false)
|
||||||
{
|
{
|
||||||
/* Careful: we should never ever throw an exception from a
|
/* Careful: we should never ever throw an exception from a
|
||||||
destructor. */
|
destructor. */
|
||||||
|
|
|
@ -179,7 +179,7 @@ struct LocalDerivationGoal : public DerivationGoal
|
||||||
|
|
||||||
using DerivationGoal::DerivationGoal;
|
using DerivationGoal::DerivationGoal;
|
||||||
|
|
||||||
virtual ~LocalDerivationGoal() override;
|
virtual ~LocalDerivationGoal() noexcept(false) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether we need to perform hash rewriting if there are valid output paths.
|
* Whether we need to perform hash rewriting if there are valid output paths.
|
||||||
|
|
|
@ -157,7 +157,7 @@ size_t StoreReferences::size() const
|
||||||
return (self ? 1 : 0) + others.size();
|
return (self ? 1 : 0) + others.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentAddressWithReferences ContentAddressWithReferences::withoutRefs(const ContentAddress & ca) noexcept
|
ContentAddressWithReferences ContentAddressWithReferences::withoutRefs(const ContentAddress & ca)
|
||||||
{
|
{
|
||||||
return std::visit(overloaded {
|
return std::visit(overloaded {
|
||||||
[&](const TextIngestionMethod &) -> ContentAddressWithReferences {
|
[&](const TextIngestionMethod &) -> ContentAddressWithReferences {
|
||||||
|
@ -177,7 +177,7 @@ ContentAddressWithReferences ContentAddressWithReferences::withoutRefs(const Con
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<ContentAddressWithReferences> ContentAddressWithReferences::fromPartsOpt(
|
std::optional<ContentAddressWithReferences> ContentAddressWithReferences::fromPartsOpt(
|
||||||
ContentAddressMethod method, Hash hash, StoreReferences refs) noexcept
|
ContentAddressMethod method, Hash hash, StoreReferences refs)
|
||||||
{
|
{
|
||||||
return std::visit(overloaded {
|
return std::visit(overloaded {
|
||||||
[&](TextIngestionMethod _) -> std::optional<ContentAddressWithReferences> {
|
[&](TextIngestionMethod _) -> std::optional<ContentAddressWithReferences> {
|
||||||
|
|
|
@ -255,7 +255,7 @@ struct ContentAddressWithReferences
|
||||||
* Create a `ContentAddressWithReferences` from a mere
|
* Create a `ContentAddressWithReferences` from a mere
|
||||||
* `ContentAddress`, by claiming no references.
|
* `ContentAddress`, by claiming no references.
|
||||||
*/
|
*/
|
||||||
static ContentAddressWithReferences withoutRefs(const ContentAddress &) noexcept;
|
static ContentAddressWithReferences withoutRefs(const ContentAddress &);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a `ContentAddressWithReferences` from 3 parts:
|
* Create a `ContentAddressWithReferences` from 3 parts:
|
||||||
|
@ -270,7 +270,7 @@ struct ContentAddressWithReferences
|
||||||
* returns for invalid combinations.
|
* returns for invalid combinations.
|
||||||
*/
|
*/
|
||||||
static std::optional<ContentAddressWithReferences> fromPartsOpt(
|
static std::optional<ContentAddressWithReferences> fromPartsOpt(
|
||||||
ContentAddressMethod method, Hash hash, StoreReferences refs) noexcept;
|
ContentAddressMethod method, Hash hash, StoreReferences refs);
|
||||||
|
|
||||||
ContentAddressMethod getMethod() const;
|
ContentAddressMethod getMethod() const;
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ struct curlFileTransfer : public FileTransfer
|
||||||
template<class T>
|
template<class T>
|
||||||
void fail(T && e)
|
void fail(T && e)
|
||||||
{
|
{
|
||||||
failEx(std::make_exception_ptr(std::move(e)));
|
failEx(std::make_exception_ptr(std::forward<T>(e)));
|
||||||
}
|
}
|
||||||
|
|
||||||
LambdaSink finalSink;
|
LambdaSink finalSink;
|
||||||
|
@ -270,6 +270,9 @@ struct curlFileTransfer : public FileTransfer
|
||||||
return 0;
|
return 0;
|
||||||
auto count = std::min(size * nitems, request.data->length() - readOffset);
|
auto count = std::min(size * nitems, request.data->length() - readOffset);
|
||||||
assert(count);
|
assert(count);
|
||||||
|
// Lint: this is turning a string into a byte array to hand to
|
||||||
|
// curl, which is fine.
|
||||||
|
// NOLINTNEXTLINE(bugprone-not-null-terminated-result)
|
||||||
memcpy(buffer, request.data->data() + readOffset, count);
|
memcpy(buffer, request.data->data() + readOffset, count);
|
||||||
readOffset += count;
|
readOffset += count;
|
||||||
return count;
|
return count;
|
||||||
|
|
|
@ -1315,10 +1315,12 @@ StorePath LocalStore::addToStoreFromDump(Source & source0, std::string_view name
|
||||||
auto oldSize = dump.size();
|
auto oldSize = dump.size();
|
||||||
constexpr size_t chunkSize = 65536;
|
constexpr size_t chunkSize = 65536;
|
||||||
auto want = std::min(chunkSize, settings.narBufferSize - oldSize);
|
auto want = std::min(chunkSize, settings.narBufferSize - oldSize);
|
||||||
if (auto tmp = realloc(dumpBuffer.get(), oldSize + want)) {
|
|
||||||
dumpBuffer.release();
|
auto *toRealloc = dumpBuffer.release();
|
||||||
dumpBuffer.reset((char*) tmp);
|
if (auto realloced = realloc(toRealloc, oldSize + want)) {
|
||||||
|
dumpBuffer.reset((char*) realloced);
|
||||||
} else {
|
} else {
|
||||||
|
free(toRealloc);
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
}
|
}
|
||||||
auto got = 0;
|
auto got = 0;
|
||||||
|
|
|
@ -108,7 +108,7 @@ struct StoreConfig : public Config
|
||||||
|
|
||||||
static StringSet getDefaultSystemFeatures();
|
static StringSet getDefaultSystemFeatures();
|
||||||
|
|
||||||
virtual ~StoreConfig() { }
|
virtual ~StoreConfig() noexcept(false) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of this type of store.
|
* The name of this type of store.
|
||||||
|
@ -220,7 +220,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void init() {};
|
virtual void init() {};
|
||||||
|
|
||||||
virtual ~Store() { }
|
virtual ~Store() noexcept(false) { }
|
||||||
|
|
||||||
virtual std::string getUri() = 0;
|
virtual std::string getUri() = 0;
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,8 @@ public:
|
||||||
case lvlWarn: c = '4'; break;
|
case lvlWarn: c = '4'; break;
|
||||||
case lvlNotice: case lvlInfo: c = '5'; break;
|
case lvlNotice: case lvlInfo: c = '5'; break;
|
||||||
case lvlTalkative: case lvlChatty: c = '6'; break;
|
case lvlTalkative: case lvlChatty: c = '6'; break;
|
||||||
case lvlDebug: case lvlVomit: c = '7'; break;
|
case lvlDebug: case lvlVomit:
|
||||||
default: c = '7'; break; // should not happen, and missing enum case is reported by -Werror=switch-enum
|
default: c = '7'; break; // default case should not happen, and missing enum case is reported by -Werror=switch-enum
|
||||||
}
|
}
|
||||||
prefix = std::string("<") + c + ">";
|
prefix = std::string("<") + c + ">";
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ InputAccessor::DirEntries SourcePath::readDirectory() const
|
||||||
case DT_REG: type = InputAccessor::Type::tRegular; break;
|
case DT_REG: type = InputAccessor::Type::tRegular; break;
|
||||||
case DT_LNK: type = InputAccessor::Type::tSymlink; break;
|
case DT_LNK: type = InputAccessor::Type::tSymlink; break;
|
||||||
case DT_DIR: type = InputAccessor::Type::tDirectory; break;
|
case DT_DIR: type = InputAccessor::Type::tDirectory; break;
|
||||||
|
default: break; // unknown type
|
||||||
}
|
}
|
||||||
res.emplace(entry.name, type);
|
res.emplace(entry.name, type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -947,7 +947,7 @@ Pid::Pid(pid_t pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Pid::~Pid()
|
Pid::~Pid() noexcept(false)
|
||||||
{
|
{
|
||||||
if (pid != -1) kill();
|
if (pid != -1) kill();
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,7 +335,7 @@ public:
|
||||||
AutoCloseFD(AutoCloseFD&& fd);
|
AutoCloseFD(AutoCloseFD&& fd);
|
||||||
~AutoCloseFD();
|
~AutoCloseFD();
|
||||||
AutoCloseFD& operator =(const AutoCloseFD & fd) = delete;
|
AutoCloseFD& operator =(const AutoCloseFD & fd) = delete;
|
||||||
AutoCloseFD& operator =(AutoCloseFD&& fd);
|
AutoCloseFD& operator =(AutoCloseFD&& fd) noexcept(false);
|
||||||
int get() const;
|
int get() const;
|
||||||
explicit operator bool() const;
|
explicit operator bool() const;
|
||||||
int release();
|
int release();
|
||||||
|
@ -384,7 +384,7 @@ class Pid
|
||||||
public:
|
public:
|
||||||
Pid();
|
Pid();
|
||||||
Pid(pid_t pid);
|
Pid(pid_t pid);
|
||||||
~Pid();
|
~Pid() noexcept(false);
|
||||||
void operator =(pid_t pid);
|
void operator =(pid_t pid);
|
||||||
operator pid_t();
|
operator pid_t();
|
||||||
int kill();
|
int kill();
|
||||||
|
|
|
@ -32,13 +32,13 @@ Gen<StorePathName> Arbitrary<StorePathName>::arbitrary()
|
||||||
for (size_t c = 0; c < len; ++c) {
|
for (size_t c = 0; c < len; ++c) {
|
||||||
switch (auto i = *gen::inRange<uint8_t>(0, 10 + 2 * 26 + 6)) {
|
switch (auto i = *gen::inRange<uint8_t>(0, 10 + 2 * 26 + 6)) {
|
||||||
case 0 ... 9:
|
case 0 ... 9:
|
||||||
pre += '0' + i;
|
pre += static_cast<uint8_t>('0' + i);
|
||||||
break;
|
break;
|
||||||
case 10 ... 35:
|
case 10 ... 35:
|
||||||
pre += 'A' + (i - 10);
|
pre += static_cast<uint8_t>('A' + (i - 10));
|
||||||
break;
|
break;
|
||||||
case 36 ... 61:
|
case 36 ... 61:
|
||||||
pre += 'a' + (i - 36);
|
pre += static_cast<uint8_t>('a' + (i - 36));
|
||||||
break;
|
break;
|
||||||
case 62:
|
case 62:
|
||||||
pre += '+';
|
pre += '+';
|
||||||
|
|
|
@ -170,20 +170,22 @@ TEST(ExtendedOutputsSpec, many_carrot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define TEST_JSON(TYPE, NAME, STR, VAL) \
|
#define TEST_JSON(TYPE, NAME, STR, VAL) \
|
||||||
\
|
\
|
||||||
TEST(TYPE, NAME ## _to_json) { \
|
TEST(TYPE, NAME ## _to_json) { \
|
||||||
using nlohmann::literals::operator "" _json; \
|
using nlohmann::literals::operator "" _json; \
|
||||||
ASSERT_EQ( \
|
ASSERT_EQ( \
|
||||||
STR ## _json, \
|
STR ## _json, \
|
||||||
((nlohmann::json) TYPE { VAL })); \
|
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
|
||||||
} \
|
((nlohmann::json) TYPE { VAL })); \
|
||||||
\
|
} \
|
||||||
TEST(TYPE, NAME ## _from_json) { \
|
\
|
||||||
using nlohmann::literals::operator "" _json; \
|
TEST(TYPE, NAME ## _from_json) { \
|
||||||
ASSERT_EQ( \
|
using nlohmann::literals::operator "" _json; \
|
||||||
TYPE { VAL }, \
|
ASSERT_EQ( \
|
||||||
(STR ## _json).get<TYPE>()); \
|
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
|
||||||
|
TYPE { VAL }, \
|
||||||
|
(STR ## _json).get<TYPE>()); \
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_JSON(OutputsSpec, all, R"(["*"])", OutputsSpec::All { })
|
TEST_JSON(OutputsSpec, all, R"(["*"])", OutputsSpec::All { })
|
||||||
|
|
|
@ -26,6 +26,7 @@ void TerminalCodeEater::feed(char c, std::function<void(char)> on_char)
|
||||||
// Just eat \r, since it is part of clearing a line
|
// Just eat \r, since it is part of clearing a line
|
||||||
case '\r':
|
case '\r':
|
||||||
return;
|
return;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
if constexpr (DEBUG_EATER) {
|
if constexpr (DEBUG_EATER) {
|
||||||
std::cerr << "eater uneat" << MaybeHexEscapedChar{c} << "\n";
|
std::cerr << "eater uneat" << MaybeHexEscapedChar{c} << "\n";
|
||||||
|
|
Loading…
Reference in a new issue