Merge pull request #11089 from NixOS/warnings-includes

Fix warnings and optimize includes
This commit is contained in:
John Ericson 2024-07-12 10:29:26 -04:00 committed by GitHub
commit 337a5a23b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 59 additions and 85 deletions

View file

@ -1,7 +1,6 @@
#include <iostream> #include <iostream>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <climits>
#include "repl-interacter.hh" #include "repl-interacter.hh"
#include "repl.hh" #include "repl.hh"
@ -10,8 +9,6 @@
#include "shared.hh" #include "shared.hh"
#include "config-global.hh" #include "config-global.hh"
#include "eval.hh" #include "eval.hh"
#include "eval-cache.hh"
#include "eval-inline.hh"
#include "eval-settings.hh" #include "eval-settings.hh"
#include "attr-path.hh" #include "attr-path.hh"
#include "signals.hh" #include "signals.hh"
@ -29,6 +26,7 @@
#include "markdown.hh" #include "markdown.hh"
#include "local-fs-store.hh" #include "local-fs-store.hh"
#include "print.hh" #include "print.hh"
#include "ref.hh"
#if HAVE_BOEHMGC #if HAVE_BOEHMGC
#define GC_INCLUDE_NEW #define GC_INCLUDE_NEW

View file

@ -1,12 +1,10 @@
#include <cstring> #include <cstring>
#include <iostream>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
#include "config.hh"
#include "eval.hh" #include "eval.hh"
#include "eval-gc.hh"
#include "globals.hh" #include "globals.hh"
#include "util.hh"
#include "eval-settings.hh" #include "eval-settings.hh"
#include "nix_api_expr.h" #include "nix_api_expr.h"

View file

