tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: __dead functions
On Fri, Jul 18, 2008 at 09:10:13PM +0400, Valeriy E. Ushakov wrote:
> #ifdef __lint__
> #define __MARK_NOTREACHED /* NOTREACHED */
> #else /* !__lint__ */
> #if __GNUC_PREREQ__(4, 0)
> #define __MARK_NOTREACHED for (;;) continue
> #else
> #define __MARK_NOTREACHED do {} while (/* CONSTCOND */ 0)
> #endif
> #endif /* !__lint__ */
>
> then we can have a single
>
> __NOTREACHED;
>
> statement in the code that will cover lint, gcc, and anything else we
> might need to use in the future.
Can the first two be compined like this:
#define __MARK_NOTREACHED for (;;) continue; /* NOTREACHED */
?
As for gcc versions, the oldest necrocompiler I can relatively easily
put my hands on is gcc-2.95 and it too understands for (;;) as a mark of
an unreached point in code, although by default (it defaults to -O0, at
least this build) it does generate code for whatever follows for (;;).
For -O2 it is smarter. I'd say it makes sense to use
__GNUC_PREREQ__(2, 95) for these purposes, what do you think?
Regards,
--
Alex
Home |
Main Index |
Thread Index |
Old Index