On Sat, Jun 15, 2019 at 04:33:26PM +0200, Jakub Jelinek wrote: > On Sat, Jun 15, 2019 at 10:29:17AM -0400, Marek Polacek wrote: > > [dcl.attr.noreturn] says "The first declaration of a function shall specify > > the > > noreturn attribute if any declaration of that function specifies the > > noreturn > > attribute" meaning that we should diagnose > > > > void func (); > > void func [[noreturn]] (); > > > > but we do not. I'd been meaning to issue a hard error for [[noreturn]] and > > only a warning for __attribute__((noreturn)) but then I found out that we > > treat [[noreturn]] exactly as the GNU attribute, and so cxx11_attribute_p > > returns false for it, so I decided to make it a pedwarn for all the cases. > > A pedwarn counts as a diagnostic, so we'd be conforming still. > > > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > IMHO we should treat __attribute__((noreturn)) as before without any > warnings, just [[noreturn]] that way. There is nothing wrong on declaring > it just on second or following declaration, it is an optimization attribute.
That's a complication then; currently [[noreturn]], [[gnu::noreturn]], and __attribute__((noreturn)) are not distinguishable. :( Guess I will really have to make the changes to treat [[noreturn]] similarly to e.g. [[nodiscard]], so that cxx11_attribute_p works. Thanks for pointing it out, though. Marek