[PATCH] AC_C_BIGENDIAN: fix narrowing error

Rechi <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <[email protected]>
The following patch will fix AC_C_BIGENDIAN, for cross compiling, if 
narrowing is a fatal error in the used compiler.

error: narrowing conversion of ‘35283’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]
    { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
                                                        ^
error: narrowing conversion of ‘58339’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]
error: narrowing conversion of ‘34195’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]
error: narrowing conversion of ‘38341’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]
error: narrowing conversion of ‘35268’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]
error: narrowing conversion of ‘38273’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]
error: narrowing conversion of ‘49865’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]
    { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
                                                        ^
error: narrowing conversion of ‘51077’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]
error: narrowing conversion of ‘38340’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]
error: narrowing conversion of ‘35201’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]
error: narrowing conversion of ‘38370’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]
error: narrowing conversion of ‘43234’ from ‘int’ to ‘short int’ inside 
{ } [-Wnarrowing]


--- a/lib/autoconf/c.m4
+++ 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 };
                 int use_ebcdic (int i) {
                   return ebcdic_mm[i] + ebcdic_ii[i];
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.