mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-16 04:20:26 +08:00
c-typeck.c (pedantic_lvalue_warning): Deprecate use of conditional expressions as lvalues.
* c-typeck.c (pedantic_lvalue_warning): Deprecate use of conditional expressions as lvalues. testsuite: * gcc.dg/cond-lvalue-1.c: New test. From-SVN: r73273
This commit is contained in:
parent
db9fd03ea1
commit
0a49d02ccb
@ -1,3 +1,8 @@
|
||||
2003-11-05 Joseph S. Myers <jsm@polyomino.org.uk>
|
||||
|
||||
* c-typeck.c (pedantic_lvalue_warning): Deprecate use of
|
||||
conditional expressions as lvalues.
|
||||
|
||||
2003-11-05 Kazu Hirata <kazu@cs.umass.edu>
|
||||
|
||||
* tsystem.h: Add the prototype of strlen.
|
||||
|
@ -2588,8 +2588,7 @@ pedantic_lvalue_warning (enum tree_code code)
|
||||
switch (code)
|
||||
{
|
||||
case COND_EXPR:
|
||||
if (pedantic)
|
||||
pedwarn ("ISO C forbids use of conditional expressions as lvalues");
|
||||
pedwarn ("use of conditional expressions as lvalues is deprecated");
|
||||
break;
|
||||
case COMPOUND_EXPR:
|
||||
if (pedantic)
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-11-05 Joseph S. Myers <jsm@polyomino.org.uk>
|
||||
|
||||
* gcc.dg/cond-lvalue-1.c: New test.
|
||||
|
||||
2003-11-05 Gernot Hillier <gernot.hillier@siemens.com>
|
||||
|
||||
* g++.old-deja/g++.pt/asm1.C: Enable for e.g. x86_64-*-linux-gnu.
|
||||
|
12
gcc/testsuite/gcc.dg/cond-lvalue-1.c
Normal file
12
gcc/testsuite/gcc.dg/cond-lvalue-1.c
Normal file
@ -0,0 +1,12 @@
|
||||
/* Test for deprecation of conditional expressions as lvalues. */
|
||||
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "" } */
|
||||
|
||||
int x, y, z;
|
||||
|
||||
void
|
||||
foo (void)
|
||||
{
|
||||
(x ? y : z) = 1; /* { dg-warning "lvalue" "conditional expression as lvalue deprecated" } */
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user