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 [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id 818C23870872 for ; Fri, 29 May 2020 18:32:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 818C23870872 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-87-V3-p8D6PPzqPDleIpBIP6g-1; Fri, 29 May 2020 14:32:00 -0400 X-MC-Unique: V3-p8D6PPzqPDleIpBIP6g-1 Received: by mail-wm1-f69.google.com with SMTP id g84so926536wmf.4 for ; Fri, 29 May 2020 11:32:00 -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:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Gor14RDt2O89eU5+KHMvzn1EVJmyea2UVVSU4n6uN4w=; b=pSbINUPC/49Vm/LmF3sP7hPL4ngiR2QNITl9DtEhQ6JgcbnRMCXo/dJS1FquAOI7Ow WuA8WfjCWeH5oKR2qBj552pqlrc4r5MfBa6CdQq2tL9bBlpuGrSVaSkxaNM7Tc6JssgA zCEUu+HhYqkHdr4I4O7dlI+inFB4eKgdMPJZYUYyEQsP9XqogbU1iDDlLESDGRQG/vES LfGwnqD1foVNzr8THWgt//lWiuiGv409EaUQJ4Ik4QuPBAuDhHPbp42Dk/4rSBTHM0mf PCgiP/FEl3vhbVduzYZ+Ias3URJxvnT/ywS6nm6+yOQUHR2g/HSd+FEjKzo6MAXeTuhf skvw== X-Gm-Message-State: AOAM533E4vnmCJEwV4zMbgawaayxwlyeRx0Zxv6J1WghFH+WB8I32QCn lX9lBUkq5y1LFYkPJ45fLBKK6Uup+ZX/+XHaCQD4gI/xuhuVQjbFTeAmkmcK0QycXXUbLO8pDtQ KCKYq83CwhN0N21GsGnVT9A== X-Received: by 2002:adf:f2cd:: with SMTP id d13mr9512482wrp.378.1590777119295; Fri, 29 May 2020 11:31:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0mlv7BATl6EMeS3WvPbyZKVTj7kjeEvdnpIxd5vPc2cPL3wBoFK5pZoqNOFbOSmtkR/pwNA== X-Received: by 2002:adf:f2cd:: with SMTP id d13mr9512468wrp.378.1590777119054; Fri, 29 May 2020 11:31:59 -0700 (PDT) Received: from ?IPv6:2001:8a0:f909:7b00:56ee:75ff:fe8d:232b? ([2001:8a0:f909:7b00:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id a10sm319377wmf.46.2020.05.29.11.31.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 May 2020 11:31:58 -0700 (PDT) Subject: Re: [OB PATCH] Build two gdb.cp testcases with -Wno-unused-comparison To: Tom Tromey , Gary Benson via Gdb-patches References: <1590757423-18004-1-git-send-email-gbenson@redhat.com> <87mu5qaa2b.fsf@tromey.com> From: Pedro Alves Message-ID: <68fd1b3e-10ae-8f1d-b96d-f35ce7ae3037@redhat.com> Date: Fri, 29 May 2020 19:31:57 +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: <87mu5qaa2b.fsf@tromey.com> 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=-5.1 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: Fri, 29 May 2020 18:32:04 -0000 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 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. 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. I don't know about other compilers, though. > I wonder if there's a way to fix the warning in the C++ source file > instead. Yeah, me too. Though the idea above could be helpful for other tests/cases. Thanks, Pedro Alves