From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13094 invoked by alias); 15 Oct 2002 21:37:22 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 13087 invoked from network); 15 Oct 2002 21:37:21 -0000 Received: from unknown (HELO bjl1.asuk.net) (81.29.64.88) by sources.redhat.com with SMTP; 15 Oct 2002 21:37:21 -0000 Received: from bjl1.asuk.net (localhost [127.0.0.1]) by bjl1.asuk.net (8.12.5/8.12.5) with ESMTP id g9FLdtVn032445; Tue, 15 Oct 2002 22:39:55 +0100 Received: (from jamie@localhost) by bjl1.asuk.net (8.12.5/8.12.5/Submit) id g9FLdtt5032443; Tue, 15 Oct 2002 22:39:55 +0100 X-Authentication-Warning: bjl1.asuk.net: jamie set sender to egcs@tantalophile.demon.co.uk using -f Date: Tue, 15 Oct 2002 15:32:00 -0000 From: Jamie Lokier To: Kevin Lawton Cc: Michael Matz , gcc@gcc.gnu.org Subject: Re: Request of new __attribute__ for switch statements (elimination of the bounds check) Message-ID: <20021015213954.GC31811@bjl1.asuk.net> References: <20021015200247.GA31811@bjl1.asuk.net> <20021015201332.21851.qmail@web80311.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021015201332.21851.qmail@web80311.mail.yahoo.com> User-Agent: Mutt/1.4i X-SW-Source: 2002-10/txt/msg00878.txt.bz2 Kevin Lawton wrote: > The __attibute_ angle is simple, I can exactly tell the > compiler when I care to have it applied (maybe only one > case in all the code), and it disappears quickly with > an #ifdef'd macro. Which makes it play nice with "other" > compilers. If your proposal is actually implemented, could it please be changed so that the attribute goes _inside_ the switch parentheses? Then it can be used to optimise "variant type" macros without having to uglify thousands of switch statements in a program (just the macro definitions). To use a few example from GCC itself, these kind of can all be optimised in this way: switch (TREE_CODE (t)) { /* ... */ } switch (GET_CODE (rtx)) { /* ... */ } switch (GET_MODE (rtx)) { /* ... */ } (I'm not sure you'd want to optimise these in GCC because of the risk of bugs, but there are programs which use similar macros where it is more desirable to optimise). -- Jamie