From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 95801 invoked by alias); 18 May 2017 11:06:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 95784 invoked by uid 89); 18 May 2017 11:06:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy=thatd, that'd, 5.3, Hx-languages-length:1445 X-HELO: mail-wr0-f169.google.com Received: from mail-wr0-f169.google.com (HELO mail-wr0-f169.google.com) (209.85.128.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 18 May 2017 11:06:11 +0000 Received: by mail-wr0-f169.google.com with SMTP id l50so31112947wrc.3 for ; Thu, 18 May 2017 04:06:14 -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-transfer-encoding; bh=Mf9M+qr3IZMTbe3AZCyoyiE58oOSLv/bSkejBDJxa4g=; b=HVtAege2VGjtFFGY0+UtGYQibw/eBkHQGe17i0xdHQR+q3lKif3tG55+iZQf+tYdrr l+yGh/EBhflEkictJKQzEmZjCg6vFUa2mAnvK/1bQBM6khOyG6U7NUzUYb3mWWU0wjr+ WycD532/UBLF7vMTVi+XCUpwIIRqgPmKOb2aMKgguoaCs+aAjhCKBnyBDKxl20I+1Ipr vR0NWz9XBDxXbkJIyeZCC/IR8ljSLx2iX+1mwf/TKUMkvQJdYzSDgTnPfm6ey53M8W31 KKdjGtoETVDAcPptKx2Evs+1kf9k7WX4fxUdCetib2N4fSRKD6RVUOESDSgZGi97KHOD gRTQ== X-Gm-Message-State: AODbwcCrn1xKEtmCq2qrqYaVNVMuKAkVu0kvCqoH2DqzLDPk6RXPVIgp 4kFOdbxCZ2QTutbI X-Received: by 10.223.162.158 with SMTP id s30mr3004161wra.34.1495105572359; Thu, 18 May 2017 04:06:12 -0700 (PDT) Received: from [192.168.0.102] ([37.189.166.198]) by smtp.gmail.com with ESMTPSA id a24sm5192175wra.17.2017.05.18.04.06.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 04:06:11 -0700 (PDT) Subject: Re: [PATCH OBV] Add nowarnings in gdb.base/fileio.exp To: Yao Qi References: <1495028758-13982-1-git-send-email-yao.qi@linaro.org> <684aa647-c1f4-e0cb-c4d5-04bd55463e20@redhat.com> <86fug28sxu.fsf@gmail.com> Cc: gdb-patches@sourceware.org From: Pedro Alves Message-ID: <9eedfbd7-9f36-2fe4-7a13-00e0b2261629@redhat.com> Date: Thu, 18 May 2017 11:06:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <86fug28sxu.fsf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-05/txt/msg00412.txt.bz2 On 05/18/2017 09:34 AM, Yao Qi wrote: > Pedro Alves writes: > >> FWIW, I think that wrapping the offending code with >> >> #pragma diagnostics push >> #pragma diagnostics ignored "-Wnonnull" >> ... stat (NULL, ...); >> #pragma diagnostics pop >> >> would be appropriate in this case. This testcase is checking that the syscalls >> on the target map back to host I/O on the gdb side, and some targets have >> slightly non-POSIX-like system calls APIs; IMHO, it's better to see warnings >> due to such mismatches instead of potentially silently miscompiling. > > The diagnostic was added in gcc 4.6. Do we require gcc 4.6 to run > testsuite? I am OK with this requirement. I don't think so. I think that'd be the equivalent of saying that we don't support debugging target code built with gcc versions earlier than 4.6. That's a totally different discussion from the discussion about requirements for building gdb. How about an even simpler fix: pass a global pointer variable that happens to be NULL to stat, instead of a NULL literal. The compiler can't prove (without LTO) that the variable may still be NULL, so it doesn't warn. Works on all compilers I tried it on: gcc 3.4/5.3/7, clang 3.7. Let me send a mini series in reply to this email, which does that, and also fixes a few other warnings that compiling the fileio.c with -Wall exposes. Thanks, Pedro Alves