[前][次][番号順一覧][スレッド一覧]

ruby-changes:60970

From: Nobuyoshi <ko1@a...>
Date: Fri, 1 May 2020 19:32:59 +0900 (JST)
Subject: [ruby-changes:60970] dc3bc425bb (master): Get rid of -Wgnu-folding-constant errors

https://git.ruby-lang.org/ruby.git/commit/?id=dc3bc425bb

From dc3bc425bb7fd505bd7ee45ff88246b528614004 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 1 May 2020 18:46:09 +0900
Subject: Get rid of -Wgnu-folding-constant errors

Also renamed as like as a constant.

diff --git a/thread_pthread.c b/thread_pthread.c
index f5eebf5..ee2f7bc 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1572,14 +1572,17 @@ setup_communication_pipe_internal(int pipes[2]) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1572
 # define SET_CURRENT_THREAD_NAME(name) prctl(PR_SET_NAME, name)
 #endif
 
+enum {
+    THREAD_NAME_MAX =
 #if defined(__linux__)
-static const size_t thread_name_max = 16;
+    16
 #elif defined(__APPLE__)
 /* Undocumented, and main thread seems unlimited */
-static const size_t thread_name_max = 64;
+    64
 #else
-static const size_t thread_name_max = 16;
+    16
 #endif
+};
 
 static VALUE threadptr_invoke_proc_location(rb_thread_t *th);
 
@@ -1593,7 +1596,7 @@ native_set_thread_name(rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1596
     }
     else if ((loc = threadptr_invoke_proc_location(th)) != Qnil) {
         char *name, *p;
-        char buf[thread_name_max];
+        char buf[THREAD_NAME_MAX];
         size_t len;
         int n;
 
@@ -1619,7 +1622,7 @@ static void https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1622
 native_set_another_thread_name(rb_nativethread_id_t thread_id, VALUE name)
 {
 #if defined SET_ANOTHER_THREAD_NAME || defined SET_CURRENT_THREAD_NAME
-    char buf[thread_name_max];
+    char buf[THREAD_NAME_MAX];
     const char *s = "";
 # if !defined SET_ANOTHER_THREAD_NAME
     if (!pthread_equal(pthread_self(), thread_id)) return;
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]