tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: __dead functions



On Fri 18 Jul 2008 at 21:10:13 +0400, Valeriy E. Ushakov wrote:
> Actually we can arrange for lint's /* NOTREACHED */ comment to appear
> at the end of that macro so that one macro covers "notreached"
> semantics for all the tools we use.  Using an example from my previous
> mail:
> 
> #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.

That won't actually work, since comments are removed in translation
phase 3 and macros are expanded in translation phase 4, so after the
comments are gone.

See section 5.1.1.2 in
http://www.open-std.org/jtc1/sc22/WG21/docs/papers/2000/n1252.pdf (page
10; page 22 of the pdf)

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert      -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl        -- Cetero censeo "authored" delendum esse.


Home | Main Index | Thread Index | Old Index