From: jsm28 Date: Wed, 5 Nov 2003 17:53:04 +0000 (+0000) Subject: * c-typeck.c (pedantic_lvalue_warning): Deprecate use of X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=f6fb23c5486815622b20c3ad1873fb87d936bdd9 * c-typeck.c (pedantic_lvalue_warning): Deprecate use of conditional expressions as lvalues. testsuite: * gcc.dg/cond-lvalue-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73273 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c2c2da961a4..1cd17d9fa7e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-11-05 Joseph S. Myers + + * c-typeck.c (pedantic_lvalue_warning): Deprecate use of + conditional expressions as lvalues. + 2003-11-05 Kazu Hirata * tsystem.h: Add the prototype of strlen. diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 598e249d947..81eee375f39 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7420ded6be4..87302adac6a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-11-05 Joseph S. Myers + + * gcc.dg/cond-lvalue-1.c: New test. + 2003-11-05 Gernot Hillier * g++.old-deja/g++.pt/asm1.C: Enable for e.g. x86_64-*-linux-gnu. diff --git a/gcc/testsuite/gcc.dg/cond-lvalue-1.c b/gcc/testsuite/gcc.dg/cond-lvalue-1.c new file mode 100644 index 00000000000..1765546e342 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cond-lvalue-1.c @@ -0,0 +1,12 @@ +/* Test for deprecation of conditional expressions as lvalues. */ +/* Origin: Joseph Myers */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int x, y, z; + +void +foo (void) +{ + (x ? y : z) = 1; /* { dg-warning "lvalue" "conditional expression as lvalue deprecated" } */ +}