Skip to content

Commit 9243ff4

Browse files
authored
chore: enable compile warning as error (#125)
Signed-off-by: Junwang Zhao <[email protected]>
1 parent f2a79a1 commit 9243ff4

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ set(CMAKE_CXX_STANDARD 20)
3232
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3333
set(CMAKE_CXX_EXTENSIONS OFF)
3434
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
35+
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
3536

3637
option(ICEBERG_BUILD_STATIC "Build static library" ON)
3738
option(ICEBERG_BUILD_SHARED "Build shared library" OFF)

src/iceberg/file_format.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "iceberg/iceberg_export.h"
2828
#include "iceberg/result.h"
29+
#include "iceberg/util/unreachable.h"
2930

3031
namespace iceberg {
3132

@@ -49,6 +50,8 @@ ICEBERG_EXPORT inline std::string_view ToString(FileFormatType format_type) {
4950
case FileFormatType::kPuffin:
5051
return "puffin";
5152
}
53+
internal::Unreachable(
54+
std::format("Invalid file format type: {}", static_cast<int>(format_type)));
5255
}
5356

5457
/// \brief Convert a string to a FileFormatType

src/iceberg/manifest_list.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "iceberg/result.h"
3131
#include "iceberg/schema_field.h"
3232
#include "iceberg/type.h"
33+
#include "iceberg/util/unreachable.h"
3334

3435
namespace iceberg {
3536

@@ -221,6 +222,8 @@ ICEBERG_EXPORT constexpr std::string_view ToString(ManifestFile::Content type) n
221222
case ManifestFile::Content::kDeletes:
222223
return "deletes";
223224
}
225+
internal::Unreachable(
226+
std::format("Unknown manifest content type: {}", static_cast<int>(type)));
224227
}
225228

226229
/// \brief Get the relative manifest content type from name

src/iceberg/snapshot.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "iceberg/iceberg_export.h"
2929
#include "iceberg/result.h"
3030
#include "iceberg/util/timepoint.h"
31+
#include "iceberg/util/unreachable.h"
3132

3233
namespace iceberg {
3334

@@ -50,6 +51,8 @@ ICEBERG_EXPORT constexpr std::string_view SnapshotRefTypeToString(
5051
case SnapshotRefType::kTag:
5152
return "tag";
5253
}
54+
internal::Unreachable(
55+
std::format("Invalid snapshot reference type: {}", static_cast<int>(type)));
5356
}
5457
/// \brief Get the relative snapshot reference type from name
5558
ICEBERG_EXPORT constexpr Result<SnapshotRefType> SnapshotRefTypeFromString(

0 commit comments

Comments
 (0)