changeset 38210:91cae3acc973

maint: use a more standard return from mbrtowc test 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.
author Pádraig Brady <P@draigBrady.com>
date Sat, 26 Nov 2016 15:39:11 +0000
parents 52bc03cdcbdf
children ed6e125ecb76
files ChangeLog m4/mbrtowc.m4
diffstat 2 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Nov 26 15:11:55 2016 -0800
+++ b/ChangeLog	Sat Nov 26 15:39:11 2016 +0000
@@ -1,3 +1,14 @@
+2016-11-27  Pádraig Brady  <P@draigBrady.com>
+
+	maint: use a more standard return from mbrtowc test
+	* 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.
+
 2016-11-26  Paul Eggert  <eggert@cs.ucla.edu>
 
 	freopen: work around glibc bug with closed fd
--- a/m4/mbrtowc.m4	Sat Nov 26 15:11:55 2016 -0800
+++ b/m4/mbrtowc.m4	Sat Nov 26 15:39:11 2016 +0000
@@ -164,7 +164,7 @@
       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 @@
       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 @@
       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 @@
 
       memset (&state, '\0', sizeof (mbstate_t));
       if (mbrtowc (&wc, "", 1, &state) != 0)
-        return 1;
+        return 2;
     }
   return 0;
 }]])],
@@ -608,7 +608,7 @@
             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 @@
                 mbstate_t mbs = { 0, };
                 size_t ss = mbrtowc (&wc, &c, 1, &mbs);
                 if (1 < ss)
-                  return 1;
+                  return 3;
               }
             return 0;
           ]])],