Prev: [PATCH 01/25] x86: fix size for ex trampoline with 32bit
Next: [patch 1/7] [patch] DT3155: Use pci_get_device
From: Arnd Bergmann on 5 Jan 2010 13:40 On Tuesday 05 January 2010, David Howells wrote: > Sam Ravnborg <sam(a)ravnborg.org> wrote: > > > +#define BUG() do { \ > > + for (;;) \ > > + /* endless loop*/; \ > > + unreachable(); \ > > +} while(0) > > Can you not do: > > #define BUG() do { \ > unreachable(); \ > } while(1) > > instead? If the compiler is interpreting unreachable() to really mean that > what comes after will not be reached, then the condition/loop at the end of > the block should be optimised away. Forcing the loop here is really wrong because it needlessly causes extra code to be emitted. We don't really want controlled error handling here (that is the definition of CONFIG_BUG=n), so this is only about shutting up the compiler warning. I guess the best would be something like #if defined (__GNUC__) && (__GNUC_MAJOR__ == 4) && (__GNUC_MINOR__ >= 5) #define BUG() __builtin_unreachable() #else #define BUG() do { } while (0) /* this may cause a warning */ #endif I still haven't found out how many warnings we are talking about here, maybe we can just silence them by adding individual unreachable() statements after BUG(); Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
First
|
Prev
|
Pages: 1 2 Prev: [PATCH 01/25] x86: fix size for ex trampoline with 32bit Next: [patch 1/7] [patch] DT3155: Use pci_get_device |