diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/build_engine/expression/expression.hpp | 7 | ||||
-rw-r--r-- | src/buildtool/execution_api/common/execution_action.hpp | 3 | ||||
-rw-r--r-- | src/buildtool/execution_api/common/execution_response.hpp | 3 | ||||
-rw-r--r-- | src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp | 9 | ||||
-rw-r--r-- | src/buildtool/file_system/file_storage.hpp | 3 | ||||
-rw-r--r-- | src/buildtool/file_system/file_system_manager.hpp | 5 | ||||
-rw-r--r-- | src/buildtool/file_system/git_types.hpp | 4 | ||||
-rw-r--r-- | src/buildtool/logging/log_level.hpp | 3 | ||||
-rw-r--r-- | src/buildtool/logging/log_sink_file.hpp | 3 | ||||
-rw-r--r-- | src/buildtool/main/build_utils.hpp | 3 | ||||
-rw-r--r-- | src/buildtool/main/cli.hpp | 6 | ||||
-rw-r--r-- | src/buildtool/main/exit_codes.hpp | 4 | ||||
-rw-r--r-- | src/buildtool/storage/large_object_cas.hpp | 3 | ||||
-rw-r--r-- | src/buildtool/storage/large_object_cas.tpp | 1 | ||||
-rw-r--r-- | src/other_tools/git_operations/git_ops_types.hpp | 3 | ||||
-rw-r--r-- | src/other_tools/just_mr/cli.hpp | 3 | ||||
-rw-r--r-- | src/other_tools/just_mr/exit_codes.hpp | 5 | ||||
-rw-r--r-- | src/utils/archive/archive_ops.hpp | 3 |
18 files changed, 51 insertions, 20 deletions
diff --git a/src/buildtool/build_engine/expression/expression.hpp b/src/buildtool/build_engine/expression/expression.hpp index e5788e38..eb2a3ca3 100644 --- a/src/buildtool/build_engine/expression/expression.hpp +++ b/src/buildtool/build_engine/expression/expression.hpp @@ -16,6 +16,7 @@ #define INCLUDED_SRC_BUILDTOOL_BUILD_ENGINE_EXPRESSION_EXPRESSION_HPP #include <cstddef> +#include <cstdint> #include <exception> #include <functional> #include <memory> @@ -218,7 +219,11 @@ class Expression { std::size_t pos) const& -> ExpressionPtr const&; [[nodiscard]] auto operator[](std::size_t pos) && -> ExpressionPtr; - enum class JsonMode { SerializeAll, SerializeAllButNodes, NullForNonJson }; + enum class JsonMode : std::uint8_t { + SerializeAll, + SerializeAllButNodes, + NullForNonJson + }; [[nodiscard]] auto ToJson(JsonMode mode = JsonMode::SerializeAll) const -> nlohmann::json; diff --git a/src/buildtool/execution_api/common/execution_action.hpp b/src/buildtool/execution_api/common/execution_action.hpp index 649c634c..a5284ca1 100644 --- a/src/buildtool/execution_api/common/execution_action.hpp +++ b/src/buildtool/execution_api/common/execution_action.hpp @@ -16,6 +16,7 @@ #define INCLUDED_SRC_BUILDTOOL_EXECUTION_API_COMMON_REMOTE_EXECUTION_ACTION_HPP #include <chrono> +#include <cstdint> #include <memory> #include "gsl/gsl" @@ -31,7 +32,7 @@ class IExecutionAction { public: using Ptr = std::unique_ptr<IExecutionAction>; - enum class CacheFlag { + enum class CacheFlag : std::uint8_t { CacheOutput, ///< run and cache, or serve from cache DoNotCacheOutput, ///< run and do not cache, never served from cached FromCacheOnly, ///< do not run, only serve from cache diff --git a/src/buildtool/execution_api/common/execution_response.hpp b/src/buildtool/execution_api/common/execution_response.hpp index c0aa16f8..90c67317 100644 --- a/src/buildtool/execution_api/common/execution_response.hpp +++ b/src/buildtool/execution_api/common/execution_response.hpp @@ -15,6 +15,7 @@ #ifndef INCLUDED_SRC_BUILDTOOL_EXECUTION_API_COMMON_REMOTE_EXECUTION_RESPONSE_HPP #define INCLUDED_SRC_BUILDTOOL_EXECUTION_API_COMMON_REMOTE_EXECUTION_RESPONSE_HPP +#include <cstdint> #include <memory> #include <string> #include <unordered_map> @@ -35,7 +36,7 @@ class IExecutionResponse { // set of paths found in output_directory_symlinks list of the action result using DirSymlinks = std::unordered_set<std::string>; - enum class StatusCode { Failed, Success }; + enum class StatusCode : std::uint8_t { Failed, Success }; IExecutionResponse() = default; IExecutionResponse(IExecutionResponse const&) = delete; diff --git a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp index b78ac36c..cc423428 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp @@ -15,6 +15,7 @@ #ifndef INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_BAZEL_BAZEL_EXECUTION_CLIENT_HPP #define INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_BAZEL_BAZEL_EXECUTION_CLIENT_HPP +#include <cstdint> #include <memory> #include <optional> #include <string> @@ -44,7 +45,13 @@ class BazelExecutionClient { }; struct ExecutionResponse { - enum class State { Failed, Ongoing, Finished, Unknown, Retry }; + enum class State : std::uint8_t { + Failed, + Ongoing, + Finished, + Unknown, + Retry + }; std::string execution_handle{}; State state{State::Unknown}; diff --git a/src/buildtool/file_system/file_storage.hpp b/src/buildtool/file_system/file_storage.hpp index fefd22a7..221fe1dd 100644 --- a/src/buildtool/file_system/file_storage.hpp +++ b/src/buildtool/file_system/file_storage.hpp @@ -15,6 +15,7 @@ #ifndef INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_FILE_STORAGE_HPP #define INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_FILE_STORAGE_HPP +#include <cstdint> #include <filesystem> #include <string> #include <utility> @@ -25,7 +26,7 @@ #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" -enum class StoreMode { +enum class StoreMode : std::uint8_t { // First thread to write conflicting file wins. FirstWins, // Last thread to write conflicting file wins, effectively overwriting diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp index 514fadd2..f035e407 100644 --- a/src/buildtool/file_system/file_system_manager.hpp +++ b/src/buildtool/file_system/file_system_manager.hpp @@ -19,6 +19,7 @@ #include <cerrno> // for errno #include <chrono> #include <cstddef> +#include <cstdint> #include <cstdio> // for std::fopen #include <cstdlib> // std::exit, std::getenv #include <cstring> @@ -984,7 +985,7 @@ class FileSystemManager { } private: - enum class CreationStatus { Created, Exists, Failed }; + enum class CreationStatus : std::uint8_t { Created, Exists, Failed }; static constexpr std::size_t kChunkSize{256}; @@ -1287,7 +1288,7 @@ class FileSystemManager { } private: - enum ErrorCodes { + enum ErrorCodes : std::uint8_t { ERROR_READ_INPUT, // read() input file failed ERROR_OPEN_INPUT, // open() input file failed ERROR_OPEN_OUTPUT, // open() output file failed diff --git a/src/buildtool/file_system/git_types.hpp b/src/buildtool/file_system/git_types.hpp index 52974397..2189c218 100644 --- a/src/buildtool/file_system/git_types.hpp +++ b/src/buildtool/file_system/git_types.hpp @@ -15,7 +15,9 @@ #ifndef INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_GIT_TYPES_HPP #define INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_GIT_TYPES_HPP -enum class GitLookupError { +#include <cstdint> + +enum class GitLookupError : std::uint8_t { Fatal = 0, NotFound = 1, }; diff --git a/src/buildtool/logging/log_level.hpp b/src/buildtool/logging/log_level.hpp index 65b7b7c2..12e4af7f 100644 --- a/src/buildtool/logging/log_level.hpp +++ b/src/buildtool/logging/log_level.hpp @@ -17,12 +17,13 @@ #include <algorithm> #include <cmath> +#include <cstdint> #include <string> #include <type_traits> #include "gsl/gsl" -enum class LogLevel { +enum class LogLevel : std::uint8_t { Error, ///< Error messages, fatal errors Warning, ///< Warning messages, recoverable situations that shouldn't occur Info, ///< Informative messages, such as reporting status or statistics diff --git a/src/buildtool/logging/log_sink_file.hpp b/src/buildtool/logging/log_sink_file.hpp index f99ce769..20bae2e6 100644 --- a/src/buildtool/logging/log_sink_file.hpp +++ b/src/buildtool/logging/log_sink_file.hpp @@ -15,6 +15,7 @@ #ifndef INCLUDED_SRC_BUILDTOOL_LOGGING_LOG_SINK_FILE_HPP #define INCLUDED_SRC_BUILDTOOL_LOGGING_LOG_SINK_FILE_HPP +#include <cstdint> #include <cstdio> #include <filesystem> #include <functional> @@ -64,7 +65,7 @@ class MutexMap { class LogSinkFile final : public ILogSink { public: - enum class Mode { + enum class Mode : std::uint8_t { Append, ///< Append if log file already exists. Overwrite ///< Overwrite log file with each new program instantiation. }; diff --git a/src/buildtool/main/build_utils.hpp b/src/buildtool/main/build_utils.hpp index 2ea69025..f8f0a470 100644 --- a/src/buildtool/main/build_utils.hpp +++ b/src/buildtool/main/build_utils.hpp @@ -16,6 +16,7 @@ #define INCLUDED_SRC_BUILDOOL_MAIN_BUILD_UTILS_HPP #include <cstddef> +#include <cstdint> #include <functional> #include <map> #include <optional> @@ -47,7 +48,7 @@ std::unordered_map<TargetCacheKey, AnalysedTargetPtr> const& cache_targets) -> std::vector<ArtifactDescription>; -enum class TargetCacheWriteStrategy { +enum class TargetCacheWriteStrategy : std::uint8_t { Disable, ///< Do not create target-level cache entries Sync, ///< Create target-level cache entries after syncing the artifacts Split ///< Create target-level cache entries after syncing the artifacts; diff --git a/src/buildtool/main/cli.hpp b/src/buildtool/main/cli.hpp index d68cba4b..7717d16c 100644 --- a/src/buildtool/main/cli.hpp +++ b/src/buildtool/main/cli.hpp @@ -15,9 +15,11 @@ #ifndef INCLUDED_SRC_BUILDTOOL_MAIN_CLI #define INCLUDED_SRC_BUILDTOOL_MAIN_CLI +#include <cstdint> + #include "src/buildtool/common/cli.hpp" -enum class SubCommand { +enum class SubCommand : std::uint8_t { kUnknown, kVersion, kDescribe, @@ -34,7 +36,6 @@ enum class SubCommand { }; struct CommandLineArguments { - SubCommand cmd{SubCommand::kUnknown}; CommonArguments common; LogArguments log; AnalysisArguments analysis; @@ -56,6 +57,7 @@ struct CommandLineArguments { GcArguments gc; ToAddArguments to_add; ProtocolArguments protocol; + SubCommand cmd{SubCommand::kUnknown}; }; auto ParseCommandLineArguments(int argc, diff --git a/src/buildtool/main/exit_codes.hpp b/src/buildtool/main/exit_codes.hpp index ff30a5f2..c690c22c 100644 --- a/src/buildtool/main/exit_codes.hpp +++ b/src/buildtool/main/exit_codes.hpp @@ -15,7 +15,9 @@ #ifndef INCLUDED_SRC_BUILDTOOL_MAIN_EXIT_CODES_HPP #define INCLUDED_SRC_BUILDTOOL_MAIN_EXIT_CODES_HPP -enum ExitCodes { +#include <cstdint> + +enum ExitCodes : std::uint8_t { kExitSuccess = 0, kExitFailure = 1, kExitSuccessFailedArtifacts = 2 diff --git a/src/buildtool/storage/large_object_cas.hpp b/src/buildtool/storage/large_object_cas.hpp index 8a6986ee..d32846ae 100644 --- a/src/buildtool/storage/large_object_cas.hpp +++ b/src/buildtool/storage/large_object_cas.hpp @@ -15,6 +15,7 @@ #ifndef INCLUDED_SRC_BUILDTOOL_STORAGE_LARGE_OBJECT_CAS_HPP #define INCLUDED_SRC_BUILDTOOL_STORAGE_LARGE_OBJECT_CAS_HPP +#include <cstdint> #include <filesystem> #include <optional> #include <string> @@ -32,7 +33,7 @@ template <bool> class LocalCAS; -enum class LargeObjectErrorCode { +enum class LargeObjectErrorCode : std::uint8_t { /// \brief An internal error occured. Internal = 0, diff --git a/src/buildtool/storage/large_object_cas.tpp b/src/buildtool/storage/large_object_cas.tpp index 4d2a1a6c..c2b08b45 100644 --- a/src/buildtool/storage/large_object_cas.tpp +++ b/src/buildtool/storage/large_object_cas.tpp @@ -16,7 +16,6 @@ #define INCLUDED_SRC_BUILDTOOL_STORAGE_LARGE_OBJECT_CAS_TPP #include <cstddef> -#include <cstdint> #include <cstdlib> #include <fstream> diff --git a/src/other_tools/git_operations/git_ops_types.hpp b/src/other_tools/git_operations/git_ops_types.hpp index 2c60b086..0b9f50c4 100644 --- a/src/other_tools/git_operations/git_ops_types.hpp +++ b/src/other_tools/git_operations/git_ops_types.hpp @@ -15,6 +15,7 @@ #ifndef INCLUDED_SRC_OTHER_TOOLS_GIT_OPERATIONS_GIT_OPS_TYPES_HPP #define INCLUDED_SRC_OTHER_TOOLS_GIT_OPERATIONS_GIT_OPS_TYPES_HPP +#include <cstdint> #include <filesystem> #include <optional> #include <string> @@ -53,7 +54,7 @@ struct GitOpParams { }; /// \brief Defines the type of Git operation -enum class GitOpType { +enum class GitOpType : std::uint8_t { DEFAULT_OP, // default value; does nothing INITIAL_COMMIT, ENSURE_INIT, diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index 9543689e..c7243588 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -16,6 +16,7 @@ #define INCLUDED_SRC_OTHER_TOOLS_JUST_MR_CLI_HPP #include <cstddef> +#include <cstdint> #include <filesystem> #include <optional> #include <string> @@ -101,7 +102,7 @@ struct ForwardOnlyArguments { std::vector<std::string> remote_execution_properties{}; }; -enum class SubCommand { +enum class SubCommand : std::uint8_t { kUnknown, kMRVersion, kFetch, diff --git a/src/other_tools/just_mr/exit_codes.hpp b/src/other_tools/just_mr/exit_codes.hpp index e4402538..9c327619 100644 --- a/src/other_tools/just_mr/exit_codes.hpp +++ b/src/other_tools/just_mr/exit_codes.hpp @@ -15,7 +15,10 @@ #ifndef INCLUDED_SRC_OTHER_TOOLS_JUST_MR_EXIT_CODES_HPP #define INCLUDED_SRC_OTHER_TOOLS_JUST_MR_EXIT_CODES_HPP -enum JustMRExitCodes { +#include <cstdint> + +// NOLINTNEXTLINE(performance-enum-size) +enum JustMRExitCodes : std::uint16_t { kExitSuccess = 0, kExitExecError = 64, // error in execvp kExitGenericFailure = 65, // none of the known errors diff --git a/src/utils/archive/archive_ops.hpp b/src/utils/archive/archive_ops.hpp index 89151790..972b65b6 100644 --- a/src/utils/archive/archive_ops.hpp +++ b/src/utils/archive/archive_ops.hpp @@ -16,6 +16,7 @@ #define INCLUDED_SRC_UTILS_ARCHIVE_ARCHIVE_OPS_HPP #include <cstddef> +#include <cstdint> #include <filesystem> #include <optional> @@ -26,7 +27,7 @@ using archive = struct archive; using archive_entry = struct archive_entry; } -enum class ArchiveType : std::size_t { +enum class ArchiveType : std::uint8_t { Zip, _7Zip, ZipAuto, // autodetect zip-like archives |