feat: enable `-Wsign-compare`
This enables the `-Wsign-compare` warning everywhere except inside the
`ASSERT_EQ` macro, which will be fixed in later commits.
Change-Id: I485a0e909f23264c662702d996f792e9411ecd2c
Signed-off-by: Karl Meakin <karl.meakin@arm.com>
diff --git a/src/mpool.c b/src/mpool.c
index 0ee7cb8..ed40e6e 100644
--- a/src/mpool.c
+++ b/src/mpool.c
@@ -159,7 +159,8 @@
new_end = (void *)align_down((char *)begin + size, p->entry_size);
/* Nothing to do if there isn't enough room for an entry. */
- if (new_begin >= new_end || new_end - new_begin < p->entry_size) {
+ if (new_begin >= new_end ||
+ (size_t)(new_end - new_begin) < p->entry_size) {
return false;
}
@@ -302,7 +303,7 @@
* Add back the space consumed by the alignment
* requirement, if it's big enough to fit an entry.
*/
- if (start - (char *)chunk >= p->entry_size) {
+ if ((size_t)(start - (char *)chunk) >= p->entry_size) {
chunk->next_chunk = *prev;
*prev = chunk;
chunk->limit = (struct mpool_chunk *)start;