Fix gcc warning -Wmissing-field-initializers
The approach that was taken here was to add default values to the type
definitions rather than specify them whenever they are missing.
Now the only remaining warning is '-Wunused-parameter' which @jade said
is usually counterproductive and that we can just disable it:
#456 (comment)
So this change adds the flags '-Wall', '-Wextra' and
'-Wno-unused-parameter', so that all warnings are enabled except for
'-Wunused-parameter'.
Change-Id: Ic223a964d67ab429e8da804c0721ba5e25d53012
This commit is contained in:
parent
299813f324
commit
43e79f4434
|
@ -52,8 +52,7 @@ project('lix', 'cpp', 'rust',
|
||||||
default_options : [
|
default_options : [
|
||||||
'cpp_std=c++2a',
|
'cpp_std=c++2a',
|
||||||
'rust_std=2021',
|
'rust_std=2021',
|
||||||
# TODO(Qyriad): increase the warning level
|
'warning_level=2',
|
||||||
'warning_level=1',
|
|
||||||
'debug=true',
|
'debug=true',
|
||||||
'optimization=2',
|
'optimization=2',
|
||||||
'errorlogs=true', # Please print logs for tests that fail
|
'errorlogs=true', # Please print logs for tests that fail
|
||||||
|
@ -485,7 +484,7 @@ add_project_arguments(
|
||||||
# TODO(Qyriad): Yes this is how the autoconf+Make system did it.
|
# TODO(Qyriad): Yes this is how the autoconf+Make system did it.
|
||||||
# It would be nice for our headers to be idempotent instead.
|
# It would be nice for our headers to be idempotent instead.
|
||||||
'-include', 'config.h',
|
'-include', 'config.h',
|
||||||
'-Wsign-compare',
|
'-Wno-unused-parameter',
|
||||||
'-Wno-deprecated-declarations',
|
'-Wno-deprecated-declarations',
|
||||||
'-Wimplicit-fallthrough',
|
'-Wimplicit-fallthrough',
|
||||||
'-Werror=switch',
|
'-Werror=switch',
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace nix::parser {
|
||||||
struct StringToken
|
struct StringToken
|
||||||
{
|
{
|
||||||
std::string_view s;
|
std::string_view s;
|
||||||
bool hasIndentation;
|
bool hasIndentation = false;
|
||||||
operator std::string_view() const { return s; }
|
operator std::string_view() const { return s; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct BuildResult
|
||||||
* @todo This should be an entire ErrorInfo object, not just a
|
* @todo This should be an entire ErrorInfo object, not just a
|
||||||
* string, for richer information.
|
* string, for richer information.
|
||||||
*/
|
*/
|
||||||
std::string errorMsg;
|
std::string errorMsg = {};
|
||||||
|
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
auto strStatus = [&]() {
|
auto strStatus = [&]() {
|
||||||
|
@ -90,7 +90,7 @@ struct BuildResult
|
||||||
* For derivations, a mapping from the names of the wanted outputs
|
* For derivations, a mapping from the names of the wanted outputs
|
||||||
* to actual paths.
|
* to actual paths.
|
||||||
*/
|
*/
|
||||||
SingleDrvOutputs builtOutputs;
|
SingleDrvOutputs builtOutputs = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The start/stop times of the build (or one of the rounds, if it
|
* The start/stop times of the build (or one of the rounds, if it
|
||||||
|
|
|
@ -63,7 +63,7 @@ struct InitialOutputStatus {
|
||||||
struct InitialOutput {
|
struct InitialOutput {
|
||||||
bool wanted;
|
bool wanted;
|
||||||
Hash outputHash;
|
Hash outputHash;
|
||||||
std::optional<InitialOutputStatus> known;
|
std::optional<InitialOutputStatus> known = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,8 +88,8 @@ protected:
|
||||||
public:
|
public:
|
||||||
struct [[nodiscard]] WorkResult {
|
struct [[nodiscard]] WorkResult {
|
||||||
ExitCode exitCode;
|
ExitCode exitCode;
|
||||||
BuildResult result;
|
BuildResult result = {};
|
||||||
std::shared_ptr<Error> ex;
|
std::shared_ptr<Error> ex = {};
|
||||||
bool permanentFailure = false;
|
bool permanentFailure = false;
|
||||||
bool timedOut = false;
|
bool timedOut = false;
|
||||||
bool hashMismatch = false;
|
bool hashMismatch = false;
|
||||||
|
|
|
@ -20,10 +20,10 @@ struct NarMember
|
||||||
file in the NAR. */
|
file in the NAR. */
|
||||||
uint64_t start = 0, size = 0;
|
uint64_t start = 0, size = 0;
|
||||||
|
|
||||||
std::string target;
|
std::string target = {};
|
||||||
|
|
||||||
/* If this is a directory, all the children of the directory. */
|
/* If this is a directory, all the children of the directory. */
|
||||||
std::map<std::string, NarMember> children;
|
std::map<std::string, NarMember> children = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NarAccessor : public FSAccessor
|
struct NarAccessor : public FSAccessor
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace nix {
|
||||||
struct StorePathWithOutputs
|
struct StorePathWithOutputs
|
||||||
{
|
{
|
||||||
StorePath path;
|
StorePath path;
|
||||||
std::set<std::string> outputs;
|
std::set<std::string> outputs = {};
|
||||||
|
|
||||||
std::string to_string(const Store & store) const;
|
std::string to_string(const Store & store) const;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct Realisation {
|
||||||
DrvOutput id;
|
DrvOutput id;
|
||||||
StorePath outPath;
|
StorePath outPath;
|
||||||
|
|
||||||
StringSet signatures;
|
StringSet signatures = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The realisations that are required for the current one to be valid.
|
* The realisations that are required for the current one to be valid.
|
||||||
|
@ -58,7 +58,7 @@ struct Realisation {
|
||||||
* When importing this realisation, the store will first check that all its
|
* When importing this realisation, the store will first check that all its
|
||||||
* dependencies exist, and map to the correct output path
|
* dependencies exist, and map to the correct output path
|
||||||
*/
|
*/
|
||||||
std::map<DrvOutput, StorePath> dependentRealisations;
|
std::map<DrvOutput, StorePath> dependentRealisations = {};
|
||||||
|
|
||||||
nlohmann::json toJSON() const;
|
nlohmann::json toJSON() const;
|
||||||
static Realisation fromJSON(const nlohmann::json& json, const std::string& whence);
|
static Realisation fromJSON(const nlohmann::json& json, const std::string& whence);
|
||||||
|
|
|
@ -829,7 +829,7 @@ StorePathSet Store::queryValidPaths(const StorePathSet & paths, SubstituteFlag m
|
||||||
{
|
{
|
||||||
size_t left;
|
size_t left;
|
||||||
StorePathSet valid;
|
StorePathSet valid;
|
||||||
std::exception_ptr exc;
|
std::exception_ptr exc = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
Sync<State> state_(State{paths.size(), StorePathSet()});
|
Sync<State> state_(State{paths.size(), StorePathSet()});
|
||||||
|
|
|
@ -70,17 +70,17 @@ inline bool operator<=(const Trace& lhs, const Trace& rhs);
|
||||||
inline bool operator>=(const Trace& lhs, const Trace& rhs);
|
inline bool operator>=(const Trace& lhs, const Trace& rhs);
|
||||||
|
|
||||||
struct ErrorInfo {
|
struct ErrorInfo {
|
||||||
Verbosity level;
|
Verbosity level = Verbosity::lvlError;
|
||||||
HintFmt msg;
|
HintFmt msg;
|
||||||
std::shared_ptr<Pos> pos;
|
std::shared_ptr<Pos> pos;
|
||||||
std::list<Trace> traces;
|
std::list<Trace> traces = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit status.
|
* Exit status.
|
||||||
*/
|
*/
|
||||||
unsigned int status = 1;
|
unsigned int status = 1;
|
||||||
|
|
||||||
Suggestions suggestions;
|
Suggestions suggestions = {};
|
||||||
|
|
||||||
static std::optional<std::string> programName;
|
static std::optional<std::string> programName;
|
||||||
};
|
};
|
||||||
|
|
|
@ -78,11 +78,11 @@ struct RunOptions
|
||||||
{
|
{
|
||||||
Path program;
|
Path program;
|
||||||
bool searchPath = true;
|
bool searchPath = true;
|
||||||
Strings args;
|
Strings args = {};
|
||||||
std::optional<uid_t> uid;
|
std::optional<uid_t> uid = {};
|
||||||
std::optional<uid_t> gid;
|
std::optional<uid_t> gid = {};
|
||||||
std::optional<Path> chdir;
|
std::optional<Path> chdir = {};
|
||||||
std::optional<std::map<std::string, std::string>> environment;
|
std::optional<std::map<std::string, std::string>> environment = {};
|
||||||
bool captureStdout = false;
|
bool captureStdout = false;
|
||||||
bool mergeStderrToStdout = false;
|
bool mergeStderrToStdout = false;
|
||||||
bool isInteractive = false;
|
bool isInteractive = false;
|
||||||
|
|
Loading…
Reference in a new issue