From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id CEB351F5AE for ; Tue, 4 May 2021 22:58:18 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 7D0CC120EAE; Wed, 5 May 2021 07:57:14 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id B6BC3120EA7 for ; Wed, 5 May 2021 07:57:11 +0900 (JST) Received: by filterdrecv-6bd97c8c5f-p4nzn with SMTP id filterdrecv-6bd97c8c5f-p4nzn-1-6091D185-10 2021-05-04 22:58:13.17046352 +0000 UTC m=+524350.961100738 Received: from herokuapp.com (unknown) by ismtpd0139p1iad2.sendgrid.net (SG) with ESMTP id FPZVUZwyTM2Ep4RRHZDK7Q for ; Tue, 04 May 2021 22:58:13.058 +0000 (UTC) Date: Tue, 04 May 2021 22:58:13 +0000 (UTC) From: mame@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 17752 X-Redmine-Issue-Author: Eregon X-Redmine-Issue-Assignee: Eregon X-Redmine-Sender: mame X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 79765 X-SG-EID: =?us-ascii?Q?EJh2gqwnyqXtd++xo=2FinyA1V0bXouTB4FkWnzNiKb480H2oMG1GQvRlT8TTbzK?= =?us-ascii?Q?Rmd7SLgELQv7fUxlnM42i+2LU65hUVI7QxOtDZU?= =?us-ascii?Q?IPexsZInuC9Xi7CC7f514Mt7x+qfmujHYNEDr8Q?= =?us-ascii?Q?1UFbAJ9AQj3agj9XfIQ1wVuJFI0WP=2FL9MJmNS3u?= =?us-ascii?Q?R=2F54kc6xZyYV45ybuGHZOQULaZ3J1CMyD1g=3D=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 103718 Subject: [ruby-core:103718] [Ruby master Feature#17752] Enable -Wundef for C extensions in repository X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17752 has been updated by mame (Yusuke Endoh). Maybe [icc 2021.2 x64](http://rubyci.s3.amazonaws.com/icc-x64/ruby-master/log/20210504T190003Z.fail.html.gz) is also broken. ---------------------------------------- Feature #17752: Enable -Wundef for C extensions in repository https://bugs.ruby-lang.org/issues/17752#change-91812 * Author: Eregon (Benoit Daloze) * Status: Assigned * Priority: Normal * Assignee: Eregon (Benoit Daloze) * Target version: 3.1 ---------------------------------------- I would like to enable `-Wundef` for C extensions built/bundled with CRuby. >From https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html > -Wundef > Warn if an undefined identifier is evaluated in an #if directive. Such identifiers are replaced with zero. I found this warning to be quite useful, notably when investigating why a given C extension did not include some code I expected, and then building those extensions on TruffleRuby. There are a couple places not respecting this currently but they seem trivial to fix, I can do that. For instance a confusing case is: https://github.com/ruby/ruby/blob/9143d21b1bf2f16b1e847d569a588510726d8860/ext/nkf/nkf-utf8/nkf.h#L19 ``` #if DEFAULT_NEWLINE == 0x0D0A ``` which without -Wundef would just exclude the code without any warning if DEFAULT_NEWLINE is not defined. I'm not sure if we should/can enable it for C extensions in general (installed as gems), as if a C extensions uses -Werror and would have such a warning it would no longer build. I can make a PR for this. I'm not sure where to add -Wundef though, should it be in https://github.com/ruby/ruby/blob/9143d21b1bf2f16b1e847d569a588510726d8860/configure.ac#L620, or maybe in mkmf.rb? ---Files-------------------------------- ruby-USE_BACKTRACE.patch (1.21 KB) ruby-BIGNUM_EMBED_LEN_MAX.patch (950 Bytes) ruby-COROUTINE_LIMITED_ADDRESS_SPACE.patch (711 Bytes) ruby-trivial-undefined-macros.patch (4.35 KB) ruby-trivial-undefind-macros-0002.patch (1.44 KB) -- https://bugs.ruby-lang.org/