This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to deprecate casts as lvalues for C
"Joseph S. Myers" <jsm@polyomino.org.uk> writes:
> This version of the patch (minus the already committed extend.texi and
> libobjc changes) includes a change to obstack.h merged from the
> version applied to gnulib (the GCC version can't actually be fully
> merged from the gnulib one until libiberty no longer need support K&R
> C).
Thanks for coordinating with gnulib.
> Bootstrapped with no regressions on i686-pc-linux-gnu. OK to commit
> this change to obstack.h?
>
> include:
> 2003-10-22 Joseph S. Myers <jsm@polyomino.org.uk>
>
> * obstack.h: Merge the following change from gnulib:
> 2003-10-21 Paul Eggert <eggert@twinsun.com>
> * obstack.h (obstack_1grow_fast): Properly parenthesize arg.
> (obstack_ptr_grow_fast, obstack_int_grow_fast):
> Don't use lvalue casts, as GCC plans to remove support for them
> in GCC 3.5. Reported by Joseph S. Myers. This bug
> was also present in the non-GCC version, indicating that this
> code had always been buggy and had never been widely used.
> (obstack_1grow, obstack_ptr_grow, obstack_int_grow, obstack_blank):
> Use the fast variant of each macro, rather than copying the
> definiens of the fast variant; that way, we'll be more likely to
> catch future bugs in the fast variants.
>
> gcc:
> 2003-10-22 Joseph S. Myers <jsm@polyomino.org.uk>
>
> * c-typeck.c (pedantic_lvalue_warning): Unconditionally warn of
> deprecation of casts as lvalues.
> * fixinc/inclhack.def (obstack_lvalue_cast): New fix.
> * fixinc/fixincl.x: Regenerate.
> * fixinc/tests/base/obstack.h: New test.
>
> gcc/testsuite:
> 2003-10-22 Joseph S. Myers <jsm@polyomino.org.uk>
>
> * gcc.dg/cast-lvalue-1.c: New test.
This is all OK.
I would suggest that you add another example to the release notes,
illustrating the former obstack.h usage. I had to stare at the
obstack code a little to understand that yes, it was a use of the same
extension.
zw