1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 16:31:47 +02:00

add werror=suggest-override

Improves code readability by making overrides explicit.
Inspired by lix code-base
This commit is contained in:
Jörg Thalheim 2024-07-25 07:32:03 +02:00
parent 2c07ea8abb
commit 63e50a4b56
9 changed files with 25 additions and 23 deletions

View file

@ -190,11 +190,11 @@ struct VirtualStackAllocator {
class DefaultStackAllocator : public StackAllocator {
boost::coroutines2::default_stack stack;
boost::context::stack_context allocate() {
boost::context::stack_context allocate() override {
return stack.allocate();
}
void deallocate(boost::context::stack_context sctx) {
void deallocate(boost::context::stack_context sctx) override {
stack.deallocate(sctx);
}
};

View file

@ -204,7 +204,7 @@ struct TeeSink : Sink
{
Sink & sink1, & sink2;
TeeSink(Sink & sink1, Sink & sink2) : sink1(sink1), sink2(sink2) { }
virtual void operator () (std::string_view data)
virtual void operator () (std::string_view data) override
{
sink1(data);
sink2(data);
@ -221,7 +221,7 @@ struct TeeSource : Source
Sink & sink;
TeeSource(Source & orig, Sink & sink)
: orig(orig), sink(sink) { }
size_t read(char * data, size_t len)
size_t read(char * data, size_t len) override
{
size_t n = orig.read(data, len);
sink({data, n});
@ -238,7 +238,7 @@ struct SizedSource : Source
size_t remain;
SizedSource(Source & orig, size_t size)
: orig(orig), remain(size) { }
size_t read(char * data, size_t len)
size_t read(char * data, size_t len) override
{
if (this->remain <= 0) {
throw EndOfFile("sized: unexpected end-of-file");