From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13307 invoked by alias); 17 Oct 2014 15:53:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 13295 invoked by uid 89); 17 Oct 2014 15:53:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Oct 2014 15:53:53 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Xf9qe-000533-JX from joseph_myers@mentor.com ; Fri, 17 Oct 2014 08:53:48 -0700 Received: from digraph.polyomino.org.uk (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.181.6; Fri, 17 Oct 2014 16:53:47 +0100 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.82) (envelope-from ) id 1Xf9qc-0007L7-VI; Fri, 17 Oct 2014 15:53:47 +0000 Date: Fri, 17 Oct 2014 15:55:00 -0000 From: "Joseph S. Myers" To: Marek Polacek CC: GCC Patches Subject: Re: [C PATCH] Enable initializing statics with COMPOUND_LITERAL_EXPR in C99 (PR c/63567) In-Reply-To: <20141017112544.GR10501@redhat.com> Message-ID: References: <20141017112544.GR10501@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2014-10/txt/msg01757.txt.bz2 On Fri, 17 Oct 2014, Marek Polacek wrote: > Building Linux kernel failed with 'error: initializer element is not > constant', because they're initializing objects with static storage > duration with (T){ ...} - and that isn't permitted in gnu99/gnu11. > > I think the Right Thing is to allow some latitude here and enable it > even in gnu99/gnu11 unless -pedantic. In gnu89, this will work as > before even with -pedantic. The Right Thing is for -pedantic not to cause errors, only warnings (-pedantic-errors being needed for an error). So rather than having this conditional for whether to allow the extension at all, make the conditional code do a pedwarn (if flag_isoc99, otherwise there will already have been one for using a compound literal at all, and not for VECTOR_TYPE). (I don't believe this can affect the semantics of valid code; in this case of require_constant with a compound literal, we know the code is invalid in ISO C terms, so it's safe to diagnose it then interpret it in a sensible way.) -- Joseph S. Myers joseph@codesourcery.com