Remove constexpr from functions that assert
Assert gets in the way of constexpr. Removes constexpr from some
functions that have assert checks.
Bug: 246
Change-Id: I0c1d8f0db8ced91b8663bb0bb81f23fcbcf56e06
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/16162
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Armando Montanez <amontanez@google.com>
diff --git a/pw_kvs/public/pw_kvs/flash_memory.h b/pw_kvs/public/pw_kvs/flash_memory.h
index 6abf14a..83341ed 100644
--- a/pw_kvs/public/pw_kvs/flash_memory.h
+++ b/pw_kvs/public/pw_kvs/flash_memory.h
@@ -34,12 +34,14 @@
public:
// The flash address is in the range of: 0 to FlashSize.
typedef uint32_t Address;
- constexpr FlashMemory(size_t sector_size,
- size_t sector_count,
- size_t alignment,
- uint32_t start_address = 0,
- uint32_t sector_start = 0,
- std::byte erased_memory_content = std::byte{0xFF})
+
+ // TODO(pwbug/246): This can be constexpr when tokenized asserts are fixed.
+ FlashMemory(size_t sector_size,
+ size_t sector_count,
+ size_t alignment,
+ uint32_t start_address = 0,
+ uint32_t sector_start = 0,
+ std::byte erased_memory_content = std::byte{0xFF})
: sector_size_(sector_size),
flash_sector_count_(sector_count),
alignment_(alignment),
@@ -161,7 +163,8 @@
FlashPartition::Address address_;
};
- constexpr FlashPartition(
+ // TODO(pwbug/246): This can be constexpr when tokenized asserts are fixed.
+ FlashPartition(
FlashMemory* flash,
uint32_t start_sector_index,
uint32_t sector_count,
@@ -184,7 +187,8 @@
}
// Creates a FlashPartition that uses the entire flash with its alignment.
- constexpr FlashPartition(FlashMemory* flash)
+ // TODO(pwbug/246): This can be constexpr when tokenized asserts are fixed.
+ FlashPartition(FlashMemory* flash)
: FlashPartition(
flash, 0, flash->sector_count(), flash->alignment_bytes()) {}