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 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

#ifdef __lint__
#else /* !__lint__ */
#if __GNUC_PREREQ__(4, 0)
#define __MARK_NOTREACHED for (;;) continue
#define __MARK_NOTREACHED do {} while (/* CONSTCOND */ 0)
#endif /* !__lint__ */

then we can have a single


statement in the code that will cover lint, gcc, and anything else we
might need to use in the future.

SY, Uwe
--                       |       Zu Grunde kommen          |       Ist zu Grunde gehen

Home | Main Index | Thread Index | Old Index