diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c2a4fe50..f58df9bc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_COMPILE_WARNING_AS_ERROR ON) option(ICEBERG_BUILD_STATIC "Build static library" ON) option(ICEBERG_BUILD_SHARED "Build shared library" OFF) diff --git a/src/iceberg/file_format.h b/src/iceberg/file_format.h index eebb76d14..8e7396a0b 100644 --- a/src/iceberg/file_format.h +++ b/src/iceberg/file_format.h @@ -26,6 +26,7 @@ #include "iceberg/iceberg_export.h" #include "iceberg/result.h" +#include "iceberg/util/unreachable.h" namespace iceberg { @@ -49,6 +50,8 @@ ICEBERG_EXPORT inline std::string_view ToString(FileFormatType format_type) { case FileFormatType::kPuffin: return "puffin"; } + internal::Unreachable( + std::format("Invalid file format type: {}", static_cast(format_type))); } /// \brief Convert a string to a FileFormatType diff --git a/src/iceberg/manifest_list.h b/src/iceberg/manifest_list.h index ddcc38f73..432397ec1 100644 --- a/src/iceberg/manifest_list.h +++ b/src/iceberg/manifest_list.h @@ -30,6 +30,7 @@ #include "iceberg/result.h" #include "iceberg/schema_field.h" #include "iceberg/type.h" +#include "iceberg/util/unreachable.h" namespace iceberg { @@ -221,6 +222,8 @@ ICEBERG_EXPORT constexpr std::string_view ToString(ManifestFile::Content type) n case ManifestFile::Content::kDeletes: return "deletes"; } + internal::Unreachable( + std::format("Unknown manifest content type: {}", static_cast(type))); } /// \brief Get the relative manifest content type from name diff --git a/src/iceberg/snapshot.h b/src/iceberg/snapshot.h index a16522a88..c52feefbc 100644 --- a/src/iceberg/snapshot.h +++ b/src/iceberg/snapshot.h @@ -28,6 +28,7 @@ #include "iceberg/iceberg_export.h" #include "iceberg/result.h" #include "iceberg/util/timepoint.h" +#include "iceberg/util/unreachable.h" namespace iceberg { @@ -50,6 +51,8 @@ ICEBERG_EXPORT constexpr std::string_view SnapshotRefTypeToString( case SnapshotRefType::kTag: return "tag"; } + internal::Unreachable( + std::format("Invalid snapshot reference type: {}", static_cast(type))); } /// \brief Get the relative snapshot reference type from name ICEBERG_EXPORT constexpr Result SnapshotRefTypeFromString(