This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fixinc Patch to deprecate casts as lvalues for C


On Mon, 20 Oct 2003, Bruce Korb wrote:

> That said, if this patch fixes your problem, then I'd guess
> it is right even if it is heiroglyphs to me.  :-)

The trouble with making a comprehensible fix is that (a) the original 
obstack.h code is rather cryptic (this extension in general is) and (b) 
it's not just one place in obstack.h that needs fixing, but several 
(though only one triggers in a bootstrap of GCC).  All the places - in the 
version of obstack.h I looked at - are of the form

  *((TYPE*)X)++ = (Y)

which I want to change into

  ((*((TYPE*)X) = (Y)), (X += sizeof (TYPE)))

(correct for the uses in obstack.h, not for all possible uses of lvalue 
casts matching this pattern).  If this effect can be achieved more 
comprehensibly, feel free to rewrite the fix accordingly.

-- 
Joseph S. Myers
jsm@polyomino.org.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]