This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/30988] [4.1/4.2/4.3 Regression] Incorrect "no return statement" warning with __attribute__ ((noreturn)) and __FUNCTION__
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Nov 2007 12:33:56 -0000
- Subject: [Bug c++/30988] [4.1/4.2/4.3 Regression] Incorrect "no return statement" warning with __attribute__ ((noreturn)) and __FUNCTION__
- References: <bug-30988-12477@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from jakub at gcc dot gnu dot org 2007-11-17 12:33 -------
IMNSHO this is not a regression.
void f (const char *)
#ifdef NORET
__attribute__ ((noreturn))
#endif
;
template <class T> struct A
{
int g ()
{
#ifdef TEST1
f (__FUNCTION__);
#elif defined TEST2
f ((const char*) __FUNCTION__);
#else
f ((const char *) 0);
#endif
}
};
for k in gcc-2.96-rh gcc-3.2 gcc-3.3 gcc-3.4 gcc-4.1 gcc-4.2 gcc-4.3; do for i
in " -DNORET" ""; do \
for j in -DTEST1 -DTEST3 -DTEST3; do \
/usr/src/$k/obj/gcc/cc1plus $i $j pr30988.C -O3 -Wall -quiet 2>&1 \
| sed -n "/warning:/s/^/$k$i $j /p"; done; done; done
gcc-3.2 -DNORET -DTEST1 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-3.2 -DNORET -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-3.2 -DNORET -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-3.2 -DTEST1 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-3.2 -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-3.2 -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-3.4 -DNORET -DTEST1 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-3.4 -DTEST1 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-3.4 -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-3.4 -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.1 -DNORET -DTEST1 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.1 -DTEST1 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.1 -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.1 -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.2 -DNORET -DTEST1 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.2 -DTEST1 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.2 -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.2 -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.3 -DNORET -DTEST1 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.3 -DTEST1 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.3 -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
gcc-4.3 -DTEST3 pr30988.C:18: warning: no return statement in function
returning non-void
So, gcc-2.96-RH and 3.3 wouldn't warn ever in templates, even for cases where
it should warn, e.g. when the argument is not type dependent and neither the
called function has noreturn attribute.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30988