From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 92A09388F047 for ; Tue, 16 Jun 2020 15:11:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 92A09388F047 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-146-yfM_fykEMb-PjqhxGQhVVQ-1; Tue, 16 Jun 2020 11:11:15 -0400 X-MC-Unique: yfM_fykEMb-PjqhxGQhVVQ-1 Received: by mail-wr1-f71.google.com with SMTP id l18so8424855wrm.0 for ; Tue, 16 Jun 2020 08:11:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kHgcxaWhWtTQ82pPs6m1DBXII3vGr/nwqaTytuU15Go=; b=a+T29NvRNF6znLI9fAm8Ha5PkYtZr18Uax/lmazIR4lR0z0OZiF4G6GIX9Xi0MXcXv RWw61x+CnNFw4cER/JuN6cMcBuMMFJ0YAN4EVOTh1gAb/RSRfNUVYnmblKvQpgequgSC Ioub/z/nxTx11CLFJi7SxXZHrb1gZP9yabfTtjoP0/WGvuu/a4hY2WxEl1gdPU5hKDwM 3Q01k/GQnp5rvmVXHIPPsP5/gti29+43IQ89vtLzL5bPnkES3skQJTQnL+Z4odYsjBYI 0fVk7I20OE6AxP2BFTcJOC81ZHyBHYt5jbg+mmweuV3hPA3Cvtjh9mvOCyTHcFEiWGaV nFDQ== X-Gm-Message-State: AOAM533FtOwX7Ft+xwuhPHrWkepjIBQ9FspXlusyOc1FB0CNCOvhKc// Y/xq2G5K9qbnxaB/5fU/gN64BvVE2C+ozyzdrdmAaTIpMsXuJcxNaJjtDb2Xl0jIMlPnrih9eMo /j8bN2N+NRAX8pj4xTNbWog== X-Received: by 2002:a1c:a304:: with SMTP id m4mr3939015wme.49.1592320274002; Tue, 16 Jun 2020 08:11:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8Nadh0FqCuhbnYP9+gRBW0y+Ffyt7g0rfAAE65KUIeQvuvZP4A9O3KzLbP6eUfiZIWUsRMQ== X-Received: by 2002:a1c:a304:: with SMTP id m4mr3938994wme.49.1592320273741; Tue, 16 Jun 2020 08:11:13 -0700 (PDT) Received: from ?IPv6:2001:8a0:f922:c400:56ee:75ff:fe8d:232b? ([2001:8a0:f922:c400:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id x14sm645687wrt.60.2020.06.16.08.11.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Jun 2020 08:11:13 -0700 (PDT) Subject: Re: [OB PATCH] Build two gdb.cp testcases with -Wno-unused-comparison To: Gary Benson 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> Cc: Tom Tromey , gdb-patches@sourceware.org From: Pedro Alves Message-ID: <5b75188a-0c0e-528a-1bbd-213f5fa52bd4@redhat.com> Date: Tue, 16 Jun 2020 16:11:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20200616124212.GB30305@blade.nx> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.7 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_H4, 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: Tue, 16 Jun 2020 15:11:19 -0000 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? 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. Pedro Alves