From owner-freebsd-current@freebsd.org Sun Jun 3 21:43:49 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 815B8FE0853 for ; Sun, 3 Jun 2018 21:43:49 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from mail-io0-x22b.google.com (mail-io0-x22b.google.com [IPv6:2607:f8b0:4001:c06::22b]) (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 146C97F0F0 for ; Sun, 3 Jun 2018 21:43:49 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by mail-io0-x22b.google.com with SMTP id l19-v6so25982855ioj.5 for ; Sun, 03 Jun 2018 14:43:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=7KiM17tltfiIlmjVfJ0vGNee5SHAqeyZBhTLJSm6Vtk=; b=OE9pGQTL79mj6xmmUr90D4GX/kAIoN8VfecFiXaCUe8C7dF9N+ELgj9hASGtQcSRax 9MEE4ieVVN6d4Y8yvCsrzs8aTsr2bEaLN0kpIoSCBReaPBXmCY7EBQy/HaxNhDHWmPwb mw5FtYutCqkas1WxtXXdR1o73pe0XvWj8vHd6pgg2obPP1Yq8CyX1uzloxjXhE0iGZ8P l0jAYkNSRhGO7x2YxFtgrrTonb5KrX35Ut29/7QrxsG3ZxiwPf04iepr/NfstZ7kQEXI CGbrAVh05s9jMfjh4ALUU6o5PeJTE9XSdnunqoy8COFKnxpyPmu3CRevQFBZCcMCTPcz ClyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7KiM17tltfiIlmjVfJ0vGNee5SHAqeyZBhTLJSm6Vtk=; b=Bh6gLSamENTg/bJ0D9gHhOTyU+1TTMJNV8L7dMpIVoKUpkea1yIKUBYsxwQKbr5Qb9 bYNYxNvHYiZAdxecnM8b8BEnto/GxYCJSg9AAM5KQHePz+5FFAHNwaSJk7SnalgHzUMZ 09XfUFUCyYCSmJqoCZJ/UMy9AzNe6S1wCcVvAGv6QwiLMFxGZWQhIxt2BlX3Btq8d/aq buyBsNXeB1iQFZWmK++8mp6+eOH5C4gA62PSq8yk9/Gp0PKSd4ARZKP2C3AE4bjuthyd aYwzA4ybNxlqxi2K023aDfp0IPKP69Y0xzC0RckmGxkMqrcdihmXIWnqZwXzBtZcdi91 Xsdw== X-Gm-Message-State: ALKqPwcfhkZCnPcIbX9/35ZtXsxU+Mm4ebG29mP/BDDQhODPpx21qe9v xCHPQiZeDkFdt2Uy+02GQWyP7Pb+x4W2SNCF0ac= X-Google-Smtp-Source: ADUXVKJg8bph+FJgXAS2qOs8NsezU9vxoq/VhpAI6c9wqEo3+g6ea/KajNjBEmexH+JQKuY55nJfhvS+ebPVQfGs1Iw= X-Received: by 2002:a6b:582:: with SMTP id 124-v6mr11061268iof.94.1528062228350; Sun, 03 Jun 2018 14:43:48 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:8cd:0:0:0:0:0 with HTTP; Sun, 3 Jun 2018 14:43:47 -0700 (PDT) In-Reply-To: References: From: Matthew Macy Date: Sun, 3 Jun 2018 14:43:47 -0700 Message-ID: Subject: Re: how to deal with variable set but not used warnings? To: Theron Cc: freebsd-current@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Mailman-Approved-At: Sun, 03 Jun 2018 22:41:50 +0000 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:43:49 -0000 On Sun, Jun 3, 2018 at 2:40 PM, Theron wrote: >> 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 There is already an __unused alias for #6. It's what I've used to annotate variables that are only used by INVARIANTS builds. It legitimately finds a bunch of dead code. However, 90+% of the instances of the warning are not interesting. -M