Fix some warnings

* Fix unused functions when no `mmap`.

  ```
  shape.c:285:1: warning: unused function 'redblack_insert' [-Wunused-function]
    285 | redblack_insert(redblack_node_t * tree, ID key, rb_shape_t * value)
        | ^~~~~~~~~~~~~~~
  ```

* Fix unknown warning group '-Wmaybe-uninitialized' with clang.

  ```
  thread_win32.c:596:1: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-warning-option]
    596 | COMPILER_WARNING_IGNORED(-Wmaybe-uninitialized)
        | ^
  ```

Co-authored-by: Nobuyoshi Nakada <nobu.nakada@gmail.com>
This commit is contained in:
Raed Rizqie 2024-08-16 13:51:21 +08:00 committed by GitHub
parent c06fbb192f
commit 018bd07f07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2024-08-16 05:51:43 +00:00
Merged: https://github.com/ruby/ruby/pull/11376

Merged-By: nobu <nobu@ruby-lang.org>
2 changed files with 10 additions and 10 deletions

18
shape.c
View File

@ -98,6 +98,15 @@ redblack_find(redblack_node_t * tree, ID key)
}
}
static inline rb_shape_t *
redblack_value(redblack_node_t * node)
{
// Color is stored in the bottom bit of the shape pointer
// Mask away the bit so we get the actual pointer back
return (rb_shape_t *)((uintptr_t)node->value & (((uintptr_t)-1) - 1));
}
#ifdef HAVE_MMAP
static inline char
redblack_color(redblack_node_t * node)
{
@ -110,15 +119,6 @@ redblack_red_p(redblack_node_t * node)
return redblack_color(node) == RED;
}
static inline rb_shape_t *
redblack_value(redblack_node_t * node)
{
// Color is stored in the bottom bit of the shape pointer
// Mask away the bit so we get the actual pointer back
return (rb_shape_t *)((uintptr_t)node->value & (((uintptr_t)-1) - 1));
}
#ifdef HAVE_MMAP
static redblack_id_t
redblack_id_for(redblack_node_t * node)
{

View File

@ -589,7 +589,7 @@ rb_native_cond_destroy(rb_nativethread_cond_t *cond)
{if (!(expr)) {rb_bug("err: %lu - %s", GetLastError(), #expr);}}
COMPILER_WARNING_PUSH
#if defined(__GNUC__)
#if __has_warning("-Wmaybe-uninitialized")
COMPILER_WARNING_IGNORED(-Wmaybe-uninitialized)
#endif
static inline SIZE_T