public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16370] New: __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor
@ 2004-07-05 13:44 tim dot vanholder at anubex dot com
  2004-08-02  1:14 ` [Bug c++/16370] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: tim dot vanholder at anubex dot com @ 2004-07-05 13:44 UTC (permalink / raw)
  To: gcc-bugs

When __attribute__((deprecated)) is applied to a class, gcc only warns when the
class name is used in a typedef, not when the class is instantiated or if static
class members are referenced.  This makes the attribute of limited use for
classes, requiring adding the attribute to every member as well.
On constructors, the warning that is given uses an uglified function name.

Simple test case:

class foo {
public:
  static const int something;
} __attribute__((deprecated));

typedef class foo FOO; // warns like it should

class foo2 {
  int value_;
public:
  foo2(void);
  foo2(int) __attribute__((deprecated));
  void bar(void) __attribute__((deprecated));
};

foo2::foo2(void) : value_(0) { }

foo2::foo2(int v) : value_(v) { }

void
foo2::bar(void)
{
  this->value_ += 42;
}

void
xyzzy(void)
{
  foo test1; // should warn, but doesn't
  foo* test2 = new foo; // should warn, but doesn't
  delete test2;
  FOO test3; // no warning, but that's ok, the typedef shows warning
  int test4 = foo::something; // should warn, but doesn't
  foo2 test5;
  test5.bar(); // warns like it should
  foo2 test6(foo::something); // should warn twice, but only warns once and
                              // uses ugly method name (__comp_ctor)
}

int
main(void)
{
  xyzzy();
  return 0;
}

Resulting output:

xxx.cc:6: warning: `foo' is deprecated (declared at xxx.cc:1)
xxx.cc: In function `void xyzzy()':
xxx.cc:35: warning: `bar' is deprecated (declared at xxx.cc:22)
xxx.cc:36: warning: `__comp_ctor' is deprecated (declared at xxx.cc:18)

Note that errors also refer to the last seen declaration or definition, and not
the declaration - but there already is a bug report for that.

-- 
           Summary: __attribute__((deprecated)) not useful on classes, and
                    ugly function name listed for deperecation warnings on
                    constructor
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tim dot vanholder at anubex dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16370


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/16370] __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor
  2004-07-05 13:44 [Bug c++/16370] New: __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor tim dot vanholder at anubex dot com
@ 2004-08-02  1:14 ` pinskia at gcc dot gnu dot org
  2004-11-01  0:28 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-02  1:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-02 01:14 -------
Confirmed.  Sounds like GCC is using the DECL_NAME instead of (I cannot remember the name right 
now).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-02 01:14:37
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16370


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/16370] __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor
  2004-07-05 13:44 [Bug c++/16370] New: __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor tim dot vanholder at anubex dot com
  2004-08-02  1:14 ` [Bug c++/16370] " pinskia at gcc dot gnu dot org
@ 2004-11-01  0:28 ` pinskia at gcc dot gnu dot org
  2005-05-01  3:41 ` pinskia at gcc dot gnu dot org
  2005-05-01  5:21 ` gdr at integrable-solutions dot net
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-01  0:28 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
   Last reconfirmed|2004-08-02 01:14:37         |2004-11-01 00:28:00
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16370


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/16370] __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor
  2004-07-05 13:44 [Bug c++/16370] New: __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor tim dot vanholder at anubex dot com
  2004-08-02  1:14 ` [Bug c++/16370] " pinskia at gcc dot gnu dot org
  2004-11-01  0:28 ` pinskia at gcc dot gnu dot org
@ 2005-05-01  3:41 ` pinskia at gcc dot gnu dot org
  2005-05-01  5:21   ` Gabriel Dos Reis
  2005-05-01  5:21 ` gdr at integrable-solutions dot net
  3 siblings, 1 reply; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-01  3:41 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 506 bytes --]


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-01 03:41 -------
We now get:
t.cc:36: warning: ‘__comp_ctor ’ is deprecated (declared at t.cc:18)

note the extra space.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-11-01 00:28:00         |2005-05-01 03:41:47
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16370


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/16370] __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor
  2004-07-05 13:44 [Bug c++/16370] New: __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor tim dot vanholder at anubex dot com
                   ` (2 preceding siblings ...)
  2005-05-01  3:41 ` pinskia at gcc dot gnu dot org
@ 2005-05-01  5:21 ` gdr at integrable-solutions dot net
  3 siblings, 0 replies; 6+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-05-01  5:21 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 633 bytes --]


------- Additional Comments From gdr at integrable-solutions dot net  2005-05-01 05:21 -------
Subject: Re:  __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-01 03:41 -------
| We now get:
| t.cc:36: warning: ‘__comp_ctor ’ is deprecated (declared at t.cc:18)
| 
| note the extra space.

The extra space is part of the name, if you ask me.

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16370


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bug c++/16370] __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor
  2005-05-01  3:41 ` pinskia at gcc dot gnu dot org
@ 2005-05-01  5:21   ` Gabriel Dos Reis
  0 siblings, 0 replies; 6+ messages in thread
From: Gabriel Dos Reis @ 2005-05-01  5:21 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-01 03:41 -------
| We now get:
| t.cc:36: warning: ‘__comp_ctor ’ is deprecated (declared at t.cc:18)
| 
| note the extra space.

The extra space is part of the name, if you ask me.

-- Gaby


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-05-01  5:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-05 13:44 [Bug c++/16370] New: __attribute__((deprecated)) not useful on classes, and ugly function name listed for deperecation warnings on constructor tim dot vanholder at anubex dot com
2004-08-02  1:14 ` [Bug c++/16370] " pinskia at gcc dot gnu dot org
2004-11-01  0:28 ` pinskia at gcc dot gnu dot org
2005-05-01  3:41 ` pinskia at gcc dot gnu dot org
2005-05-01  5:21   ` Gabriel Dos Reis
2005-05-01  5:21 ` gdr at integrable-solutions dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).