[MPlayer-dev-eng] [PATCH] configure: avoid warning in endian testing
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Tue Sep 14 20:35:16 CEST 2010
On Tue, Sep 14, 2010 at 02:54:04PM +0200, Giorgio wrote:
> Hello,
>
> 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.
Please don't, this might allow some compilers to optimize the whole
array way thus breaking the check.
It might be a good idea to check for the endian-reversed string and
fail if neither or both were found in the binary.
More information about the MPlayer-dev-eng
mailing list