From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexandre Oliva To: Zack Weinberg Cc: egcs@egcs.cygnus.com Subject: Re: making aliases into the middle of a structure Date: Fri, 30 Apr 1999 23:15:00 -0000 Message-ID: References: <199904221830.OAA07523@blastula.phys.columbia.edu> X-SW-Source: 1999-04n/msg00772.html Message-ID: <19990430231500.6cDr5f6oxOr3Ok3Jz9MSiVKPtpIWeoRaXfdlLtL1Qg4@z> On Apr 22, 1999, Zack Weinberg wrote: > On 22 Apr 1999 15:24:46 -0300, Alexandre Oliva wrote: >> On Apr 22, 1999, Zack Weinberg wrote: >> >>> extern __typeof(x.b) y __attribute__ ((alias("x.b"))); >> >> This can't work. The alias attribute defines an alias to a *symbol*, >> not to an arbitrary expression. > I don't see that it would be terribly hard to extend alias so it could > handle SYMBOL_REFs and COMPONENT_REFs as well as strings. That would probably be a good idea. alias could accept an arbitrary expression. If it's an lvalue within a global symbol, it will define an actual alias, otherwise it could just emit an error or ``construct a temporary and bind the reference to it'', to put it in C++ terms :-) >> why don't you compute the offset, say, in the configure >> script, then #define the appropriate alias string? > Because the preprocessor can't compute offsetof() all the way down; > I'd have to compile and run a test program. Which loses when > cross-compiling. Well, you could try to extract this information from the assembly code, or from some RTL dump (since you're bound to gcc anyway), but I wouldn't like to be the one to implement it :-) -- Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Brasil {oliva,Alexandre.Oliva}@dcc.unicamp.br aoliva@{acm.org,computer.org} oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org} *** E-mail about software projects will be forwarded to mailing lists