From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22499 invoked by alias); 25 May 2005 00:37:04 -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 21991 invoked by uid 22791); 25 May 2005 00:36:42 -0000 Received: from admin.voldemort.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.9) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Wed, 25 May 2005 00:36:42 +0000 Received: (qmail 18941 invoked from network); 25 May 2005 00:36:40 -0000 Received: from localhost (HELO ?192.168.0.22?) (zack@127.0.0.1) by mail.codesourcery.com with SMTP; 25 May 2005 00:36:40 -0000 Subject: Re: Compiling GCC with g++: a report From: Zack Weinberg To: DJ Delorie Cc: gcc@gcc.gnu.org In-Reply-To: <200505250027.j4P0Rb0t010519@greed.delorie.com> References: <1116907280.9577.31.camel@localhost.localdomain> <87br71kv04.fsf@codesourcery.com> <87y8a5je22.fsf@codesourcery.com> <1116976014.8637.11.camel@localhost.localdomain> <1116979946.8798.4.camel@localhost.localdomain> <200505250027.j4P0Rb0t010519@greed.delorie.com> Content-Type: text/plain Date: Wed, 25 May 2005 00:55:00 -0000 Message-Id: <1116981782.8895.4.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2005-05/txt/msg01330.txt.bz2 On Tue, 2005-05-24 at 20:27 -0400, DJ Delorie wrote: > > This is still not an answer to the question I originally asked - do you > > see any way IN C to write code which has the relevant property of the > > class above (that is, that the FOOmode constants are not accessible > > except to authorized code) and which does not rely on free conversion > > between enumeration constants and integral types? > > enum { > TVQ_BAR_GRILL = (DATESTAMP % 10), > TVQ_NEXT2, > TVQ_NEXT3, > TVQ_NEXT4 > } TheValQuux; > > It's evil, but it will keep programmers from hard-coding integer > constants anywhere. The "constants" will need to be different every > day. This doesn't do what I want at all. The goal is to make the *symbolic enumeration constants* inaccessible to most code. Think about how machine_mode values are used. Almost the entire compiler is supposed to treat them as opaque things. You get them from e.g. int_mode_for_size; you may iterate over a class with GET_MODE_WIDER_MODE; you stash them in RTL and you pass them to predicates. Appearances of "SImode" in the machine-independent compiler are usually bugs. This is a major contributing factor to the brokenness of ports that don't set BITS_PER_UNIT==8. The goal is to make "SImode" and its friends inaccessible in the machine-independent compiler, so that that category of bugs cannot arise. zw