public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31367]  New: Should not warn about use of deprecated type in deprecated struct
@ 2007-03-26 18:39 ian at airs dot com
  2007-03-26 18:43 ` [Bug c/31367] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ian at airs dot com @ 2007-03-26 18:39 UTC (permalink / raw)
  To: gcc-bugs

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

When a deprecated type is used in a struct which is itself deprecated, we
should not warn.  That would be consistent with the current behaviour of not
warning about applying a deprecated type to a deprecated variable.

Test case:

typedef __attribute__((deprecated)) int foo;
typedef __attribute__((deprecated)) struct bar {
  foo baz;
} bop;

With current mainline this gives

foo.cc:3: warning: ‘foo’ is deprecated

It should not give any warning.


-- 
           Summary: Should not warn about use of deprecated type in
                    deprecated struct
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ian at airs dot com


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


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

* [Bug c/31367] Should not warn about use of deprecated type in deprecated struct
  2007-03-26 18:39 [Bug c++/31367] New: Should not warn about use of deprecated type in deprecated struct ian at airs dot com
@ 2007-03-26 18:43 ` pinskia at gcc dot gnu dot org
  2007-03-26 20:27 ` david at luyer dot net
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-03-26 18:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-03-26 19:42 -------
Confirmed, the C front-end also gives the warning.
apinski@debian:~$ ~/x86-local-fsf/bin/gcc t.c  -S
t.c:4: warning: 'foo' is deprecated


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c++                         |c
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2007-03-26 19:42:46
               date|                            |


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


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

* [Bug c/31367] Should not warn about use of deprecated type in deprecated struct
  2007-03-26 18:39 [Bug c++/31367] New: Should not warn about use of deprecated type in deprecated struct ian at airs dot com
  2007-03-26 18:43 ` [Bug c/31367] " pinskia at gcc dot gnu dot org
@ 2007-03-26 20:27 ` david at luyer dot net
  2007-03-26 23:57 ` spark at gcc dot gnu dot org
  2010-05-18  7:15 ` ethouris at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: david at luyer dot net @ 2007-03-26 20:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from david at luyer dot net  2007-03-26 21:27 -------
Two other related cases which generate warnings.  I'm not sure
which is the correct syntax to mark a field deprecated, but
both are currently generating warnings, and marking a field
which uses a deprecated type as deprecated would be another
case which should not generate a warning.

=============================

typedef __attribute__((deprecated)) int foo;

typedef struct bar {
  foo __attribute__((deprecated)) baz;
} bop;

=============================

typedef __attribute__((deprecated)) int foo;

typedef struct bar {
  __attribute__((deprecated)) foo baz;
} bop;


-- 


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


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

* [Bug c/31367] Should not warn about use of deprecated type in deprecated struct
  2007-03-26 18:39 [Bug c++/31367] New: Should not warn about use of deprecated type in deprecated struct ian at airs dot com
  2007-03-26 18:43 ` [Bug c/31367] " pinskia at gcc dot gnu dot org
  2007-03-26 20:27 ` david at luyer dot net
@ 2007-03-26 23:57 ` spark at gcc dot gnu dot org
  2010-05-18  7:15 ` ethouris at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: spark at gcc dot gnu dot org @ 2007-03-26 23:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from spark at gcc dot gnu dot org  2007-03-27 00:56 -------
# cat -n t.c
     1  typedef __attribute__((deprecated)) int foo;
     2  typedef
     3          struct
     4  __attribute__((deprecated))
     5          bar1
     6  {
     7    foo baz;
     8  }
     9  bop1;
    10
    11  typedef
    12  __attribute__((deprecated))
    13          struct
    14          bar2
    15  {
    16    foo baz;
    17  } bop2;
    18
    19  typedef
    20          struct
    21          bar3
    22  {
    23    foo baz;
    24  }
    25  __attribute__((deprecated))
    26  bop3;
    27
    28  typedef
    29          struct
    30          bar4
    31  {
    32    foo baz;
    33  }
    34  bop4
    35  __attribute__((deprecated));
# ~/local/pkg/4.1/bin/gcc -c t.c
t.c:7: warning: 'foo' is deprecated
t.c:9: warning: 'bar1' is deprecated (declared at t.c:6)
t.c:16: warning: 'foo' is deprecated
t.c:23: warning: 'foo' is deprecated
t.c:26: warning: 'bar3' is deprecated (declared at t.c:22)
t.c:32: warning: 'foo' is deprecated
#

I'm not sure what to make of this, 
but there seems to be some subtleties regarding 
which declaration the attribute applies to.


-- 


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


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

* [Bug c/31367] Should not warn about use of deprecated type in deprecated struct
  2007-03-26 18:39 [Bug c++/31367] New: Should not warn about use of deprecated type in deprecated struct ian at airs dot com
                   ` (2 preceding siblings ...)
  2007-03-26 23:57 ` spark at gcc dot gnu dot org
@ 2010-05-18  7:15 ` ethouris at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: ethouris at gmail dot com @ 2010-05-18  7:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ethouris at gmail dot com  2010-05-18 07:14 -------
No matter which entity is actually affected in the example above, 'foo' is a
type of field used inside the entity. In all these cases, deprecation warning
should not be reported for the field of type 'foo'. It should be reported only
when no part of the structure definition is deprecated.

The difference between deprecating only a typedef for a structure or the
structure itself, but not its typedef, should not be seen when it concerns one
integrated declaration (that is, when you "deprecate" any of these two, both
the typedef and the struct are deprecated). To only deprecate the typedef or
the struct, they should be declared separately - for example, bop4/bar4 should
be declared this way:

struct bar4
{
  foo baz;
};

typedef struct bar4 bop4 __attribute__((deprecated));


So, in the examples for bop1-bop4, all of barN/bopN symbols should be
deprecation-attributed (and, simultaneously, in all these declarations the
deprecation warning should not be reported for 'baz' field declaration). For
this above declaration, the compiler should issue a warning about 'baz' field,
as the structure isn't deprecated and is using a deprecated type 'foo'; so
should be reported a warning about using struct bar4 (this structure is this
way "implicitly deprecated") and bop4 (which is explicitly deprecated).


-- 


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


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

end of thread, other threads:[~2010-05-18  7:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-26 18:39 [Bug c++/31367] New: Should not warn about use of deprecated type in deprecated struct ian at airs dot com
2007-03-26 18:43 ` [Bug c/31367] " pinskia at gcc dot gnu dot org
2007-03-26 20:27 ` david at luyer dot net
2007-03-26 23:57 ` spark at gcc dot gnu dot org
2010-05-18  7:15 ` ethouris at gmail dot com

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).