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

Giorgio mywing81 at gmail.com
Tue Sep 14 22:22:31 CEST 2010


2010/9/14 Reimar Döffinger <Reimar.Doeffinger at gmx.de>:
> On Tue, Sep 14, 2010 at 09:51:40PM +0200, Giorgio wrote:
>> > Please don't, this might allow some compilers to optimize the whole
>> > array way thus breaking the check.
>>
>> I could live with the warning, but at this point I'd like to learn something :)
>> What about "return 0;" then? (see patch #1)
>
> Then the compiler (or linker) will almost certainly optimize it away
> (i.e. with patch #2 configure would fail at least with some compilers.
> And yes, that return was added by me for exactly that reason, originally
> it was just return 0 and I did try ascii_name[0] first and it did not help).

Oh right, it was r18477, I should have checked the svn log before asking.

holden at thinky:~/src/mplayer$ svn log -r 18477
------------------------------------------------------------------------
r18477 | diego | 2006-05-13 16:32:37 +0200 (sab, 13 mag 2006) | 5 lines

Linkers, assisted by a compiler, can optimize out the string that is being
used to test for endianness. Prevent the linker from optimizing out the
string, as it is being returned.
patch by Derek E. Lewis, dlewis^#@^#solnetworks^#.^#net

>> > It might be a good idea to check for the endian-reversed string and
>> > fail if neither or both were found in the binary.
>>
>> See patch #2
>
> If it works on bigendian and Diego is ok with it.

Ok, it's up to him then.

Thanks.

Giorgio Vazzana


More information about the MPlayer-dev-eng mailing list