From: "Earlopain (Earlopain _) via ruby-core" Date: 2026-08-16T14:04:11+00:00 Subject: [ruby-core:126414] [Ruby Misc#15136] Fix -Wparentheses warnings Issue #15136 has been updated by Earlopain (Earlopain _). Status changed from Open to Closed Has been merged ---------------------------------------- Misc #15136: Fix -Wparentheses warnings https://bugs.ruby-lang.org/issues/15136#change-118556 * Author: jaruga (Jun Aruga) * Status: Closed ---------------------------------------- Currently the `-Wno-parentheses` was set. I assumed if we could fix the warning, we could remove the `-Wno-parentheses`. I fixed the warnings, because the warning is used as a default on Fedora Project build environment. I sent pull-request. https://github.com/ruby/ruby/pull/1958 I would show you the explanation of `-Wparentheses`. ``` $ man gcc (or gcc --help --verbose) ... -Wparentheses Warn if parentheses are omitted in certain contexts, such as when there is an assignment in a context where a truth value is expected, or when operators are nested whose precedence people often get confused about. Also warn if a comparison like "x<=y<=z" appears; this is equivalent to "(x<=y ? 1 : 0) <= z", which is a different interpretation from that of ordinary mathematical notation. Also warn for dangerous uses of the GNU extension to "?:" with omitted middle operand. When the condition in the "?": operator is a boolean expression, the omitted value is always 1. Often programmers expect it to be a value computed inside the conditional expression instead. For C++ this also warns for some cases of unnecessary parentheses in declarations, which can indicate an attempt at a function call instead of a declaration: { // Declares a local variable called mymutex. std::unique_lock (mymutex); // User meant std::unique_lock lock (mymutex); } This warning is enabled by -Wall. ... ``` ---Files-------------------------------- make.log (96.1 KB) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/