From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17089 invoked by alias); 10 Aug 2007 18:46:28 -0000 Received: (qmail 17015 invoked by uid 22791); 10 Aug 2007 18:46:27 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 10 Aug 2007 18:46:21 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l7AIjBAN017662; Fri, 10 Aug 2007 14:45:11 -0400 Received: from post-office.corp.redhat.com (post-office.corp.redhat.com [10.11.254.111]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l7AIjB7n027707; Fri, 10 Aug 2007 14:45:11 -0400 Received: from greed.delorie.com (vpn-14-110.rdu.redhat.com [10.11.14.110]) by post-office.corp.redhat.com (8.13.8/8.13.8) with ESMTP id l7AIjAYO021555; Fri, 10 Aug 2007 14:45:10 -0400 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1]) by greed.delorie.com (8.13.8/8.13.8) with ESMTP id l7AIjAYk023078; Fri, 10 Aug 2007 14:45:10 -0400 Received: (from dj@localhost) by greed.delorie.com (8.13.8/8.13.8/Submit) id l7AIjA8W023075; Fri, 10 Aug 2007 14:45:10 -0400 Date: Fri, 10 Aug 2007 18:46:00 -0000 Message-Id: <200708101845.l7AIjA8W023075@greed.delorie.com> From: DJ Delorie To: lopezibanez@gmail.com CC: gdr@cs.tamu.edu, mark@codesourcery.com, ghazi@caip.rutgers.edu, gcc-patches@gcc.gnu.org In-reply-to: <6c33472e0708100303u18003efer69d4b45d7dc1ed58@mail.gmail.com> (lopezibanez@gmail.com) Subject: Re: Add a __nowarn__ keyword References: <46B9F0B5.1080302@gnu.org> <20070809143028.GA14681@caradoc.them.org> <6c33472e0708090805t210191f6r63832af3afdd0816@mail.gmail.com> <200708091531.l79FVI4w032104@greed.delorie.com> <46BB93CD.7070300@codesourcery.com> <87hcn8885y.fsf@soliton.cs.tamu.edu> <200708100200.l7A20oe8001939@greed.delorie.com> <200708100327.l7A3RUbm005253@greed.delorie.com> <6c33472e0708100303u18003efer69d4b45d7dc1ed58@mail.gmail.com> X-IsSubscribed: yes 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 X-SW-Source: 2007-08/txt/msg00699.txt.bz2 > Do we have the scope-level information available when we emit > diagnostics from the middle-end? Not yet. > How do you search for the current state given a scope? Yet to be decided. > Also, it is not clear to me how the scope of a pragma is defined by > its location. It's not, you wouldn't use pragmas for scoped changes. > You may have several contradicting pragmas at file-scope > (set to ignore, then restore), how you lookup the status in that > case? Whatever was in force at that time, which may be undefined for pragmas. > As Gabriel, I am a bit confused by what you want to achieve with the > proposed push/pop. Adding push/pop was a trivial change to the pragma handler. It exists as an example of how to use the save/restore state tree code in diagnostics.c. The same save/restore API can be used to keep track of the diagnostic state for other purposes besides pragmas, like gcc's __extension__. > 2. DJ wants a header with stricter diagnostics that preserves the > initial state and restores it at the end of the header > > #pragma GCC diagnostics error "-Whatever" > #pragma GCC diagnostics error "-Whatever2" > typical things within a header > #pragma GCC diagnostics restore "-Whatever" > #pragma GCC diagnostics restore "-Whatever2" That assumes that there's a restore, and that it restores to the right place (what if other headers have made global changes?) > Yes, a simple #pragma GCC diagnostics restore may be shorter for > case 2 when you have hundreds of pragmas. It will mean "undo all > changes up to the previous pop/save operation or the initial > state". But I think it will be a bit expensive operation when the > user can simply do copy + paste + s/error/restore/ Did you look at my patch? A restore is a simple pointer assignment, nothing more. Plus, push/pop can be properly nested, whereas change/restore cannot, unless you define "restore" as "pop" in which case you might as well call it that.