mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
Merge pull request #11180 from Mic92/override-warnings
add werror=suggest-override
This commit is contained in:
commit
ca1e1e983f
9 changed files with 38 additions and 39 deletions
2
Makefile
2
Makefile
|
@ -93,7 +93,7 @@ ifdef HOST_WINDOWS
|
||||||
GLOBAL_LDFLAGS += -Wl,--export-all-symbols
|
GLOBAL_LDFLAGS += -Wl,--export-all-symbols
|
||||||
endif
|
endif
|
||||||
|
|
||||||
GLOBAL_CXXFLAGS += -g -Wall -Wdeprecated-copy -Wignored-qualifiers -Wimplicit-fallthrough -Werror=unused-result -include $(buildprefix)config.h -std=c++2a -I src
|
GLOBAL_CXXFLAGS += -g -Wall -Wdeprecated-copy -Wignored-qualifiers -Wimplicit-fallthrough -Werror=unused-result -Werror=suggest-override -include $(buildprefix)config.h -std=c++2a -I src
|
||||||
|
|
||||||
# Include the main lib, causing rules to be defined
|
# Include the main lib, causing rules to be defined
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
add_project_arguments(
|
add_project_arguments(
|
||||||
'-Wno-deprecated-declarations',
|
'-Wdeprecated-copy',
|
||||||
'-Wimplicit-fallthrough',
|
'-Werror=suggest-override',
|
||||||
'-Werror=switch',
|
'-Werror=switch',
|
||||||
'-Werror=switch-enum',
|
'-Werror=switch-enum',
|
||||||
'-Werror=unused-result',
|
'-Werror=unused-result',
|
||||||
'-Wdeprecated-copy',
|
|
||||||
'-Wignored-qualifiers',
|
'-Wignored-qualifiers',
|
||||||
# Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked
|
'-Wimplicit-fallthrough',
|
||||||
# at ~1% overhead in `nix search`.
|
'-Wno-deprecated-declarations',
|
||||||
#
|
|
||||||
language : 'cpp',
|
language : 'cpp',
|
||||||
)
|
)
|
||||||
|
|
|
@ -80,42 +80,42 @@ class JSONSax : nlohmann::json_sax<json> {
|
||||||
public:
|
public:
|
||||||
JSONSax(EvalState & state, Value & v) : state(state), rs(new JSONState(&v)) {};
|
JSONSax(EvalState & state, Value & v) : state(state), rs(new JSONState(&v)) {};
|
||||||
|
|
||||||
bool null()
|
bool null() override
|
||||||
{
|
{
|
||||||
rs->value(state).mkNull();
|
rs->value(state).mkNull();
|
||||||
rs->add();
|
rs->add();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool boolean(bool val)
|
bool boolean(bool val) override
|
||||||
{
|
{
|
||||||
rs->value(state).mkBool(val);
|
rs->value(state).mkBool(val);
|
||||||
rs->add();
|
rs->add();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool number_integer(number_integer_t val)
|
bool number_integer(number_integer_t val) override
|
||||||
{
|
{
|
||||||
rs->value(state).mkInt(val);
|
rs->value(state).mkInt(val);
|
||||||
rs->add();
|
rs->add();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool number_unsigned(number_unsigned_t val)
|
bool number_unsigned(number_unsigned_t val) override
|
||||||
{
|
{
|
||||||
rs->value(state).mkInt(val);
|
rs->value(state).mkInt(val);
|
||||||
rs->add();
|
rs->add();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool number_float(number_float_t val, const string_t & s)
|
bool number_float(number_float_t val, const string_t & s) override
|
||||||
{
|
{
|
||||||
rs->value(state).mkFloat(val);
|
rs->value(state).mkFloat(val);
|
||||||
rs->add();
|
rs->add();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool string(string_t & val)
|
bool string(string_t & val) override
|
||||||
{
|
{
|
||||||
rs->value(state).mkString(val);
|
rs->value(state).mkString(val);
|
||||||
rs->add();
|
rs->add();
|
||||||
|
@ -123,7 +123,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NLOHMANN_JSON_VERSION_MAJOR >= 3 && NLOHMANN_JSON_VERSION_MINOR >= 8
|
#if NLOHMANN_JSON_VERSION_MAJOR >= 3 && NLOHMANN_JSON_VERSION_MINOR >= 8
|
||||||
bool binary(binary_t&)
|
bool binary(binary_t&) override
|
||||||
{
|
{
|
||||||
// This function ought to be unreachable
|
// This function ought to be unreachable
|
||||||
assert(false);
|
assert(false);
|
||||||
|
@ -131,35 +131,35 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool start_object(std::size_t len)
|
bool start_object(std::size_t len) override
|
||||||
{
|
{
|
||||||
rs = std::make_unique<JSONObjectState>(std::move(rs));
|
rs = std::make_unique<JSONObjectState>(std::move(rs));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool key(string_t & name)
|
bool key(string_t & name) override
|
||||||
{
|
{
|
||||||
dynamic_cast<JSONObjectState*>(rs.get())->key(name, state);
|
dynamic_cast<JSONObjectState*>(rs.get())->key(name, state);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool end_object() {
|
bool end_object() override {
|
||||||
rs = rs->resolve(state);
|
rs = rs->resolve(state);
|
||||||
rs->add();
|
rs->add();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool end_array() {
|
bool end_array() override {
|
||||||
return end_object();
|
return end_object();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool start_array(size_t len) {
|
bool start_array(size_t len) override {
|
||||||
rs = std::make_unique<JSONListState>(std::move(rs),
|
rs = std::make_unique<JSONListState>(std::move(rs),
|
||||||
len != std::numeric_limits<size_t>::max() ? len : 128);
|
len != std::numeric_limits<size_t>::max() ? len : 128);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parse_error(std::size_t, const std::string&, const nlohmann::detail::exception& ex) {
|
bool parse_error(std::size_t, const std::string&, const nlohmann::detail::exception& ex) override {
|
||||||
throw JSONParseError("%s", ex.what());
|
throw JSONParseError("%s", ex.what());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -186,7 +186,7 @@ struct ExprInheritFrom : ExprVar
|
||||||
this->fromWith = nullptr;
|
this->fromWith = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bindVars(EvalState & es, const std::shared_ptr<const StaticEnv> & env);
|
void bindVars(EvalState & es, const std::shared_ptr<const StaticEnv> & env) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ExprSelect : Expr
|
struct ExprSelect : Expr
|
||||||
|
@ -203,7 +203,7 @@ struct ExprSelect : Expr
|
||||||
*
|
*
|
||||||
* @param[out] v The attribute set that should contain the last attribute name (if it exists).
|
* @param[out] v The attribute set that should contain the last attribute name (if it exists).
|
||||||
* @return The last attribute name in `attrPath`
|
* @return The last attribute name in `attrPath`
|
||||||
*
|
*
|
||||||
* @note This does *not* evaluate the final attribute, and does not fail if that's the only attribute that does not exist.
|
* @note This does *not* evaluate the final attribute, and does not fail if that's the only attribute that does not exist.
|
||||||
*/
|
*/
|
||||||
Symbol evalExceptFinalSelect(EvalState & state, Env & env, Value & attrs);
|
Symbol evalExceptFinalSelect(EvalState & state, Env & env, Value & attrs);
|
||||||
|
|
|
@ -167,7 +167,7 @@ struct TunnelSink : Sink
|
||||||
{
|
{
|
||||||
Sink & to;
|
Sink & to;
|
||||||
TunnelSink(Sink & to) : to(to) { }
|
TunnelSink(Sink & to) : to(to) { }
|
||||||
void operator () (std::string_view data)
|
void operator () (std::string_view data) override
|
||||||
{
|
{
|
||||||
to << STDERR_WRITE;
|
to << STDERR_WRITE;
|
||||||
writeString(data, to);
|
writeString(data, to);
|
||||||
|
|
|
@ -1258,7 +1258,7 @@ bool LocalDerivationGoal::isAllowed(const DerivedPath & req)
|
||||||
struct RestrictedStoreConfig : virtual LocalFSStoreConfig
|
struct RestrictedStoreConfig : virtual LocalFSStoreConfig
|
||||||
{
|
{
|
||||||
using LocalFSStoreConfig::LocalFSStoreConfig;
|
using LocalFSStoreConfig::LocalFSStoreConfig;
|
||||||
const std::string name() { return "Restricted Store"; }
|
const std::string name() override { return "Restricted Store"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A wrapper around LocalStore that only allows building/querying of
|
/* A wrapper around LocalStore that only allows building/querying of
|
||||||
|
|
|
@ -190,11 +190,11 @@ struct VirtualStackAllocator {
|
||||||
class DefaultStackAllocator : public StackAllocator {
|
class DefaultStackAllocator : public StackAllocator {
|
||||||
boost::coroutines2::default_stack stack;
|
boost::coroutines2::default_stack stack;
|
||||||
|
|
||||||
boost::context::stack_context allocate() {
|
boost::context::stack_context allocate() override {
|
||||||
return stack.allocate();
|
return stack.allocate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void deallocate(boost::context::stack_context sctx) {
|
void deallocate(boost::context::stack_context sctx) override {
|
||||||
stack.deallocate(sctx);
|
stack.deallocate(sctx);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -204,7 +204,7 @@ struct TeeSink : Sink
|
||||||
{
|
{
|
||||||
Sink & sink1, & sink2;
|
Sink & sink1, & sink2;
|
||||||
TeeSink(Sink & sink1, Sink & sink2) : sink1(sink1), sink2(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);
|
sink1(data);
|
||||||
sink2(data);
|
sink2(data);
|
||||||
|
@ -221,7 +221,7 @@ struct TeeSource : Source
|
||||||
Sink & sink;
|
Sink & sink;
|
||||||
TeeSource(Source & orig, Sink & sink)
|
TeeSource(Source & orig, Sink & sink)
|
||||||
: orig(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);
|
size_t n = orig.read(data, len);
|
||||||
sink({data, n});
|
sink({data, n});
|
||||||
|
@ -238,7 +238,7 @@ struct SizedSource : Source
|
||||||
size_t remain;
|
size_t remain;
|
||||||
SizedSource(Source & orig, size_t size)
|
SizedSource(Source & orig, size_t size)
|
||||||
: orig(orig), remain(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) {
|
if (this->remain <= 0) {
|
||||||
throw EndOfFile("sized: unexpected end-of-file");
|
throw EndOfFile("sized: unexpected end-of-file");
|
||||||
|
|
|
@ -23,21 +23,22 @@ nix_perl_conf.set('PACKAGE_VERSION', meson.project_version())
|
||||||
# set error arguments
|
# set error arguments
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
error_args = [
|
error_args = [
|
||||||
'-Werror=unused-result',
|
|
||||||
'-Wdeprecated-copy',
|
'-Wdeprecated-copy',
|
||||||
'-Wdeprecated-declarations',
|
'-Wdeprecated-declarations',
|
||||||
|
'-Werror=suggest-override',
|
||||||
|
'-Werror=unused-result',
|
||||||
'-Wignored-qualifiers',
|
'-Wignored-qualifiers',
|
||||||
'-Wno-pedantic',
|
|
||||||
'-Wno-non-virtual-dtor',
|
|
||||||
'-Wno-unused-parameter',
|
|
||||||
'-Wno-variadic-macros',
|
|
||||||
'-Wno-missing-field-initializers',
|
|
||||||
'-Wno-unknown-warning-option',
|
|
||||||
'-Wno-unused-variable',
|
|
||||||
'-Wno-literal-suffix',
|
|
||||||
'-Wno-reserved-user-defined-literal',
|
|
||||||
'-Wno-duplicate-decl-specifier',
|
'-Wno-duplicate-decl-specifier',
|
||||||
|
'-Wno-literal-suffix',
|
||||||
|
'-Wno-missing-field-initializers',
|
||||||
|
'-Wno-non-virtual-dtor',
|
||||||
|
'-Wno-pedantic',
|
||||||
'-Wno-pointer-bool-conversion',
|
'-Wno-pointer-bool-conversion',
|
||||||
|
'-Wno-reserved-user-defined-literal',
|
||||||
|
'-Wno-unknown-warning-option',
|
||||||
|
'-Wno-unused-parameter',
|
||||||
|
'-Wno-unused-variable',
|
||||||
|
'-Wno-variadic-macros',
|
||||||
]
|
]
|
||||||
|
|
||||||
add_project_arguments(
|
add_project_arguments(
|
||||||
|
|
Loading…
Reference in a new issue