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:
> On Fri, Jul 18, 2008 at 12:01:09 -0400, Greg A. Woods; Planix, Inc. wrote:
> 
> > >+#if __GNUC_PREREQ__(4, 3)
> > >+#define __NOTREACHED for (;;) continue
> > >+#else
> > >+#define __NOTREACHED
> > >+#endif
> > 
> > I think inventing extra redundant identifiers like this one, even if  
> > prefixed by "__" is unnecessary.
> > 
> > Indeed gcc doesn't understand a NOTREACHED comment, that's a lint  
> > directive of course and it seems, unfortunately, that lint has fallen  
> > out of favour in NetBSD.
> 
> How does use or disuse of lint changes the fact that *a different
> tool*, gcc in this case, complains that some code is (not) reached
> when gcc thinks it should (not) be.
> 
> 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__ */
So how about this one [1]?

[1]: http://koowaldah.org/people/ash/netbsd/noreturn-fix-try3.patch

Regards,
--
Alex


Home | Main Index | Thread Index | Old Index