[PATCH 1/5] fb: Silence warnings when building with clang

Jamey Sharp jamey at minilop.net
Sun Apr 24 22:18:36 PDT 2011


Since the "Crufty macros to initialize the mask array" are documented as
existing "to avoid compile-time warnings about shift overflow":

Reviewed-by: Jamey Sharp <jamey at minilop.net>

On Sat, Apr 23, 2011 at 09:52:24PM -0700, Jeremy Huddleston wrote:
> fbpict.c:163:8: warning: implicit conversion from enumeration type 'PictFormatShort' (aka 'enum _PictFormatShort') to different enumeration
>       type 'pixman_format_code_t' [-Wconversion]
>         pict->format,
>         ~~~~~~^~~~~~
> 
> fbbltone.c:486:2: warning: shift result (281474959933440) requires 49 bits to represent, but 'int' only has 32 bits [-Wshift-overflow]
>         C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0),
>         ^~~~~~~~~~~~
> fbbltone.c:474:6: note: instantiated from:
>      SelMask24(b,1,r))
>      ^
> fbbltone.c:429:46: note: instantiated from:
>                                                     ^
> fbbltone.c:427:18: note: instantiated from:
>                       0xffffff << Mask24Check(x,r)) : 0)
>                       ~~~~~~~~ ^
> 
> Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> ---
>  fb/fbbltone.c |    5 +++++
>  fb/fbpict.c   |    2 +-
>  2 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/fb/fbbltone.c b/fb/fbbltone.c
> index 629b13a..0a91575 100644
> --- a/fb/fbbltone.c
> +++ b/fb/fbbltone.c
> @@ -26,6 +26,11 @@
>  
>  #include "fb.h"
>  
> +#ifdef __clang__
> +/* shift overflow is intentional */
> +#pragma clang diagnostic ignored "-Wshift-overflow"
> +#endif
> +
>  /*
>   *  Example: srcX = 13 dstX = 8	(FB unit 32 dstBpp 8)
>   *
> diff --git a/fb/fbpict.c b/fb/fbpict.c
> index 133f422..d1fd0cb 100644
> --- a/fb/fbpict.c
> +++ b/fb/fbpict.c
> @@ -160,7 +160,7 @@ create_bits_picture (PicturePtr pict,
>      fbGetPixmapBitsData(pixmap, bits, stride, bpp);
>  
>      image = pixman_image_create_bits (
> -	pict->format,
> +	(pixman_format_code_t)pict->format,
>  	pixmap->drawable.width, pixmap->drawable.height,
>  	(uint32_t *)bits, stride * sizeof (FbStride));
>      
> -- 
> 1.7.4.1
> 
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110424/989689ae/attachment.pgp>


More information about the xorg-devel mailing list