> > I don't have tests for that but since it's not new behavior I suppose > > that's sufficient. > > Each attribute should have tests that invalid uses are appropriately > diagnosed. See gcc.dg/c23-attr-fallthrough-2.c for examples of such tests > in the case of the [[fallthrough]] attribute. Some invalid uses may be > diagnosed by existing code that's generic across attributes, others > require specific code for the individual attribute.
Okay I can add a test for the other statement and declaration cases like below. Any other change you need for approval? > > The default parsing of an attribute without an entry in the table of > attribute handlers is that arbitrary balanced token sequences are parsed > and discarded as arguments. And it triggers a warning too (see below) > To diagnose such arguments (in contexts when > the attribute is otherwise valid), an entry in the table of attribute > handlers is appropriate. The only valid usage is [[musttail]] return and there is already the default warning in the other cases. So I don't think an entry in the table is needed. BTW I noticed that [[musttail]] ; (empty statement with attribute) gives an error, which is probably a (unrelated) bug, afaik that should be legal for C23. -Andi t.c: [[musttail]] int j; __attribute__((musttail)) int k; void foo(void) { [[musttail]] j++; [[musttail]] if (k > 0) [[musttail]] k++; } t.c:2:1: warning: ‘musttail’ attribute ignored [-Wattributes] 2 | [[musttail]] int j; | ^ t.c:3:1: warning: ‘musttail’ attribute directive ignored [-Wattributes] 3 | __attribute__((musttail)) int k; | ^~~~~~~~~~~~~ t.c: In function ‘foo’: t.c:7:9: warning: ‘musttail’ attribute ignored [-Wattributes] 7 | [[musttail]] j++; | ^ t.c:8:9: warning: ‘musttail’ attribute ignored [-Wattributes] 8 | [[musttail]] if (k > 0) | ^ t.c:9:17: warning: ‘musttail’ attribute ignored [-Wattributes] 9 | [[musttail]] k++;