From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 1C73B385783E for ; Fri, 23 Oct 2020 20:39:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1C73B385783E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=segher@kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 09NKcXZs024530 for ; Fri, 23 Oct 2020 15:38:33 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 09NKcWAx024529 for gcc-help@gcc.gnu.org; Fri, 23 Oct 2020 15:38:32 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 23 Oct 2020 15:38:32 -0500 From: Segher Boessenkool To: mark_at_yahoo via Gcc-help Subject: Re: __attribute__ to selectively disable -Wmaybe-uninitialized Message-ID: <20201023203832.GH2672@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Oct 2020 20:39:35 -0000 On Fri, Oct 23, 2020 at 01:01:13PM -0700, mark_at_yahoo via Gcc-help wrote: > 3. I don't want to disable -Wmaybe-uninitialized globally, or for an > entire function. Warnings are "A Good Thing"(tm). Yes. And you usually should make trivial changes to your program if the compiler warns, even if you consider that unnecessary -- just so that you will not miss other warnings! > 4. Please, no lectures on why local variables should always be > initialized at declaration. No, but you can write your code so that it more obviously does not use unitialised variables. This is an Even Better Thing(tm). The compiler will understand it, but much more importantly, human readers will understand it as well! -Wmaybe-uninitialized has a LOT of false positives if you use anything but the strictest, simplest control flow. It's the nature of the beast. > 5. I now see something similar was requested in 2012 in > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55288 but seems to have > been dismissed with a variation of #4. It wasn't dismissed, that PR is still open. Segher