@ -5,7 +5,6 @@
#include "symbol-table.hh" #include "symbol-table.hh"
#include <algorithm> #include <algorithm>
#include <optional>
namespace nix { namespace nix {

View file

@ -1,7 +1,5 @@
#pragma once #pragma once
#include <algorithm>
#include "error.hh" #include "error.hh"
#include "pos-idx.hh" #include "pos-idx.hh"

View file

@ -2,6 +2,7 @@
///@file ///@file
#include "config.hh" #include "config.hh"
#include "ref.hh"
namespace nix { namespace nix {

View file

@ -1,6 +1,6 @@
#include "eval.hh" #include "eval.hh"
#include "eval-gc.hh"
#include "eval-settings.hh" #include "eval-settings.hh"
#include "hash.hh"
#include "primops.hh" #include "primops.hh"
#include "print-options.hh" #include "print-options.hh"
#include "exit.hh" #include "exit.hh"
@ -16,7 +16,6 @@
#include "print.hh" #include "print.hh"
#include "filtering-source-accessor.hh" #include "filtering-source-accessor.hh"
#include "memory-source-accessor.hh" #include "memory-source-accessor.hh"
#include "signals.hh"
#include "gc-small-vector.hh" #include "gc-small-vector.hh"
#include "url.hh" #include "url.hh"
#include "fetch-to-store.hh" #include "fetch-to-store.hh"
@ -24,7 +23,6 @@
#include "parser-tab.hh" #include "parser-tab.hh"
#include <algorithm> #include <algorithm>
#include <chrono>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <cstring> #include <cstring>

View file

@ -3,21 +3,21 @@
#include "attr-set.hh" #include "attr-set.hh"
#include "eval-error.hh" #include "eval-error.hh"
#include "eval-gc.hh"
#include "types.hh" #include "types.hh"
#include "value.hh" #include "value.hh"
#include "nixexpr.hh" #include "nixexpr.hh"
#include "symbol-table.hh" #include "symbol-table.hh"
#include "config.hh" #include "config.hh"
#include "experimental-features.hh" #include "experimental-features.hh"
#include "position.hh"
#include "pos-table.hh"
#include "source-accessor.hh" #include "source-accessor.hh"
#include "search-path.hh" #include "search-path.hh"
#include "repl-exit-status.hh" #include "repl-exit-status.hh"
#include "ref.hh"
#include <map> #include <map>
#include <optional> #include <optional>
#include <unordered_map>
#include <mutex>
#include <functional> #include <functional>
namespace nix { namespace nix {

View file

@ -1,5 +1,4 @@
#include "nixexpr.hh" #include "nixexpr.hh"
#include "derivations.hh"
#include "eval.hh" #include "eval.hh"
#include "symbol-table.hh" #include "symbol-table.hh"
#include "util.hh" #include "util.hh"

View file

@ -6,11 +6,8 @@
#include "value.hh" #include "value.hh"
#include "symbol-table.hh" #include "symbol-table.hh"
#include "error.hh"
#include "position.hh"
#include "eval-error.hh" #include "eval-error.hh"
#include "pos-idx.hh" #include "pos-idx.hh"
#include "pos-table.hh"
namespace nix { namespace nix {

View file

@ -1,10 +1,8 @@
#pragma once #pragma once
#include <cinttypes> #include <cstdint>
#include <numeric>
#include <vector> #include <vector>
#include "chunked-vector.hh"
#include "pos-idx.hh" #include "pos-idx.hh"
#include "position.hh" #include "position.hh"
#include "sync.hh" #include "sync.hh"

View file

@ -1,4 +1,3 @@
#include "archive.hh"
#include "derivations.hh" #include "derivations.hh"
#include "downstream-placeholder.hh" #include "downstream-placeholder.hh"
#include "eval-inline.hh" #include "eval-inline.hh"

View file

@ -2,7 +2,6 @@
///@file ///@file
#include <cassert> #include <cassert>
#include <climits>
#include <span> #include <span>
#include "symbol-table.hh" #include "symbol-table.hh"

View file

@ -11,6 +11,8 @@
#include <memory> #include <memory>
#include <nlohmann/json_fwd.hpp> #include <nlohmann/json_fwd.hpp>
#include "ref.hh"
namespace nix { class Store; class StorePath; struct SourceAccessor; } namespace nix { class Store; class StorePath; struct SourceAccessor; }
namespace nix::fetchers { namespace nix::fetchers {

View file

@ -2,12 +2,10 @@
#include "fetchers.hh" #include "fetchers.hh"
#include "cache.hh" #include "cache.hh"
#include "filetransfer.hh" #include "filetransfer.hh"
#include "globals.hh"
#include "store-api.hh" #include "store-api.hh"
#include "archive.hh" #include "archive.hh"
#include "tarfile.hh" #include "tarfile.hh"
#include "types.hh" #include "types.hh"
#include "split.hh"
#include "store-path-accessor.hh" #include "store-path-accessor.hh"
#include "store-api.hh" #include "store-api.hh"
#include "git-utils.hh" #include "git-utils.hh"

View file

@ -1,11 +1,12 @@
#pragma once #pragma once
#include "types.hh"
#include "path.hh"
#include "hash.hh"
#include <optional> #include <optional>
#include "hash.hh"
#include "path.hh"
#include "ref.hh"
#include "types.hh"
namespace nix { namespace nix {
class Store; class Store;
struct SourceAccessor; struct SourceAccessor;

View file

@ -1,14 +1,12 @@
#pragma once #pragma once
///@file ///@file
#include <regex>
#include "types.hh" #include "types.hh"
#include "hash.hh"
#include "fetchers.hh" #include "fetchers.hh"
#include "outputs-spec.hh" #include "outputs-spec.hh"
#include <regex>
#include <variant>
namespace nix { namespace nix {
class Store; class Store;

View file

@ -1,6 +1,7 @@
#include <unordered_set>
#include "lockfile.hh" #include "lockfile.hh"
#include "store-api.hh" #include "store-api.hh"
#include "url-parts.hh"
#include <algorithm> #include <algorithm>
#include <iomanip> #include <iomanip>

View file

@ -8,7 +8,6 @@
#include "signals.hh" #include "signals.hh"
#include <algorithm> #include <algorithm>
#include <cctype>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
@ -23,6 +22,7 @@
#include <openssl/crypto.h> #include <openssl/crypto.h>
#include "exit.hh"
namespace nix { namespace nix {

View file

@ -8,13 +8,9 @@
#include "common-args.hh" #include "common-args.hh"
#include "path.hh" #include "path.hh"
#include "derived-path.hh" #include "derived-path.hh"
#include "exit.hh"
#include <signal.h> #include <signal.h>
#include <locale>
namespace nix { namespace nix {
int handleExceptions(const std::string & programName, std::function<void()> fun); int handleExceptions(const std::string & programName, std::function<void()> fun);

View file

@ -14,7 +14,6 @@
#include <map> #include <map>
#include <variant> #include <variant>
namespace nix { namespace nix {
struct StoreDirConfig; struct StoreDirConfig;

View file

@ -5,6 +5,7 @@
#include "outputs-spec.hh" #include "outputs-spec.hh"
#include "comparator.hh" #include "comparator.hh"
#include "config.hh" #include "config.hh"
#include "ref.hh"
#include <variant> #include <variant>

View file

@ -1,13 +1,15 @@
#pragma once #pragma once
///@file ///@file
#include "types.hh"
#include "hash.hh"
#include "config.hh"
#include <string> #include <string>
#include <future> #include <future>
#include "logging.hh"
#include "types.hh"
#include "ref.hh"
#include "config.hh"
#include "serialise.hh"
namespace nix { namespace nix {
struct FileTransferSettings : Config struct FileTransferSettings : Config

View file

@ -1,8 +1,9 @@
#pragma once #pragma once
///@file ///@file
#include "store-api.hh" #include <unordered_set>
#include "store-api.hh"
namespace nix { namespace nix {

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
///@file ///@file
#include "types.hh" #include "ref.hh"
#include "store-reference.hh" #include "store-reference.hh"
namespace nix { namespace nix {

View file

@ -1,3 +1,5 @@
#include <unordered_set>
#include "derivations.hh" #include "derivations.hh"
#include "parsed-derivations.hh" #include "parsed-derivations.hh"
#include "globals.hh" #include "globals.hh"

View file

@ -3,7 +3,6 @@
#include <map> #include <map>
#include <stack> #include <stack>
#include <algorithm>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
@ -74,7 +73,10 @@ struct NarAccessor : public SourceAccessor
NarMember & createMember(const CanonPath & path, NarMember member) NarMember & createMember(const CanonPath & path, NarMember member)
{ {
size_t level = 0; size_t level = 0;
for (auto _ : path) ++level; for (auto _ : path) {
(void)_;
++level;
}
while (parents.size() > level) parents.pop(); while (parents.size() > level) parents.pop();

View file

@ -10,7 +10,6 @@
#include "serve-protocol.hh" #include "serve-protocol.hh"
#include "length-prefixed-protocol-helper.hh" #include "length-prefixed-protocol-helper.hh"
#include "store-api.hh"
namespace nix { namespace nix {

View file

@ -18,14 +18,10 @@
#include <nlohmann/json_fwd.hpp> #include <nlohmann/json_fwd.hpp>
#include <atomic> #include <atomic>
#include <limits>
#include <map> #include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory> #include <memory>
#include <string> #include <string>
#include <chrono> #include <chrono>
#include <variant>
namespace nix { namespace nix {

View file

@ -1,12 +1,13 @@
#include <vector>
#include <pwd.h>
#include <grp.h>
#include "user-lock.hh" #include "user-lock.hh"
#include "file-system.hh" #include "file-system.hh"
#include "globals.hh" #include "globals.hh"
#include "pathlocks.hh" #include "pathlocks.hh"
#include "users.hh" #include "users.hh"
#include <pwd.h>
#include <grp.h>
namespace nix { namespace nix {
#if __linux__ #if __linux__

View file

@ -1,10 +1,8 @@
#pragma once #pragma once
///@file ///@file
#include "types.hh" #include <memory>
#include <vector>
#include <optional>
#include <sys/types.h> #include <sys/types.h>
namespace nix { namespace nix {

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
///@file ///@file
#include <iostream>
#include <functional> #include <functional>
#include <map> #include <map>
#include <memory> #include <memory>
@ -11,6 +10,7 @@
#include "types.hh" #include "types.hh"
#include "experimental-features.hh" #include "experimental-features.hh"
#include "ref.hh"
namespace nix { namespace nix {

View file

@ -16,16 +16,12 @@
*/ */
#include "suggestions.hh" #include "suggestions.hh"
#include "ref.hh"
#include "types.hh"
#include "fmt.hh" #include "fmt.hh"
#include <cstring> #include <cstring>
#include <list> #include <list>
#include <memory> #include <memory>
#include <map>
#include <optional> #include <optional>
#include <compare>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -127,6 +123,8 @@ protected:
public: public:
BaseError(const BaseError &) = default; BaseError(const BaseError &) = default;
BaseError& operator=(const BaseError &) = default;
BaseError& operator=(BaseError &&) = default;
template<typename... Args> template<typename... Args>
BaseError(unsigned int status, const Args & ... args) BaseError(unsigned int status, const Args & ... args)

View file

@ -2,8 +2,6 @@
///@file ///@file
#include "source-accessor.hh" #include "source-accessor.hh"
#include "fs-sink.hh"
#include "util.hh"
namespace nix { namespace nix {

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
///@file ///@file
#include "types.hh"
#include "serialise.hh" #include "serialise.hh"
#include "source-accessor.hh" #include "source-accessor.hh"
#include "file-system.hh" #include "file-system.hh"

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
///@file ///@file
#include "types.hh"
#include "error.hh" #include "error.hh"
#include "config.hh" #include "config.hh"

View file

@ -1,9 +1,7 @@
#pragma once #pragma once
///@file ///@file
#include <compare>
#include <memory> #include <memory>
#include <exception>
#include <stdexcept> #include <stdexcept>
namespace nix { namespace nix {

View file

@ -4,6 +4,7 @@
#include "canon-path.hh" #include "canon-path.hh"
#include "hash.hh" #include "hash.hh"
#include "ref.hh"
namespace nix { namespace nix {

View file

@ -1,7 +1,8 @@
#pragma once #pragma once
///@file ///@file
#include "types.hh" #include <limits>
#include <string>
namespace nix { namespace nix {
/** /**

View file

@ -1,12 +1,10 @@
#pragma once #pragma once
///@file ///@file
#include "ref.hh"
#include <list> #include <list>
#include <set> #include <set>
#include <string> #include <string>
#include <limits>
#include <map> #include <map>
#include <variant> #include <variant>
#include <vector> #include <vector>

View file

@ -2,13 +2,11 @@
#include "derivations.hh" #include "derivations.hh"
#include "dotgraph.hh" #include "dotgraph.hh"
#include "globals.hh" #include "globals.hh"
#include "build-result.hh"
#include "store-cast.hh" #include "store-cast.hh"
#include "local-fs-store.hh" #include "local-fs-store.hh"
#include "log-store.hh" #include "log-store.hh"
#include "serve-protocol.hh" #include "serve-protocol.hh"
#include "serve-protocol-connection.hh" #include "serve-protocol-connection.hh"
#include "serve-protocol-impl.hh"
#include "shared.hh" #include "shared.hh"
#include "graphml.hh" #include "graphml.hh"
#include "legacy.hh" #include "legacy.hh"
@ -23,12 +21,14 @@
#include <iostream> #include <iostream>
#include <algorithm> #include <algorithm>
#include <cstdio>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include "build-result.hh"
#include "exit.hh"
#include "serve-protocol-impl.hh"
namespace nix_store { namespace nix_store {

View file

@ -1,6 +1,7 @@
#include <sstream> #include <sstream>
#include "command.hh" #include "command.hh"
#include "exit.hh"
#include "logging.hh" #include "logging.hh"
#include "serve-protocol.hh" #include "serve-protocol.hh"
#include "shared.hh" #include "shared.hh"

View file

@ -1,6 +1,8 @@
#include <unordered_set>
#include <queue>
#include "command.hh" #include "command.hh"
#include "run.hh" #include "run.hh"
#include <queue>
using namespace nix; using namespace nix;

View file

@ -19,7 +19,6 @@
#include "users.hh" #include "users.hh"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <queue>
#include <iomanip> #include <iomanip>
using namespace nix; using namespace nix;

View file

@ -1,9 +1,8 @@
#include <algorithm>
#include "args/root.hh" #include "args/root.hh"
#include "current-process.hh" #include "current-process.hh"
#include "command.hh" #include "command.hh"
#include "common-args.hh" #include "common-args.hh"
#include "eval-gc.hh"
#include "eval.hh" #include "eval.hh"
#include "eval-settings.hh" #include "eval-settings.hh"
#include "globals.hh" #include "globals.hh"

View file

@ -1,14 +1,14 @@
#include "command.hh" #include "command.hh"
#include "shared.hh" #include "shared.hh"
#include "store-api.hh" #include "store-api.hh"
#include "sync.hh"
#include "thread-pool.hh" #include "thread-pool.hh"
#include "references.hh"
#include "signals.hh" #include "signals.hh"
#include "keys.hh" #include "keys.hh"
#include <atomic> #include <atomic>
#include "exit.hh"
using namespace nix; using namespace nix;
struct CmdVerify : StorePathsCommand struct CmdVerify : StorePathsCommand

View file

@ -9,9 +9,9 @@
#include "nixexpr.hh" #include "nixexpr.hh"
#include "nixexpr.hh" #include "nixexpr.hh"
#include "eval.hh" #include "eval.hh"
#include "eval-gc.hh"
#include "eval-inline.hh" #include "eval-inline.hh"
#include "eval-settings.hh" #include "eval-settings.hh"
#include "store-api.hh"
#include "tests/libstore.hh" #include "tests/libstore.hh"