From 704fb0b815151504f731c9ddb52cad0b530b545f Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Wed, 4 Nov 2020 18:45:48 +0900 Subject: Suppress a warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` transient_heap.c: In function ‘transient_heap_allocatable_header’: transient_heap.c:347:37: warning: comparison of integer expressions of different signedness: ‘int16_t’ {aka ‘short int’} and ‘long unsigned int’ [-Wsign-compare] 347 | TH_ASSERT(block->info.index <= TRANSIENT_HEAP_USABLE_SIZE); | ^~ ``` --- transient_heap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'transient_heap.c') diff --git a/transient_heap.c b/transient_heap.c index 51886d8dc1..9441aa8d7f 100644 --- a/transient_heap.c +++ b/transient_heap.c @@ -62,7 +62,7 @@ #define TRANSIENT_HEAP_TOTAL_SIZE (1024 * 1024 * 32) /* 32 MB */ #define TRANSIENT_HEAP_ALLOC_MAX (1024 * 2 ) /* 2 KB */ #define TRANSIENT_HEAP_BLOCK_NUM (TRANSIENT_HEAP_TOTAL_SIZE / TRANSIENT_HEAP_BLOCK_SIZE) -#define TRANSIENT_HEAP_USABLE_SIZE TRANSIENT_HEAP_BLOCK_SIZE - sizeof(struct transient_heap_block_header) +#define TRANSIENT_HEAP_USABLE_SIZE (TRANSIENT_HEAP_BLOCK_SIZE - sizeof(struct transient_heap_block_header)) #define TRANSIENT_HEAP_ALLOC_MAGIC 0xfeab #define TRANSIENT_HEAP_ALLOC_ALIGN RUBY_ALIGNOF(void *) @@ -344,7 +344,7 @@ transient_heap_allocatable_header(struct transient_heap* theap, size_t size) struct transient_heap_block *block = theap->using_blocks; while (block) { - TH_ASSERT(block->info.index <= TRANSIENT_HEAP_USABLE_SIZE); + TH_ASSERT(block->info.index <= (int16_t)TRANSIENT_HEAP_USABLE_SIZE); if (TRANSIENT_HEAP_USABLE_SIZE - block->info.index >= size) { struct transient_alloc_header *header = (void *)&block->buff[block->info.index]; -- cgit v1.2.3