2012/11/13 Ladislav Michl <[email protected]>: > On Tue, Nov 13, 2012 at 11:41:18AM +0200, Tommi Rantala wrote: >> > @@ -72,6 +72,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE >> > SOFTWARE. */ >> > # endif >> > #endif >> > >> > +#if defined(HAVE__BUILTIN_UNREACHABLE) >> > +# define unreachable() __builtin_unreachable() >> > +#else >> > +# define unreachable() do { for (;;) ; } while (0) >> > +#endif >> > + >> >> I'm a bit surprised by the loop, I would expect something like a call >> to abort(), so that if someone actually hits this they'll get a signal >> and a core dump. > > The whole purpose is to signal compiler nothing past this point is > ever executed to silence warning.
OK, makes sense! >> How about defining this only when we do _not_ have the GCC builtin >> function available, something like: >> >> #ifndef HAVE__BUILTIN_UNREACHABLE >> # define __builtin_unreachable() ... >> #endif > > I do not like hiding stuff too much. __builtin prefix should mean exactly > that it is built in. Just checked kernel source, they are doing it the same > way, so it must be right ;-) Fair enough. Thanks, Tommi _______________________________________________ Libunwind-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/libunwind-devel
