From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3503 invoked by alias); 21 Aug 2010 12:45:21 -0000 Received: (qmail 3486 invoked by uid 22791); 21 Aug 2010 12:45:21 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=BAYES_00,SARE_HELO_EQ_CUST,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from lo.gmane.org (HELO lo.gmane.org) (80.91.229.12) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 21 Aug 2010 12:45:14 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OmnRd-0006Jc-MC for gcc@gcc.gnu.org; Sat, 21 Aug 2010 14:45:09 +0200 Received: from 121.79-160-103.customer.lyse.net ([79.160.103.121]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Aug 2010 14:45:09 +0200 Received: from david.brown by 121.79-160-103.customer.lyse.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 21 Aug 2010 14:45:09 +0200 To: gcc@gcc.gnu.org From: David Brown Subject: Re: Add uninitialized attribute? Date: Sat, 21 Aug 2010 15:23:00 -0000 Message-ID: References: <4C6EEC3C.3000202@codesourcery.com> <4C6F0FE0.1070904@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) In-Reply-To: <4C6F0FE0.1070904@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2010-08/txt/msg00312.txt.bz2 Mark Mitchell wrote: > Bernd Schmidt wrote: > >>>> int x __attribute__ ((uninitialized)); >>>> >>>> to tell compiler that it is OK for "x" to be uninitialized? >> Better to call it "initialized", analogous to attribute used/unused. > > I agree. > >>> I think the general idea is reasonable. I also think it might be worth >>> spending a few minutes thinking about whether we can implement some more >>> general diagnostic suppression mechanism. E.g., >>> int x __attribute__ ((ignore ("-Wuninitialized"))); >> Or this. > > FWIW, I think that's overly ambitious. > There is already an "optimise" function __attribute__ and matching #pragma's that temporarily change the optimisation flags for a function (and a similar set for target flags). For warning messages, there are #pragma's (though no push/pop pragma, AFAIK). Would it be practical to have a "diagnostic" function __attribute__ in the same style? Then at least it would be possible to declare __attribute__((diagnostic("-Wno-uninitialized"))) on the function in question.