From nobody Sat May 29 14:09:40 2021 X-Original-To: ruby@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 78CE5BF0BCF for ; Sat, 29 May 2021 14:09:40 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fsk2X2Sv3z3FrV for ; Sat, 29 May 2021 14:09:40 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BDF73A17 for ; Sat, 29 May 2021 14:09:40 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 14TE9eF6071118 for ; Sat, 29 May 2021 14:09:40 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 14TE9eo5071117 for ruby@FreeBSD.org; Sat, 29 May 2021 14:09:40 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: ruby@FreeBSD.org Subject: [Bug 255910] lang/ruby26 lang/ruby27: Fix clang 12 -Wcompound-token-split-by-macro warning in ruby.h Date: Sat, 29 May 2021 14:09:40 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: ruby@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: FreeBSD-specific Ruby discussions List-Archive: https://lists.freebsd.org/archives/freebsd-ruby List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ruby@freebsd.org X-BeenThere: freebsd-ruby@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D255910 --- Comment #4 from commit-hook@FreeBSD.org --- A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=3D6f95cc52457d9c074ce91cdbd652a78= 2424e41ee commit 6f95cc52457d9c074ce91cdbd652a782424e41ee Author: Dimitry Andric AuthorDate: 2021-05-15 17:12:06 +0000 Commit: Dimitry Andric CommitDate: 2021-05-29 14:08:19 +0000 lang/ruby{26,27}: work around clang 12 -Wcompound-token-split-by-macro warning During an exp-run for llvm 12 (see bug 255570), it turned out that several ruby gem extensions do not build with clang 12.0.0, for example devel/rubygem-thrift: compiling binary_protocol_accelerated.c binary_protocol_accelerated.c:404:68: error: '(' and '{' tokens introdu= cing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro] VALUE thrift_binary_protocol_class =3D rb_const_get(thrift_module, rb_intern("BinaryProtocol")); =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/ruby-2.7/ruby/ruby.h:1847:23: note: expanded from ma= cro 'rb_intern' __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \ ^ binary_protocol_accelerated.c:404:68: note: '{' token is here VALUE thrift_binary_protocol_class =3D rb_const_get(thrift_module, rb_intern("BinaryProtocol")); =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/ruby-2.7/ruby/ruby.h:1847:24: note: expanded from ma= cro 'rb_intern' __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/ruby-2.7/ruby/ruby.h:1832:5: note: expanded from mac= ro 'RUBY_CONST_ID_CACHE' { \ ^ and similarly www/unit-ruby: src/ruby/nxt_ruby.c:242:21: error: '(' and '{' tokens introducing state= ment expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro] nxt_ruby_call =3D rb_intern("call"); ^~~~~~~~~~~~~~~~~ /usr/local/include/ruby-2.7/ruby/ruby.h:1847:23: note: expanded from ma= cro 'rb_intern' __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \ ^ src/ruby/nxt_ruby.c:242:21: note: '{' token is here nxt_ruby_call =3D rb_intern("call"); ^~~~~~~~~~~~~~~~~ /usr/local/include/ruby-2.7/ruby/ruby.h:1847:24: note: expanded from ma= cro 'rb_intern' __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/ruby-2.7/ruby/ruby.h:1832:5: note: expanded from mac= ro 'RUBY_CONST_ID_CACHE' { \ ^ The gem extensions appear to purposefully compile using -Werror, and this new -Wcompound-token-split-by-macro is enabled by default in clang 12 and later. Of course we could go over all these extensions, and either remove -Werror or add -Wno-compound-token-split-by-macro, but that seems quite a lot of effort. Instead, I have submitted a pull request to ruby's GitHub, which fixes this by modifying the main ruby.h header: * Add RUBY_CONST_ID_CACHE_NB() (i.e. no-brace) which contains the code itself, without any braces * RUBY_CONST_ID_CACHE() which uses RUBY_CONST_ID_CACHE_NB(), but puts braces around it (so no existing code using this macro breaks) * Finally, change rb_intern() so the __extension__ directly creates a gcc statement expression, using the RUBY_CONST_ID_CACHE_NB() macro Patch this locally in our lang/ruby26 and lang/ruby27 ports for now, until upstream manages to get this in. Approved by: maintainer timeout (2 weeks) PR: 255910 MFH: 2021Q2 lang/ruby26/files/patch-include_ruby_ruby.h (new) | 29 +++++++++++++++++++= ++++ lang/ruby27/files/patch-include_ruby_ruby.h (new) | 29 +++++++++++++++++++= ++++ 2 files changed, 58 insertions(+) --=20 You are receiving this mail because: You are the assignee for the bug.=