Re: [PATCH] AC_C_BIGENDIAN: fix narrowing error

Eric Blake <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 03/12/2018 04:24 AM, Rechi wrote:
> The following patch will fix AC_C_BIGENDIAN, for cross compiling, if 
> narrowing is a fatal error in the used compiler.

Narrowing should not be a fatal error unless you used -Werror, which we 
advise against doing (it is impossible in general to write all configure 
snippets to be warning-proof against all possible -Werror settings). 
However, if the change is easy to maintain, I don't mind including an 
obvious warning avoidance patch.

> +++ b/lib/autoconf/c.m4
> @@ -1655,9 +1655,9 @@ AC_DEFUN([AC_C_BIGENDIAN],
>                  int use_ascii (int i) {
>                    return ascii_mm[i] + ascii_ii[i];
>                  }
> -               short int ebcdic_ii[] =
> +               unsigned short int ebcdic_ii[] =
>                    { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
> -               short int ebcdic_mm[] =
> +               unsigned short int ebcdic_mm[] =
>                    { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };

and that is easy to maintain, so I'll go ahead and incorporate it when I 
get a chance.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.