[MPlayer-dev-eng] [PATCH] configure: avoid warning in endian testing

Diego Biurrun diego at biurrun.de
Wed Sep 15 11:25:51 CEST 2010


On Tue, Sep 14, 2010 at 02:54:04PM +0200, Giorgio wrote:
> 
> this is probably not very important, but while reading the configure
> script and its output on my Linux x86-64 box I noticed the following
> warning:
> 
> ##########################################
> 
> ============ Checking for byte order ============
> 
> short ascii_name[] = {
> (('M'<<8)|'P'),(('l'<<8)|'a'),(('y'<<8)|'e'),(('r'<<8)|'B'),
> 
> (('i'<<8)|'g'),(('E'<<8)|'n'),(('d'<<8)|'i'),(('a'<<8)|'n'),0};
> int main(void) { return (int)ascii_name; }
> 
> cc    /tmp/mplayer-configure--17275/tmp.c -I.      -o
> /tmp/mplayer-configure--17275/tmp
> /tmp/mplayer-configure--17275/tmp.c: In function 'main':
> /tmp/mplayer-configure--17275/tmp.c:3: warning: cast from pointer to
> integer of different size
> 
> 
> Result is: little-endian
> ##########################################
> 
> I think this happens because pointers are 8 bytes in x86-64. So, since
> the return value of the executable file is not used, in order to avoid
> the warning I propose the attached patch. Please apply if you think
> this can be useful.
> Regards,
> 
> --- configure	(revision 32238)
> +++ configure	(working copy)
> @@ -2441,7 +2441,7 @@
>    cat > $TMPC <<EOF
>  short ascii_name[] = { (('M'<<8)|'P'),(('l'<<8)|'a'),(('y'<<8)|'e'),(('r'<<8)|'B'),
>                         (('i'<<8)|'g'),(('E'<<8)|'n'),(('d'<<8)|'i'),(('a'<<8)|'n'),0};
> -int main(void) { return (int)ascii_name; }
> +int main(void) { return ascii_name[0]; }

Just casting to long will avoid the warning as well.  I tested it to
work as expected on x86_32, x86_64 and PPC.

Thanks for the patch, I'm currently working on purging warnings
from configure checks...

Diego


More information about the MPlayer-dev-eng mailing list