OSDN Git Service

2007-01-19 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Jan 2007 16:04:57 +0000 (16:04 +0000)
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Jan 2007 16:04:57 +0000 (16:04 +0000)
PR c++/17947
* toplev.c (warn_deprecated_use): Use %qD instead of %qs to
print the name of the declared identifier.

testsuite/
* g++.dg/warn/deprecated.C: Update warning output.
* g++.dg/warn/deprecated-2.C: Likewise.
* g++.dg/warn/deprecated-3.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120969 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/deprecated-2.C
gcc/testsuite/g++.dg/warn/deprecated-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/deprecated.C
gcc/toplev.c

index 3f7d96e..6f9f257 100644 (file)
@@ -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
index f10e210..34b02ac 100644 (file)
@@ -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.
index afddc8f..d79a7f9 100644 (file)
@@ -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 (file)
index 0000000..6087cc7
--- /dev/null
@@ -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" }
+}
index 59dc3d6..15e8475 100644 (file)
@@ -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
 
index bcefdc0..569dbfd 100644 (file)
@@ -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))
     {