From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 772DB3939C35 for ; Tue, 23 Jun 2020 11:53:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 772DB3939C35 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-355-1ymTBHwrP7OgzyyWadj9lg-1; Tue, 23 Jun 2020 07:53:09 -0400 X-MC-Unique: 1ymTBHwrP7OgzyyWadj9lg-1 Received: by mail-wm1-f71.google.com with SMTP id r1so3823789wmh.7 for ; Tue, 23 Jun 2020 04:53:09 -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=r4keiZqOMgJC60yHkQEh3YH66STNWrJeN5eQzpHJcnE=; b=KlhlEEycfHPWTQErFx0xVpBPnBm7E5qc07fHDr5zSr+fbL/Woq3Ri5zmJc+3Yvsfas KF9A7/W/ljAAIB05trkzrv16H/3DX6IcwJRNpzLRtUKKY1+XtD7YUHI6DoVB1Ymur8HC QavO9N1KPU+Qdivn/kdRoKmh5gx1DrRbca6QN7pG6pPOxTTpKziInp9WxQvooIcmZST2 ETbh2yMf/BiQw9RkhEe7bGjvflZL597Py2ixBGtESpmBlQwoBIgiOdhGW1NR+b40i/ld XGpyAMEAYdwIf4PfehGiDqxhR+4wQsR86x4GS3kVKObbVRpoFa12iAnKQBjAQLMx8PL9 LzKw== X-Gm-Message-State: AOAM533q1L7CYxYwiZNiFuf27IiXHwyAHlpxcm3I/cW+4AsAHVaBbG3D RJbUW+5ASJO7+t5BzPXFggoxfROnadkkYmrJv4Rl/jHFriEznWNFG8PLnGx++VPH0mrE9iK6W+S 4S3t/tH7xz4ekDFc0On0V2Q== X-Received: by 2002:adf:ab08:: with SMTP id q8mr24055152wrc.216.1592913188219; Tue, 23 Jun 2020 04:53:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYgMfpLXbVB3uUPQG+frhBS/YuA06uBflM98yBET0EePhoknNhy5/43AOo5cnUfPGgdcqLRA== X-Received: by 2002:adf:ab08:: with SMTP id q8mr24055134wrc.216.1592913188002; Tue, 23 Jun 2020 04:53:08 -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 v24sm25670945wrd.92.2020.06.23.04.53.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Jun 2020 04:53:07 -0700 (PDT) Subject: Re: [OB PATCH] Avoid testcase build failures with -Wunused-value To: Gary Benson References: <1592911602-4914-1-git-send-email-gbenson@redhat.com> <27d9d693-8afb-d07f-6d14-d867d42babdd@redhat.com> <20200623114529.GA5308@blade.nx> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <296de4f4-c399-c6d5-f250-12b9c652e528@redhat.com> Date: Tue, 23 Jun 2020 12:53:04 +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: <20200623114529.GA5308@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: 7bit 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_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: Tue, 23 Jun 2020 11:53:12 -0000 On 6/23/20 12:45 PM, Gary Benson wrote: > Pedro Alves wrote: >> On 6/23/20 12:26 PM, Gary Benson via Gdb-patches wrote: >>> --- a/gdb/testsuite/gdb.cp/namespace.cc >>> +++ b/gdb/testsuite/gdb.cp/namespace.cc >>> @@ -150,22 +150,22 @@ namespace C >>> // plan to have GDB try to print out, just to make sure that the >>> // compiler and I agree which ones should be legal! It's easy >>> // to screw up when testing the boundaries of namespace stuff. >>> - c; >>> + int unused1 = c; >> >> It looks like such a fix will only work until the compiler decides >> to enable -Wunused-variable by default too: >> >> testsuite/gdb.cp/namespace.cc:153:11: warning: unused variable 'unused' [-Wunused-variable] >> int unused = c; >> ^ >> >> Try compiling the testcase with -Wall, with both g++ and clang++: >> >> $ clang++ testsuite/gdb.cp/namespace.cc -Wall >> >> I think we should fix this with the more usual cast-to-void way: >> >> (void) c; > > Ok, but, out of interest, what stops the compiler ignoring that? I don't know. That's a pattern people have been using ages, it may be special cased. Thanks, Pedro Alves