From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 4776E3840C0C for ; Wed, 17 Jun 2020 17:29:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4776E3840C0C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-510-T3YH3-MqPOq-Zva5Rv72bA-1; Wed, 17 Jun 2020 13:29:15 -0400 X-MC-Unique: T3YH3-MqPOq-Zva5Rv72bA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 392DEEC1A2; Wed, 17 Jun 2020 17:29:14 +0000 (UTC) Received: from blade.nx (ovpn-115-39.ams2.redhat.com [10.36.115.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF93F5D9D3; Wed, 17 Jun 2020 17:29:13 +0000 (UTC) Received: by blade.nx (Postfix, from userid 1000) id 3C5EF816CCA9; Wed, 17 Jun 2020 18:29:13 +0100 (BST) Date: Wed, 17 Jun 2020 18:29:13 +0100 From: Gary Benson To: Pedro Alves Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [OB PATCH] Build two gdb.cp testcases with -Wno-unused-comparison Message-ID: <20200617172913.GA5386@blade.nx> References: <1590757423-18004-1-git-send-email-gbenson@redhat.com> <87mu5qaa2b.fsf@tromey.com> <68fd1b3e-10ae-8f1d-b96d-f35ce7ae3037@redhat.com> <20200616124212.GB30305@blade.nx> <5b75188a-0c0e-528a-1bbd-213f5fa52bd4@redhat.com> MIME-Version: 1.0 In-Reply-To: <5b75188a-0c0e-528a-1bbd-213f5fa52bd4@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2020 17:29:18 -0000 Pedro Alves wrote: > On 6/16/20 1:42 PM, Gary Benson wrote: > > Pedro Alves wrote: > >> On 5/29/20 7:08 PM, Tom Tromey wrote: > >>>>>>>> "Gary" == Gary Benson via Gdb-patches writes: > >>> > >>> Gary> +if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ > >>> Gary> + {debug c++ additional_flags=-Wno-unused-comparison}] } { > >>> > >>> Won't this cause build (and therefore test) failures if the compiler > >>> does not accept this option? > >> > >> I think that by design, while GCC errors out about unknown -Wfoo warnings, > >> it ignores -Wno-foo, so that you can disable newer warnings without worrying > >> about older compilers: > >> > >> $ gcc main.c -o main -g3 -O0 -Wfoo > >> gcc: error: unrecognized command line option ‘-Wfoo’ > >> $ gcc main.c -o main -g3 -O0 -Wno-foo > > > > Nice. > > > >> However, Clang seems to output a warning in either case: > >> > >> $ clang main.c -o main -g3 -O0 -Wfoo > >> warning: unknown warning option '-Wfoo' [-Wunknown-warning-option] > >> 1 warning generated. > >> $ clang main.c -o main -g3 -O0 -Wno-foo > >> warning: unknown warning option '-Wno-foo' [-Wunknown-warning-option] > >> 1 warning generated. > >> > >> (This was clang 5.0.2) > >> > >> So that new option can break tests with older Clangs that don't > >> know about the option. > > > > Ugh. > > > > clang 9.0.1 behaves the same too: > > > > $ clang -Werror -Wno-step-on-grass test.c > > error: unknown warning option '-Wno-step-on-grass' [-Werror,-Wunknown-warning-option] > > > >> I guess to prevent this sort of thing going forward, we could make > >> gcc_compile always add -Wno-unknown-warning-option to the build > >> flags. I don't know when was that option added to Clang, but maybe > >> it's ancient enough. > > > > Does this buy us much? Any test with a warning I disable for clang is > > a test that didn't compile with clang anyway. > > It didn't compile with the version you tested. Do you know whether > it compiled with older clang versions? No. > In general, the problematic sequence is something like this: > > #1 - A testcase compiles successfully with clang version X. > #2 - clang version "X + 1" adds a new warning, enabled by default, > which breaks the test. > #3 - We add -Wno-newwarning, fixing the testcase with clang "X + 1" > #4 - Now building the test with clang version X no longer works, > due to "unknown warning option". > > Making gcc_compile always add -Wno-unknown-warning-option to the > build flags fixes this problem for good. At least with clang. Right. First, I'm assuming you mean gdb_compile, not gcc_compile? Second, it's not clear whether you mean to add it always, or just if the compiler is clang? Third, is this something you could easily do? Because I've spent nearly an hour on this already, gdb_compile is nearly 250 lines of special cases and I'm no closer to figuring out where I wouldn't break something. Cheers, Gary