From owner-freebsd-current@freebsd.org Sun Jun 3 21:40:18 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6550AFDFF6C for ; Sun, 3 Jun 2018 21:40:18 +0000 (UTC) (envelope-from theron.tarigo@gmail.com) Received: from mail-pg0-x229.google.com (mail-pg0-x229.google.com [IPv6:2607:f8b0:400e:c05::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D68347EB42 for ; Sun, 3 Jun 2018 21:40:17 +0000 (UTC) (envelope-from theron.tarigo@gmail.com) Received: by mail-pg0-x229.google.com with SMTP id e11-v6so4359866pgq.0 for ; Sun, 03 Jun 2018 14:40:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=tmDvpxIIzUSqKatZDhO/6k1TIjYyrgcAcDJb6GHTkz4=; b=Wo41tlrQsY2iklze8lvxA4Glt0d30TydW57gRVPWDne0uHRJ4zmUpHw/L4RjS3XLQG 0rfquT32hkpH4q9hxfJcVsMX2eFelkMTv6M64Wu4WSEi66kmABaF4/hiVKSsvuJHxIIw Tfkr+MfuWkbCKSWGekQj0+Wt6sP649GV3hNc2ehRPfVPkwBvwdUtX08WFbhBLFait0Zi Q9u4BFDWjDGFzw57P+EzAdzkeo2LIK7wExCfQCjNeJf+X8Iw2mfBbdB8i9tBjEV5Hl2U xdYrtw03bRnoQrcYSVUk9mkRSwndKsKSb198V2MZD8W17Gm6n0q1RycP5L50Q4P9JHPQ A2Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=tmDvpxIIzUSqKatZDhO/6k1TIjYyrgcAcDJb6GHTkz4=; b=Q6GuoH/3U8Eu1FqYxveRJ+lz/3ACvIhxVxLaEo9Qq0wr2FBIXGz2ZoU2s6paVK36q/ m4lw5nROyvhT8zZeGly3crpEcuhDpMcvXNfZ7fJSWraO21CsVqmt6qO4WpequEF5hbUP a4gGxnixhR4fBfkUmwBtdInqL5CgiaJx7rG44qDfrTeOEBC+Qr9yWBQThX7yKePodWMg 7E8MhjyxwnhrOXeX6z2naeJ9SDYrVACVREOB5Dlt0FCCjD0NGr6r3PZLCSn9Rtpfdbir +hDAQUmmm72Edij1RCexDMSGgkbWcum0EaugqqXqwdnYld7iU8+81RG9i7EAshMA2GxC Noug== X-Gm-Message-State: ALKqPwcnA3sUbJ5zX1qZNbGB0aJYEl/HdsA0Gl0WafLfrnOrDcmkNxPj Tf45oYNhw9j9nbTodBB17Sq9BEBI X-Google-Smtp-Source: ADUXVKK1vlCVwG25tYTzG6i06IphLXuqa3M2ekQMXCtaTRsnUL9Nv9Cep97FiTVaXl5dgx4KtJziKQ== X-Received: by 2002:a65:590f:: with SMTP id f15-v6mr15163817pgu.111.1528062016807; Sun, 03 Jun 2018 14:40:16 -0700 (PDT) Received: from [192.168.1.10] (c-73-170-47-221.hsd1.ca.comcast.net. [73.170.47.221]) by smtp.gmail.com with ESMTPSA id x2-v6sm906014pfn.11.2018.06.03.14.40.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Jun 2018 14:40:16 -0700 (PDT) Sender: Theron Tarigo Subject: Re: how to deal with variable set but not used warnings? To: freebsd-current@freebsd.org References: From: Theron Message-ID: Date: Sun, 3 Jun 2018 17:40:15 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2018 21:40:18 -0000 On 06/03/18 17:33, Warner Losh wrote: > On Sun, Jun 3, 2018 at 3:28 PM, Rick Macklem wrote: > >> mmacy has sent me a bunch of warnings of the "variable set but not used" >> kind >> generated by gcc8. >> >> When I've looked at the code, these are for RPC arguments I parse but do >> not >> use at this time. >> I'd like to leave the code in place, since these arguments may be needed >> in the >> future and it is hard to figure out how to get them years from now, when >> they >> might be needed. >> I can think of 3 ways to handle this: >> 1 - Get rid of the code. (As above, I'd rather not do this.) >> 2 - Wrap the code with "#if 0"/"#endif" or similar. I'll admit that I find >> this rather >> ugly and tends to make the code harder to follow. >> 3 - Leave the code and add a comment w.r.t. why the variables are set but >> not used. >> >> So, what do others think is the preferable alternative? >> (Or maybe you have a #4 that seems better than any of these.) >> > 4. Disable the stupid warning in the Makefile / build system. If you don't > care, and there's a good reason for what you are doing (sounds like there > is), better to just disable the warning as so much useless noise. > > Warner > _______________________________________________ > freebsd-current@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" Or possibly, alongside a comment as in (3), use one of these: 5 - Disable warning pragma - http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html 6 - Use __attribute__((unused)) - https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#Common-Variable-Attributes