On Wed, Feb 22, 2012 at 01:28:06PM -0500, Lennart Sorensen wrote: > Oh the feature for doing multiple #pragma statements throughout the code > is new in gcc 4.6. It can't be done in earlier versions. In older > versions whatever you say last applies to the whole file. > > Perhaps a slightly ugly solution could solve it by having a #if that > checks that gcc is 4.6 or higher around the #pragma that reenables > the warning. > > ie: > > #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) > #pragma GCC diagnostic error "-Wunsafe-loop-optimizations" > #endif > > At least this way you get to have the warning for most of the code on > newer gcc versions, but don't break older gcc versions that are still > in common use.
Well it compiles when I do that at least with gcc 4.4, although obviously it does mean -Wunsafe-loop-optimizations is disabled entirely for those 4 files rather than just for the one function that causes a problem. -- Len Sorensen _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel