Subject: noreturn functions
To: None <tech-toolchain@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: tech-toolchain
Date: 01/21/2006 03:25:12
To make gcc believe __attribute__((__noreturn__)) claim, the function
must end with a call to a known dead function.  For a "leaf" dead
function adding an infinite loop seems to convince gcc it will not
return.

What about adding somethign like:

#if !defined(__lint__)
#define __NORETURN__	for (;;) continue
#else
#define __NORETURN__
#endif

to be used like:

void foo(...) __attribute__((__noreturn__));

void
foo(...)
{
	...

	/* NOTREACHED */
	__NORETURN__;
}


Suggestions for a better name are welcome.

PS: If lint sees that infinite loop, it's happy with "for" version,
but for "while" or "do/while" it complains that the loop is not
entered at top.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://snark.ptc.spbu.ru/~uwe/          |       Ist zu Grunde gehen