ruby-changes:57965
From: Aaron <ko1@a...>
Date: Fri, 27 Sep 2019 06:58:31 +0900 (JST)
Subject: [ruby-changes:57965] f5e8d33761 (master): Fix clang errors when pendantic errors enabled
https://git.ruby-lang.org/ruby.git/commit/?id=f5e8d33761 From f5e8d33761aa2c0d8bec18ba21aeef4bb6940640 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Thu, 26 Sep 2019 14:57:45 -0700 Subject: Fix clang errors when pendantic errors enabled I've been compiling with: ``` set -lx cflags '-std=c99 -Werror=pedantic -pedantic-errors' ``` But compilation would fail with the following: ``` cont.c:296:90: error: format specifies type 'void *' but the argument has type 'struct fiber_pool_stack *' [-Werror,-Wformat-pedantic] if (DEBUG) fprintf(stderr, "fiber_pool_stack_alloca(%p): %"PRIuSIZE"/%"PRIuSIZE"\n", stack, offset, stack->available); ~~ ^~~~~ cont.c:467:24: error: format specifies type 'void *' but the argument has type 'struct fiber_pool *' [-Werror,-Wformat-pedantic] count, fiber_pool, fiber_pool->used, fiber_pool->count, size, fiber_pool->vm_stack_size); ^~~~~~~~~~ cont.c:588:83: error: format specifies type 'void *' but the argument has type 'struct fiber_pool_vacancy *' [-Werror,-Wformat-pedantic] if (DEBUG) fprintf(stderr, "fiber_pool_stack_acquire: %p used=%"PRIuSIZE"\n", fiber_pool->vacancies, fiber_pool->used); ~~ ^~~~~~~~~~~~~~~~~~~~~ cont.c:736:76: error: format specifies type 'void *' but the argument has type 'rb_fiber_t *' (aka 'struct rb_fiber_struct *') [-Werror,-Wformat-pedantic] if (DEBUG) fprintf(stderr, "fiber_stack_release: %p, stack.base=%p\n", fiber, fiber->stack.base); ``` This commit just fixes the pedantic errors diff --git a/cont.c b/cont.c index d19e45a..fe2bcb6 100644 --- a/cont.c +++ b/cont.c @@ -293,7 +293,7 @@ fiber_pool_stack_alloca(struct fiber_pool_stack * stack, size_t offset) https://github.com/ruby/ruby/blob/trunk/cont.c#L293 { STACK_GROW_DIR_DETECTION; - if (DEBUG) fprintf(stderr, "fiber_pool_stack_alloca(%p): %"PRIuSIZE"/%"PRIuSIZE"\n", stack, offset, stack->available); + if (DEBUG) fprintf(stderr, "fiber_pool_stack_alloca(%p): %"PRIuSIZE"/%"PRIuSIZE"\n", (void*)stack, offset, stack->available); VM_ASSERT(stack->available >= offset); // The pointer to the memory being allocated: @@ -464,7 +464,7 @@ fiber_pool_expand(struct fiber_pool * fiber_pool, size_t count) https://github.com/ruby/ruby/blob/trunk/cont.c#L464 if (DEBUG) { fprintf(stderr, "fiber_pool_expand(%"PRIuSIZE"): %p, %"PRIuSIZE"/%"PRIuSIZE" x [%"PRIuSIZE":%"PRIuSIZE"]\n", - count, fiber_pool, fiber_pool->used, fiber_pool->count, size, fiber_pool->vm_stack_size); + count, (void*)fiber_pool, fiber_pool->used, fiber_pool->count, size, fiber_pool->vm_stack_size); } // Iterate over all stacks, initializing the vacancy list: @@ -585,7 +585,7 @@ static struct fiber_pool_stack https://github.com/ruby/ruby/blob/trunk/cont.c#L585 fiber_pool_stack_acquire(struct fiber_pool * fiber_pool) { struct fiber_pool_vacancy * vacancy = fiber_pool_vacancy_pop(fiber_pool); - if (DEBUG) fprintf(stderr, "fiber_pool_stack_acquire: %p used=%"PRIuSIZE"\n", fiber_pool->vacancies, fiber_pool->used); + if (DEBUG) fprintf(stderr, "fiber_pool_stack_acquire: %p used=%"PRIuSIZE"\n", (void*)fiber_pool->vacancies, fiber_pool->used); if (!vacancy) { const size_t maximum = FIBER_POOL_ALLOCATION_MAXIMUM_SIZE; @@ -733,7 +733,7 @@ fiber_stack_release(rb_fiber_t * fiber) https://github.com/ruby/ruby/blob/trunk/cont.c#L733 { rb_execution_context_t *ec = &fiber->cont.saved_ec; - if (DEBUG) fprintf(stderr, "fiber_stack_release: %p, stack.base=%p\n", fiber, fiber->stack.base); + if (DEBUG) fprintf(stderr, "fiber_stack_release: %p, stack.base=%p\n", (void*)fiber, fiber->stack.base); // Return the stack back to the fiber pool if it wasn't already: if (fiber->stack.base) { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/