grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lists and aliasing (Re: Freeze on 27 February)


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: Lists and aliasing (Re: Freeze on 27 February)
Date: Wed, 22 Feb 2012 20:00:54 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0

On 22.02.2012 19:41, Lennart Sorensen wrote:
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.
Alternative is to add a condition which will ensure the loop termination but don't interfere with it other wise by using the fact that min (UINT_MAX, r)=r if r is unsigned int.


--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

Attachment: warn.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]