diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3f7d96e6fd0422b7a7f1120c54093605e2a1cc07..6f9f257597ba3fbe3332d7a24e3ae880baf50933 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-01-19 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR c++/17947 + * toplev.c (warn_deprecated_use): Use %qD instead of %qs to print + the name of the declared identifier. + 2007-01-19 Dirk Mueller <dmueller@suse.de> * config/i386.h (CONDITIONAL_REGISTER_USAGE): Store diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f10e21081e3a1a0a17c4b6fc8fdaf355fdbc067b..34b02acefa82657d1072686bedcd58c09048c003 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2007-01-19 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR c++/17947 + * g++.dg/warn/deprecated.C: Update warning output. + * g++.dg/warn/deprecated-2.C: Likewise. + * g++.dg/warn/deprecated-3.C: New. + 2007-01-19 Nathan Sidwell <nathan@codesourcery.com> * gcc.c-torture/execute/nestfunc-7.c: New. diff --git a/gcc/testsuite/g++.dg/warn/deprecated-2.C b/gcc/testsuite/g++.dg/warn/deprecated-2.C index afddc8f0bbd27e17d6d11d00e552c49d73a8249b..d79a7f9e6ac3671d5f1ac5e9cd75c09a4657a5c3 100644 --- a/gcc/testsuite/g++.dg/warn/deprecated-2.C +++ b/gcc/testsuite/g++.dg/warn/deprecated-2.C @@ -7,5 +7,5 @@ void func(void); void func(void) __attribute__((deprecated)); void f(void) { - func(); /* { dg-warning "'func' is deprecated" } */ + func(); /* { dg-warning "'void func\\(\\)' is deprecated" } */ } diff --git a/gcc/testsuite/g++.dg/warn/deprecated-3.C b/gcc/testsuite/g++.dg/warn/deprecated-3.C new file mode 100644 index 0000000000000000000000000000000000000000..6087cc733fdd18a7a6d2a3810b43e83a38896d8d --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/deprecated-3.C @@ -0,0 +1,14 @@ +/* PR 17947 bad warning with implicit conversion and __attribute__((deprecated)) */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +struct Foo +{ + operator int() __attribute__((deprecated)); +}; + +void g(void) +{ + Foo f; + (int)f; // { dg-warning "warning: 'Foo::operator int\\(\\)' is deprecated \\(declared at" } +} diff --git a/gcc/testsuite/g++.dg/warn/deprecated.C b/gcc/testsuite/g++.dg/warn/deprecated.C index 59dc3d67257c9c722992a06078b0378c5ccbf73b..15e8475e787d21e282b9a8e248470f2779f49b4a 100644 --- a/gcc/testsuite/g++.dg/warn/deprecated.C +++ b/gcc/testsuite/g++.dg/warn/deprecated.C @@ -50,13 +50,13 @@ int func1() int x __attribute__ ((deprecated)); int y __attribute__ ((__deprecated__)); int z; - int (*pf)() = f1; /* { dg-warning "'f1' is deprecated" "" } */ + int (*pf)() = f1; /* { dg-warning "'INT1 f1\\(\\)' is deprecated" "" } */ z = w + x + y + g1 + g2 + g3; /* { dg-warning "'x' is deprecated" "" } */ /* { dg-warning "'y' is deprecated" "y" { target *-*-* } 55 } */ /* { dg-warning "'g2' is deprecated" "g2" { target *-*-* } 55 } */ /* { dg-warning "'g3' is deprecated" "g3" { target *-*-* } 55 } */ - return f1(); /* { dg-warning "'f1' is deprecated" "f1" } */ + return f1(); /* { dg-warning "'INT1 f1\\(\\)' is deprecated" "f1" } */ } int func2(S1 *p) @@ -64,14 +64,14 @@ int func2(S1 *p) S1 lp; if (p->field1) - return p->field2; /* { dg-warning "'field2' is deprecated" "" } */ - else if (lp.field4) /* { dg-warning "'field4' is deprecated" "" } */ + return p->field2; /* { dg-warning "'S1::field2' is deprecated" "" } */ + else if (lp.field4) /* { dg-warning "'S1::field4' is deprecated" "" } */ return p->field3; p->u1.field5 = g1 + p->field7; - p->u2.field9; /* { dg-warning "'u2' is deprecated" "" } */ - return p->u1.field6 + p->field8; /* { dg-warning "'field6' is deprecated" "" } */ - /* { dg-warning "'field8' is deprecated" "field8" { target *-*-* } 73 } */ + p->u2.field9; /* { dg-warning "'S1::u2' is deprecated" "" } */ + return p->u1.field6 + p->field8; /* { dg-warning "'S1::<anonymous union>::field6' is deprecated" "" } */ + /* { dg-warning "'S1::field8' is deprecated" "field8" { target *-*-* } 73 } */ } struct SS1 { @@ -104,13 +104,13 @@ inline void T::member1(int) {} int T::member3(T *p) { - p->member1(1); /* { dg-warning "'member1' is deprecated" "" } */ - (*p).member1(2); /* { dg-warning "'member1' is deprecated" "" } */ - p->member2(1); /* { dg-warning "'member2' is deprecated" "" } */ - (*p).member2(2); /* { dg-warning "'member2' is deprecated" "" } */ + p->member1(1); /* { dg-warning "'void T::member1\\(int\\)' is deprecated" "" } */ + (*p).member1(2); /* { dg-warning "'void T::member1\\(int\\)' is deprecated" "" } */ + p->member2(1); /* { dg-warning "'void T::member2\\(INT1\\)' is deprecated" "" } */ + (*p).member2(2); /* { dg-warning "'void T::member2\\(INT1\\)' is deprecated" "" } */ p->member3(p); (*p).member3(p); - return f1(); /* { dg-warning "'f1' is deprecated" "" } */ + return f1(); /* { dg-warning "'INT1 f1\\(\\)' is deprecated" "" } */ } #endif diff --git a/gcc/toplev.c b/gcc/toplev.c index bcefdc091f1ecb515b623be4c3d93571d420b767..569dbfdc7475f110f9eef78b98d7fad0a86910f5 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -901,9 +901,8 @@ warn_deprecated_use (tree node) { expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (node)); warning (OPT_Wdeprecated_declarations, - "%qs is deprecated (declared at %s:%d)", - IDENTIFIER_POINTER (DECL_NAME (node)), - xloc.file, xloc.line); + "%qD is deprecated (declared at %s:%d)", + node, xloc.file, xloc.line); } else if (TYPE_P (node)) {