From owner-freebsd-current@freebsd.org Sun Jun 3 21:33:04 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 65CF9FDEFD7 for ; Sun, 3 Jun 2018 21:33:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) (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 ECFFE7E4AF for ; Sun, 3 Jun 2018 21:33:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22e.google.com with SMTP id t6-v6so17175501iob.10 for ; Sun, 03 Jun 2018 14:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=kDeDyUj2k5TfL2GWbSK+/OvT4+p3jvq+9cPNpT8YkP0=; b=YSufHy9oP4C4BwjlY0I77UNyKGt+c6FavlTgIwAbUKy5qB709UD/j/lteivFM5kAeN +BeDW+ctpThgKZ5lOqdUjKMK47LoSPDaux9139wacx6tr+APU6BlA+C6VAW0jq1xaPm8 9F7BHRcIormlqx0L7b1uEheQfa/U+m3HX1yI+6E9maJ8Zy13S7wqZFk7RnecNAQ2u1mc yxiOU3DOijNO4r17YKe8ql/+eHhFxpwdcMWXymvDV1hlNhftKXDk2dqz906N9mWYSASU eqkU7d8l7uGfZgc5cDRM6bCMnDH/FIhYaPbOak5WY5uM3lq6cVEpunK6RuGKConnwIWY rQxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=kDeDyUj2k5TfL2GWbSK+/OvT4+p3jvq+9cPNpT8YkP0=; b=I/u57bLiqv6jD8tGA4sQe3e1jD/jxi6lYGvJdE/6LFPSu6rRhfgLt6TZgN9lIy0CLD BtCBdqMbUnSpYYuDegF3KMJlTMgObRmGuPze1ACRW94A7ZQZzMBlovsWZX82ZN+vqHi0 ZB6wkn4vyNKBlZplsPPsIujdnhgOx0ETtZVUQVLtQO4Q1QU+Q11I3EhTp+A10UF+H/Fb vxijDQfWSOpl/JhPJ6cyAFyi1BUdOI+y7twhkEoD53yP+02DonWL5yGlW1nzsPcy7Yhd 1Lc3CQCYU98HG/KtMpT52z1kwhhEXbK/lEhWOt1eLRhMn6zfeppi71Qod9bVD+ONn3ek gCCw== X-Gm-Message-State: ALKqPwfdu6Qbye6ClOGtCrP00AZbqQLqtxAkVPymQZqsrbFg8+091KXr aQmUDEfTzEYyAYDmIjH4Ne+eWTNK6C3Vk9YDPK54Qw== X-Google-Smtp-Source: ADUXVKJ2yOzj3jYg0xuIoyUvdLHs31dzpu16b+dBQ4EmL3riiL8KLB5XeG0lOAtop3gHPlYDkZ8ZbkrOQ39K0UxVk34= X-Received: by 2002:a6b:284b:: with SMTP id o72-v6mr18764350ioo.168.1528061583232; Sun, 03 Jun 2018 14:33:03 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 2002:a4f:d028:0:0:0:0:0 with HTTP; Sun, 3 Jun 2018 14:33:02 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: References: From: Warner Losh Date: Sun, 3 Jun 2018 15:33:02 -0600 X-Google-Sender-Auth: PAC8ovYuv4hkqEYLvdmWdWgBawg Message-ID: Subject: Re: how to deal with variable set but not used warnings? To: Rick Macklem Cc: "freebsd-current@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 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:33:04 -0000 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