On Fri, Feb 02, 2024 at 01:18:06PM +0000, Joseph Myers wrote:
> On Fri, 2 Feb 2024, Andi Kleen wrote:
> 
> > This patchkit implements a [[musttail]] attribute for C/C++.
> > 
> > v4:
> > Addressed all feedback except clang::musttail is still supported
> > (I don't want to force an #ifdef to most users) and I'm also still
> 
> I'm fine with supporting [[clang::musttail]].  What shouldn't be supported 
> is plain unnamespaced [[musttail]], at least for C, and I don't see any 
It's unsupported since v4 ("" -> "gnu" for the lookups) 

> tests that that's not supported (there are tests of [[musttail]] on things 
> that aren't returns, but that's mixing two different issues - 
> [[gnu::musttail]] shouldn't be accepted on non-returns, while [[musttail]] 
> shouldn't be accepted anywhere, including on returns, because it's not a 
> standard attribute).

I added some extra tests for this  (passing)

diff --git a/gcc/testsuite/c-c++-common/musttail5.c 
b/gcc/testsuite/c-c++-common/musttail5.c
index 71f4de40fc6d..7938e7ff80e4 100644
--- a/gcc/testsuite/c-c++-common/musttail5.c
+++ b/gcc/testsuite/c-c++-common/musttail5.c
@@ -19,7 +19,10 @@ int foo2(int p)
 
 int i;
 
-void foo3(void)
+int foo3(void)
 {
   [[musttail]] i++; /* { dg-warning "attribute" } */
+  [[musttail]] if (i > 10) /* { dg-warning "attribute" } */
+    [[musttail]] return foo2(i); /* { dg-warning "attribute" } */
+  return 0;
 }


Reply via email to