summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-03-22 16:36:47 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-03-22 17:25:18 -0400
commit3210130993f09d66fa1f21be114cad532fe1974f (patch)
tree494e6f0effaeb08673f49df56a0a65dab9800d2b /process.c
parent348412c7fa0230925c3b1ffc94e64367273da42d (diff)
downloadruby-3210130993f09d66fa1f21be114cad532fe1974f.tar.gz
Suppress a compiler warning on GCC in process.c
rb_pid_t is 32 bits on some platforms, which will cause a warning on GCC due to POSFIXABLE always returning true. include/ruby/internal/arithmetic/fixnum.h:43:31: warning: comparison is always true due to limited range of data type [-Wtype-limits]
Diffstat (limited to 'process.c')
-rw-r--r--process.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/process.c b/process.c
index e6788a0ccc..517b4b3808 100644
--- a/process.c
+++ b/process.c
@@ -9058,7 +9058,15 @@ Init_process(void)
/* pid_t must be signed, since fork() can return -1 */
const rb_pid_t half_max_pidt = (rb_pid_t)1 << (sizeof(rb_pid_t) * CHAR_BIT - 2);
const rb_pid_t max_pidt = 2 * (half_max_pidt - 1) + 1;
+
+ /* rb_pid_t is 32 bits on some platforms, which will cause a warning on GCC
+ * due to POSFIXABLE always returning true. */
+RBIMPL_WARNING_PUSH()
+#if RBIMPL_COMPILER_IS(GCC)
+RBIMPL_WARNING_IGNORED(-Wtype-limits)
+#endif
if (!POSFIXABLE(max_pidt)) rb_gc_register_address(&cached_pid);
+RBIMPL_WARNING_POP()
InitVM(process);
}