Bug 50720 - "deprecated" doesn't work as expected for functions returning pointer
Summary: "deprecated" doesn't work as expected for functions returning pointer
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.4.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2011-10-13 20:25 UTC by Bjorn Helgaas
Modified: 2016-07-27 07:29 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bjorn Helgaas 2011-10-13 20:25:19 UTC
I expected warnings on each of the four function calls below, but I only got three warnings (the one for "old_fn1a" is missing).


$ cat x.c
struct foo { int bar; };

struct foo * __attribute__ ((deprecated)) old_fn1a();
struct foo * old_fn1b() __attribute__ ((deprecated));

int __attribute__ ((deprecated)) old_fn2a();
int old_fn2b() __attribute__ ((deprecated));

void test(void)
{
        old_fn1a();
        old_fn1b();
        old_fn2a();
        old_fn2b();
}


$ cc -c x.c
x.c: In function ‘test’:
x.c:12: warning: ‘old_fn1b’ is deprecated (declared at x.c:4)
x.c:13: warning: ‘old_fn2a’ is deprecated (declared at x.c:6)
x.c:14: warning: ‘old_fn2b’ is deprecated (declared at x.c:7)



$ cc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
Comment 1 Andrew Pinski 2012-01-07 22:23:37 UTC
struct foo * __attribute__ ((deprecated)) old_fn1a();
The attribute there applies to the pointer ...
Comment 2 Jakub Jelinek 2013-03-22 14:45:34 UTC
GCC 4.8.0 is being released, adjusting target milestone.
Comment 3 Jakub Jelinek 2013-05-31 10:58:54 UTC
GCC 4.8.1 has been released.
Comment 4 Jakub Jelinek 2013-10-16 09:49:36 UTC
GCC 4.8.2 has been released.