diff options
author | Joseph Myers <jsm@polyomino.org.uk> | 2004-01-20 01:38:27 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2004-01-20 01:38:27 +0000 |
commit | 53cd18ec8efe794064208e4a5f0ae20c2e2ea0b8 (patch) | |
tree | dffc7ec646ed782d1cf4c5f053cb52946bc4ee1c /gcc/doc | |
parent | 87d11ccc820b7795c7919c5b2ca6a2001a6c044c (diff) | |
download | gcc-53cd18ec8efe794064208e4a5f0ae20c2e2ea0b8.zip gcc-53cd18ec8efe794064208e4a5f0ae20c2e2ea0b8.tar.gz gcc-53cd18ec8efe794064208e4a5f0ae20c2e2ea0b8.tar.bz2 |
c-decl.c (c_init_decl_processing): Set pedantic_lvalues to true unconditionally.
* c-decl.c (c_init_decl_processing): Set pedantic_lvalues to
true unconditionally.
* c-typeck.c (unary_complex_lvalue, pedantic_lvalue_warning):
Remove.
(build_unary_op, build_modify_expr): Don't handle extended
lvalues.
(build_component_ref, build_conditional_expr): Call non_lvalue
instead of pedantic_non_lvalue.
(build_c_cast): Don't condition use of non_lvalue on pedantic.
* fold-const.c (fold): Don't check pedantic directly for
COMPOUND_EXPR. Ensure that results for COMPOUND_EXPR are
passed to pedantic_non_lvalue.
* doc/extend.texi: Remove documentation of extended lvalues.
testsuite:
* gcc.c-torture/compile/981022-1.c: Remove.
* gcc.dg/array-5.c: Remove XFAIL.
* gcc.dg/sequence-pt-1.c: Remove test using extended lvalues.
* gcc.dg/cast-lvalue-1.c, gcc.dg/compound-lvalue-1.c,
gcc.dg/cond-lvalue-1.c: Update.
* gcc.dg/cast-lvalue-2.c: New test.
From-SVN: r76192
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 9b03c77..0eed679 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -429,7 +429,6 @@ extensions, accepted by GCC in C89 mode and in C++. * Nested Functions:: As in Algol and Pascal, lexical scoping of functions. * Constructing Calls:: Dispatching a call to another function. * Typeof:: @code{typeof}: referring to the type of an expression. -* Lvalues:: Using @samp{?:}, @samp{,} and casts in lvalues. * Conditionals:: Omitting the middle operand of a @samp{?:} expression. * Long Long:: Double-word integers---@code{long long int}. * Complex:: Data types for complex numbers. @@ -1060,94 +1059,6 @@ typedef typeof(@var{expr}) @var{T}; @noindent This will work with all versions of GCC@. -@node Lvalues -@section Generalized Lvalues -@cindex compound expressions as lvalues -@cindex expressions, compound, as lvalues -@cindex conditional expressions as lvalues -@cindex expressions, conditional, as lvalues -@cindex casts as lvalues -@cindex generalized lvalues -@cindex lvalues, generalized -@cindex extensions, @code{?:} -@cindex @code{?:} extensions - -Compound expressions, conditional expressions and casts are allowed as -lvalues provided their operands are lvalues. This means that you can take -their addresses or store values into them. All these extensions are -deprecated. - -Standard C++ allows compound expressions and conditional expressions -as lvalues, and permits casts to reference type, so use of this -extension is not supported for C++ code. - -For example, a compound expression can be assigned, provided the last -expression in the sequence is an lvalue. These two expressions are -equivalent: - -@smallexample -(a, b) += 5 -a, (b += 5) -@end smallexample - -Similarly, the address of the compound expression can be taken. These two -expressions are equivalent: - -@smallexample -&(a, b) -a, &b -@end smallexample - -A conditional expression is a valid lvalue if its type is not void and the -true and false branches are both valid lvalues. For example, these two -expressions are equivalent: - -@smallexample -(a ? b : c) = 5 -(a ? b = 5 : (c = 5)) -@end smallexample - -A cast is a valid lvalue if its operand is an lvalue. This extension -is deprecated. A simple -assignment whose left-hand side is a cast works by converting the -right-hand side first to the specified type, then to the type of the -inner left-hand side expression. After this is stored, the value is -converted back to the specified type to become the value of the -assignment. Thus, if @code{a} has type @code{char *}, the following two -expressions are equivalent: - -@smallexample -(int)a = 5 -(int)(a = (char *)(int)5) -@end smallexample - -An assignment-with-arithmetic operation such as @samp{+=} applied to a cast -performs the arithmetic using the type resulting from the cast, and then -continues as in the previous case. Therefore, these two expressions are -equivalent: - -@smallexample -(int)a += 5 -(int)(a = (char *)(int) ((int)a + 5)) -@end smallexample - -You cannot take the address of an lvalue cast, because the use of its -address would not work out coherently. Suppose that @code{&(int)f} were -permitted, where @code{f} has type @code{float}. Then the following -statement would try to store an integer bit-pattern where a floating -point number belongs: - -@smallexample -*&(int)f = 1; -@end smallexample - -This is quite different from what @code{(int)f = 1} would do---that -would convert 1 to floating point and store it. Rather than cause this -inconsistency, we think it is better to prohibit use of @samp{&} on a cast. - -If you really do want an @code{int *} pointer with the address of -@code{f}, you can simply write @code{(int *)&f}. - @node Conditionals @section Conditionals with Omitted Operands @cindex conditional expressions, extensions |