Discussion:
[PATCH] maint: use a more standard return from mbrtowc test
(too old to reply)
Pádraig Brady
2016-11-26 15:46:44 UTC
Permalink
Raw Message
With this we can use this check in coreutils to find configure issues:
grep -E '(program exited with status 1$|core dumped)' config.log

* m4/mbrtowc.m4 (gl_MBRTOWC_C_LOCALE): Don't return 1
from the test program as this often indicates an
unhandled case in the test program.
(gl_MBRTOWC_INCOMPLETE_STATE): Likewise.
(gl_MBRTOWC_SANITYCHECK): Likewise.
(gl_MBRTOWC_NULL_ARG2): Likewise.
(gl_MBRTOWC_NUL_RETVAL): Likewise.
---
m4/mbrtowc.m4 | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/m4/mbrtowc.m4 b/m4/mbrtowc.m4
index d370fcc..5edf08b 100644
--- a/m4/mbrtowc.m4
+++ b/m4/mbrtowc.m4
@@ -164,7 +164,7 @@ int main ()
memset (&state, '\0', sizeof (mbstate_t));
if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2))
if (mbsinit (&state))
- return 1;
+ return 2;
}
return 0;
}]])],
@@ -224,7 +224,7 @@ int main ()
memset (&state, '\0', sizeof (mbstate_t));
if (mbrtowc (&wc, input + 3, 6, &state) != 4
&& mbtowc (&wc, input + 3, 6) == 4)
- return 1;
+ return 2;
}
return 0;
}]])],
@@ -352,7 +352,7 @@ int main ()
mbrtowc (&wc, NULL, 5, &state);
/* Check that wc was not modified. */
if (wc != (wchar_t) 0xBADFACE)
- return 1;
+ return 2;
}
return 0;
}]])],
@@ -539,7 +539,7 @@ int main ()

memset (&state, '\0', sizeof (mbstate_t));
if (mbrtowc (&wc, "", 1, &state) != 0)
- return 1;
+ return 2;
}
return 0;
}]])],
@@ -608,7 +608,7 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE],
int i;
char *locale = setlocale (LC_ALL, "C");
if (! locale)
- return 1;
+ return 2;
for (i = CHAR_MIN; i <= CHAR_MAX; i++)
{
char c = i;
@@ -616,7 +616,7 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE],
mbstate_t mbs = { 0, };
size_t ss = mbrtowc (&wc, &c, 1, &mbs);
if (1 < ss)
- return 1;
+ return 3;
}
return 0;
]])],
--
2.5.5
Loading...