Blame SOURCES/saplocales-2.2.5-rhel8.patch

6d75a7
diff -rNu compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/libc-diag.h compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/libc-diag.h
6d75a7
--- compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/libc-diag.h	1970-01-01 01:00:00.000000000 +0100
6d75a7
+++ compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/libc-diag.h	2018-01-10 07:36:33.762358809 +0100
6d75a7
@@ -0,0 +1,74 @@
6d75a7
+/* Macros for controlling diagnostic output from the compiler.
6d75a7
+   Copyright (C) 2014-2018 Free Software Foundation, Inc.
6d75a7
+   This file is part of the GNU C Library.
6d75a7
+
6d75a7
+   The GNU C Library is free software; you can redistribute it and/or
6d75a7
+   modify it under the terms of the GNU Lesser General Public
6d75a7
+   License as published by the Free Software Foundation; either
6d75a7
+   version 2.1 of the License, or (at your option) any later version.
6d75a7
+
6d75a7
+   The GNU C Library is distributed in the hope that it will be useful,
6d75a7
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
6d75a7
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
6d75a7
+   Lesser General Public License for more details.
6d75a7
+
6d75a7
+   You should have received a copy of the GNU Lesser General Public
6d75a7
+   License along with the GNU C Library; if not, see
6d75a7
+   <http://www.gnu.org/licenses/>.  */
6d75a7
+
6d75a7
+#ifndef _LIBC_DIAG_H
6d75a7
+#define _LIBC_DIAG_H 1
6d75a7
+
6d75a7
+/* Ignore the value of an expression when a cast to void does not
6d75a7
+   suffice (in particular, for a call to a function declared with
6d75a7
+   attribute warn_unused_result).  */
6d75a7
+#define ignore_value(x) \
6d75a7
+  ({ __typeof__ (x) __ignored_value = (x); (void) __ignored_value; })
6d75a7
+
6d75a7
+/* The macros to control diagnostics are structured like this, rather
6d75a7
+   than a single macro that both pushes and pops diagnostic state and
6d75a7
+   takes the affected code as an argument, because the GCC pragmas
6d75a7
+   work by disabling the diagnostic for a range of source locations
6d75a7
+   and do not work when all the pragmas and the affected code are in a
6d75a7
+   single macro expansion.  */
6d75a7
+
6d75a7
+/* Push diagnostic state.  */
6d75a7
+#define DIAG_PUSH_NEEDS_COMMENT _Pragma ("GCC diagnostic push")
6d75a7
+
6d75a7
+/* Pop diagnostic state.  */
6d75a7
+#define DIAG_POP_NEEDS_COMMENT _Pragma ("GCC diagnostic pop")
6d75a7
+
6d75a7
+#define _DIAG_STR1(s) #s
6d75a7
+#define _DIAG_STR(s) _DIAG_STR1(s)
6d75a7
+
6d75a7
+/* Ignore the diagnostic OPTION.  VERSION is the most recent GCC
6d75a7
+   version for which the diagnostic has been confirmed to appear in
6d75a7
+   the absence of the pragma (in the form MAJOR.MINOR for GCC 4.x,
6d75a7
+   just MAJOR for GCC 5 and later).  Uses of this pragma should be
6d75a7
+   reviewed when the GCC version given is no longer supported for
6d75a7
+   building glibc; the version number should always be on the same
6d75a7
+   source line as the macro name, so such uses can be found with grep.
6d75a7
+   Uses should come with a comment giving more details of the
6d75a7
+   diagnostic, and an architecture on which it is seen if possibly
6d75a7
+   optimization-related and not in architecture-specific code.  This
6d75a7
+   macro should only be used if the diagnostic seems hard to fix (for
6d75a7
+   example, optimization-related false positives).  */
6d75a7
+#define DIAG_IGNORE_NEEDS_COMMENT(version, option)     \
6d75a7
+  _Pragma (_DIAG_STR (GCC diagnostic ignored option))
6d75a7
+
6d75a7
+/* Similar to DIAG_IGNORE_NEEDS_COMMENT the following macro ignores the
6d75a7
+   diagnostic OPTION but only if optimizations for size are enabled.
6d75a7
+   This is required because different warnings may be generated for
6d75a7
+   different optimization levels.  For example a key piece of code may
6d75a7
+   only generate a warning when compiled at -Os, but at -O2 you could
6d75a7
+   still want the warning to be enabled to catch errors.  In this case
6d75a7
+   you would use DIAG_IGNORE_Os_NEEDS_COMMENT to disable the warning
6d75a7
+   only for -Os.  */
6d75a7
+#ifdef __OPTIMIZE_SIZE__
6d75a7
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option) \
6d75a7
+  _Pragma (_DIAG_STR (GCC diagnostic ignored option))
6d75a7
+#else
6d75a7
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
6d75a7
+#endif
6d75a7
+
6d75a7
+#endif /* libc-diag.h */
6d75a7
diff -rNu compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/loop.c compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/loop.c
6d75a7
--- compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/loop.c	2018-01-09 12:42:01.393580878 +0100
6d75a7
+++ compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/loop.c	2018-01-09 12:42:28.069281608 +0100
6d75a7
@@ -1,5 +1,5 @@
6d75a7
 /* Conversion loop frame work.
6d75a7
-   Copyright (C) 1998-2002, 2003, 2005, 2008 Free Software Foundation, Inc.
6d75a7
+   Copyright (C) 1998-2018 Free Software Foundation, Inc.
6d75a7
    This file is part of the GNU C Library.
6d75a7
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
6d75a7
 
6d75a7
@@ -14,9 +14,8 @@
6d75a7
    Lesser General Public License for more details.
6d75a7
 
6d75a7
    You should have received a copy of the GNU Lesser General Public
6d75a7
-   License along with the GNU C Library; if not, write to the Free
6d75a7
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6d75a7
-   02111-1307 USA.  */
6d75a7
+   License along with the GNU C Library; if not, see
6d75a7
+   <http://www.gnu.org/licenses/>.  */
6d75a7
 
6d75a7
 /* This file provides a frame for the reader loop in all conversion modules.
6d75a7
    The actual code must (of course) be provided in the actual module source
6d75a7
@@ -39,7 +38,7 @@
6d75a7
      BODY		this is supposed to expand to the body of the loop.
6d75a7
 			The user must provide this.
6d75a7
 
6d75a7
-     EXTRA_LOOP_DECLS	extra arguments passed from converion loop call.
6d75a7
+     EXTRA_LOOP_DECLS	extra arguments passed from conversion loop call.
6d75a7
 
6d75a7
      INIT_PARAMS	code to define and initialize variables from params.
6d75a7
      UPDATE_PARAMS	code to store result in params.
6d75a7
@@ -57,17 +56,17 @@
6d75a7
 #include <sys/param.h>		/* For MIN.  */
6d75a7
 #define __need_size_t
6d75a7
 #include <stddef.h>
6d75a7
-
6d75a7
+#include <libc-diag.h>
6d75a7
 
6d75a7
 /* We have to provide support for machines which are not able to handled
6d75a7
    unaligned memory accesses.  Some of the character encodings have
6d75a7
    representations with a fixed width of 2 or 4 bytes.  But if we cannot
6d75a7
    access unaligned memory we still have to read byte-wise.  */
6d75a7
 #undef FCTNAME2
6d75a7
-#if defined _STRING_ARCH_unaligned || !defined DEFINE_UNALIGNED
6d75a7
+#if _STRING_ARCH_unaligned || !defined DEFINE_UNALIGNED
6d75a7
 /* We can handle unaligned memory access.  */
6d75a7
-# define get16(addr) *((__const uint16_t *) (addr))
6d75a7
-# define get32(addr) *((__const uint32_t *) (addr))
6d75a7
+# define get16(addr) *((const uint16_t *) (addr))
6d75a7
+# define get32(addr) *((const uint32_t *) (addr))
6d75a7
 
6d75a7
 /* We need no special support for writing values either.  */
6d75a7
 # define put16(addr, val) *((uint16_t *) (addr)) = (val)
6d75a7
@@ -78,13 +77,13 @@
6d75a7
 /* Distinguish between big endian and little endian.  */
6d75a7
 # if __BYTE_ORDER == __LITTLE_ENDIAN
6d75a7
 #  define get16(addr) \
6d75a7
-     (((__const unsigned char *) (addr))[1] << 8			      \
6d75a7
-      | ((__const unsigned char *) (addr))[0])
6d75a7
+     (((const unsigned char *) (addr))[1] << 8				      \
6d75a7
+      | ((const unsigned char *) (addr))[0])
6d75a7
 #  define get32(addr) \
6d75a7
-     (((((__const unsigned char *) (addr))[3] << 8			      \
6d75a7
-	| ((__const unsigned char *) (addr))[2]) << 8			      \
6d75a7
-       | ((__const unsigned char *) (addr))[1]) << 8			      \
6d75a7
-      | ((__const unsigned char *) (addr))[0])
6d75a7
+     (((((const unsigned char *) (addr))[3] << 8			      \
6d75a7
+	| ((const unsigned char *) (addr))[2]) << 8			      \
6d75a7
+       | ((const unsigned char *) (addr))[1]) << 8			      \
6d75a7
+      | ((const unsigned char *) (addr))[0])
6d75a7
 
6d75a7
 #  define put16(addr, val) \
6d75a7
      ({ uint16_t __val = (val);						      \
6d75a7
@@ -103,13 +102,13 @@
6d75a7
 	(void) 0; })
6d75a7
 # else
6d75a7
 #  define get16(addr) \
6d75a7
-     (((__const unsigned char *) (addr))[0] << 8			      \
6d75a7
-      | ((__const unsigned char *) (addr))[1])
6d75a7
+     (((const unsigned char *) (addr))[0] << 8				      \
6d75a7
+      | ((const unsigned char *) (addr))[1])
6d75a7
 #  define get32(addr) \
6d75a7
-     (((((__const unsigned char *) (addr))[0] << 8			      \
6d75a7
-	| ((__const unsigned char *) (addr))[1]) << 8			      \
6d75a7
-       | ((__const unsigned char *) (addr))[2]) << 8			      \
6d75a7
-      | ((__const unsigned char *) (addr))[3])
6d75a7
+     (((((const unsigned char *) (addr))[0] << 8			      \
6d75a7
+	| ((const unsigned char *) (addr))[1]) << 8			      \
6d75a7
+       | ((const unsigned char *) (addr))[2]) << 8			      \
6d75a7
+      | ((const unsigned char *) (addr))[3])
6d75a7
 
6d75a7
 #  define put16(addr, val) \
6d75a7
      ({ uint16_t __val = (val);						      \
6d75a7
@@ -214,8 +213,6 @@
6d75a7
    points.  */
6d75a7
 #define STANDARD_TO_LOOP_ERR_HANDLER(Incr) \
6d75a7
   {									      \
6d75a7
-    struct __gconv_trans_data *trans;					      \
6d75a7
-									      \
6d75a7
     result = __GCONV_ILLEGAL_INPUT;					      \
6d75a7
 									      \
6d75a7
     if (irreversible == NULL)						      \
6d75a7
@@ -228,21 +225,17 @@
6d75a7
     UPDATE_PARAMS;							      \
6d75a7
 									      \
6d75a7
     /* First try the transliteration methods.  */			      \
6d75a7
-    for (trans = step_data->__trans; trans != NULL; trans = trans->__next)    \
6d75a7
-      {									      \
6d75a7
-	result = DL_CALL_FCT (trans->__trans_fct,			      \
6d75a7
-			      (step, step_data, trans->__data, *inptrp,	      \
6d75a7
-			       &inptr, inend, &outptr, irreversible));	      \
6d75a7
-	if (result != __GCONV_ILLEGAL_INPUT)				      \
6d75a7
-	  break;							      \
6d75a7
-      }									      \
6d75a7
+    if ((step_data->__flags & __GCONV_TRANSLIT) != 0)			      \
6d75a7
+      result = __gconv_transliterate					      \
6d75a7
+	(step, step_data, *inptrp,					      \
6d75a7
+	 &inptr, inend, &outptr, irreversible);			      \
6d75a7
 									      \
6d75a7
     REINIT_PARAMS;							      \
6d75a7
 									      \
6d75a7
     /* If any of them recognized the input continue with the loop.  */	      \
6d75a7
     if (result != __GCONV_ILLEGAL_INPUT)				      \
6d75a7
       {									      \
6d75a7
-	if (__builtin_expect (result == __GCONV_FULL_OUTPUT, 0))	      \
6d75a7
+	if (__glibc_unlikely (result == __GCONV_FULL_OUTPUT))		      \
6d75a7
 	  break;							      \
6d75a7
 									      \
6d75a7
 	continue;							      \
6d75a7
@@ -343,7 +336,7 @@
6d75a7
 
6d75a7
 /* Include the file a second time to define the function to handle
6d75a7
    unaligned access.  */
6d75a7
-#if !defined DEFINE_UNALIGNED && !defined _STRING_ARCH_unaligned \
6d75a7
+#if !defined DEFINE_UNALIGNED && !_STRING_ARCH_unaligned \
6d75a7
     && MIN_NEEDED_INPUT != 1 && MAX_NEEDED_INPUT % MIN_NEEDED_INPUT == 0 \
6d75a7
     && MIN_NEEDED_OUTPUT != 1 && MAX_NEEDED_OUTPUT % MIN_NEEDED_OUTPUT == 0
6d75a7
 # undef get16
6d75a7
@@ -355,12 +348,10 @@
6d75a7
 # define DEFINE_UNALIGNED
6d75a7
 # include "loop.c"
6d75a7
 # undef DEFINE_UNALIGNED
6d75a7
-#endif
6d75a7
-
6d75a7
-
6d75a7
-#if MAX_NEEDED_INPUT > 1
6d75a7
-# define SINGLE(fct) SINGLE2 (fct)
6d75a7
-# define SINGLE2(fct) fct##_single
6d75a7
+#else
6d75a7
+# if MAX_NEEDED_INPUT > 1
6d75a7
+#  define SINGLE(fct) SINGLE2 (fct)
6d75a7
+#  define SINGLE2(fct) fct##_single
6d75a7
 static inline int
6d75a7
 __attribute ((always_inline))
6d75a7
 SINGLE(LOOPFCT) (struct __gconv_step *step,
6d75a7
@@ -370,46 +361,57 @@
6d75a7
 		 size_t *irreversible EXTRA_LOOP_DECLS)
6d75a7
 {
6d75a7
   mbstate_t *state = step_data->__statep;
6d75a7
-#ifdef LOOP_NEED_FLAGS
6d75a7
+#  ifdef LOOP_NEED_FLAGS
6d75a7
   int flags = step_data->__flags;
6d75a7
-#endif
6d75a7
-#ifdef LOOP_NEED_DATA
6d75a7
+#  endif
6d75a7
+#  ifdef LOOP_NEED_DATA
6d75a7
   void *data = step->__data;
6d75a7
-#endif
6d75a7
+#  endif
6d75a7
   int result = __GCONV_OK;
6d75a7
   unsigned char bytebuf[MAX_NEEDED_INPUT];
6d75a7
   const unsigned char *inptr = *inptrp;
6d75a7
   unsigned char *outptr = *outptrp;
6d75a7
   size_t inlen;
6d75a7
 
6d75a7
-#ifdef INIT_PARAMS
6d75a7
+#  ifdef INIT_PARAMS
6d75a7
   INIT_PARAMS;
6d75a7
-#endif
6d75a7
+#  endif
6d75a7
 
6d75a7
-#ifdef UNPACK_BYTES
6d75a7
+#  ifdef UNPACK_BYTES
6d75a7
   UNPACK_BYTES
6d75a7
-#else
6d75a7
+#  else
6d75a7
   /* Add the bytes from the state to the input buffer.  */
6d75a7
+  assert ((state->__count & 7) <= sizeof (state->__value));
6d75a7
   for (inlen = 0; inlen < (size_t) (state->__count & 7); ++inlen)
6d75a7
     bytebuf[inlen] = state->__value.__wchb[inlen];
6d75a7
-#endif
6d75a7
+#  endif
6d75a7
 
6d75a7
   /* Are there enough bytes in the input buffer?  */
6d75a7
-  if (__builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0))
6d75a7
+  if (MIN_NEEDED_INPUT > 1
6d75a7
+      && __builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0))
6d75a7
     {
6d75a7
       *inptrp = inend;
6d75a7
-#ifdef STORE_REST
6d75a7
+#  ifdef STORE_REST
6d75a7
+
6d75a7
+      /* Building with -O3 GCC emits a `array subscript is above array
6d75a7
+	 bounds' warning.  GCC BZ #64739 has been opened for this.  */
6d75a7
+      DIAG_PUSH_NEEDS_COMMENT;
6d75a7
+      DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Warray-bounds");
6d75a7
+      while (inptr < inend)
6d75a7
+	bytebuf[inlen++] = *inptr++;
6d75a7
+      DIAG_POP_NEEDS_COMMENT;
6d75a7
+
6d75a7
       inptr = bytebuf;
6d75a7
       inptrp = &inptr;
6d75a7
       inend = &bytebuf[inlen];
6d75a7
 
6d75a7
       STORE_REST
6d75a7
-#else
6d75a7
+#  else
6d75a7
       /* We don't have enough input for another complete input
6d75a7
 	 character.  */
6d75a7
       while (inptr < inend)
6d75a7
 	state->__value.__wchb[inlen++] = *inptr++;
6d75a7
-#endif
6d75a7
+#  endif
6d75a7
 
6d75a7
       return __GCONV_INCOMPLETE_INPUT;
6d75a7
     }
6d75a7
@@ -438,7 +440,7 @@
6d75a7
      bytes from the state and at least one more, or the character is still
6d75a7
      incomplete, or we have some other error (like illegal input character,
6d75a7
      no space in output buffer).  */
6d75a7
-  if (__builtin_expect (inptr != bytebuf, 1))
6d75a7
+  if (__glibc_likely (inptr != bytebuf))
6d75a7
     {
6d75a7
       /* We found a new character.  */
6d75a7
       assert (inptr - bytebuf > (state->__count & 7));
6d75a7
@@ -449,11 +451,11 @@
6d75a7
       result = __GCONV_OK;
6d75a7
 
6d75a7
       /* Clear the state buffer.  */
6d75a7
-#ifdef CLEAR_STATE
6d75a7
+#  ifdef CLEAR_STATE
6d75a7
       CLEAR_STATE;
6d75a7
-#else
6d75a7
+#  else
6d75a7
       state->__count &= ~7;
6d75a7
-#endif
6d75a7
+#  endif
6d75a7
     }
6d75a7
   else if (result == __GCONV_INCOMPLETE_INPUT)
6d75a7
     {
6d75a7
@@ -462,37 +464,38 @@
6d75a7
       assert (inend != &bytebuf[MAX_NEEDED_INPUT]);
6d75a7
 
6d75a7
       *inptrp += inend - bytebuf - (state->__count & 7);
6d75a7
-#ifdef STORE_REST
6d75a7
+#  ifdef STORE_REST
6d75a7
       inptrp = &inptr;
6d75a7
 
6d75a7
       STORE_REST
6d75a7
-#else
6d75a7
+#  else
6d75a7
       /* We don't have enough input for another complete input
6d75a7
 	 character.  */
6d75a7
       assert (inend - inptr > (state->__count & ~7));
6d75a7
-      assert (inend - inptr <= 7);
6d75a7
+      assert (inend - inptr <= sizeof (state->__value));
6d75a7
       state->__count = (state->__count & ~7) | (inend - inptr);
6d75a7
       inlen = 0;
6d75a7
       while (inptr < inend)
6d75a7
 	state->__value.__wchb[inlen++] = *inptr++;
6d75a7
-#endif
6d75a7
+#  endif
6d75a7
     }
6d75a7
 
6d75a7
   return result;
6d75a7
 }
6d75a7
-# undef SINGLE
6d75a7
-# undef SINGLE2
6d75a7
-#endif
6d75a7
+#  undef SINGLE
6d75a7
+#  undef SINGLE2
6d75a7
+# endif
6d75a7
 
6d75a7
 
6d75a7
-#ifdef ONEBYTE_BODY
6d75a7
+# ifdef ONEBYTE_BODY
6d75a7
 /* Define the shortcut function for btowc.  */
6d75a7
 static wint_t
6d75a7
 gconv_btowc (struct __gconv_step *step, unsigned char c)
6d75a7
   ONEBYTE_BODY
6d75a7
-# define FROM_ONEBYTE gconv_btowc
6d75a7
-#endif
6d75a7
+#  define FROM_ONEBYTE gconv_btowc
6d75a7
+# endif
6d75a7
 
6d75a7
+#endif
6d75a7
 
6d75a7
 /* We remove the macro definitions so that we can include this file again
6d75a7
    for the definition of another function.  */
6d75a7
diff -rNu compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/skeleton.c compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/skeleton.c
6d75a7
--- compat-locales-sap-1.0.10.orig/saplocales-2.2.5/iconv/skeleton.c	2018-01-09 12:42:01.394580867 +0100
6d75a7
+++ compat-locales-sap-1.0.10/saplocales-2.2.5/iconv/skeleton.c	2018-01-10 07:58:37.922439161 +0100
6d75a7
@@ -1,5 +1,5 @@
6d75a7
 /* Skeleton for a conversion module.
6d75a7
-   Copyright (C) 1998-2002, 2005 Free Software Foundation, Inc.
6d75a7
+   Copyright (C) 1998-2018 Free Software Foundation, Inc.
6d75a7
    This file is part of the GNU C Library.
6d75a7
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
6d75a7
 
6d75a7
@@ -14,9 +14,8 @@
6d75a7
    Lesser General Public License for more details.
6d75a7
 
6d75a7
    You should have received a copy of the GNU Lesser General Public
6d75a7
-   License along with the GNU C Library; if not, write to the Free
6d75a7
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
6d75a7
-   02111-1307 USA.  */
6d75a7
+   License along with the GNU C Library; if not, see
6d75a7
+   <http://www.gnu.org/licenses/>.  */
6d75a7
 
6d75a7
 /* This file can be included to provide definitions of several things
6d75a7
    many modules have in common.  It can be customized using the following
6d75a7
@@ -39,24 +38,24 @@
6d75a7
 
6d75a7
      FROM_LOOP_MIN_NEEDED_FROM
6d75a7
      FROM_LOOP_MAX_NEEDED_FROM
6d75a7
-                        minimal/maximal number of bytes needed on input
6d75a7
-                        of one round through the FROM_LOOP.  Defaults
6d75a7
-                        to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
6d75a7
+			minimal/maximal number of bytes needed on input
6d75a7
+			of one round through the FROM_LOOP.  Defaults
6d75a7
+			to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
6d75a7
      FROM_LOOP_MIN_NEEDED_TO
6d75a7
      FROM_LOOP_MAX_NEEDED_TO
6d75a7
-                        minimal/maximal number of bytes needed on output
6d75a7
-                        of one round through the FROM_LOOP.  Defaults
6d75a7
-                        to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
6d75a7
+			minimal/maximal number of bytes needed on output
6d75a7
+			of one round through the FROM_LOOP.  Defaults
6d75a7
+			to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
6d75a7
      TO_LOOP_MIN_NEEDED_FROM
6d75a7
      TO_LOOP_MAX_NEEDED_FROM
6d75a7
-                        minimal/maximal number of bytes needed on input
6d75a7
-                        of one round through the TO_LOOP.  Defaults
6d75a7
-                        to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
6d75a7
+			minimal/maximal number of bytes needed on input
6d75a7
+			of one round through the TO_LOOP.  Defaults
6d75a7
+			to MIN_NEEDED_TO and MAX_NEEDED_TO, respectively.
6d75a7
      TO_LOOP_MIN_NEEDED_TO
6d75a7
      TO_LOOP_MAX_NEEDED_TO
6d75a7
-                        minimal/maximal number of bytes needed on output
6d75a7
-                        of one round through the TO_LOOP.  Defaults
6d75a7
-                        to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
6d75a7
+			minimal/maximal number of bytes needed on output
6d75a7
+			of one round through the TO_LOOP.  Defaults
6d75a7
+			to MIN_NEEDED_FROM and MAX_NEEDED_FROM, respectively.
6d75a7
 
6d75a7
      FROM_DIRECTION	this macro is supposed to return a value != 0
6d75a7
 			if we convert from the current character set,
6d75a7
@@ -145,6 +144,7 @@
6d75a7
 #endif
6d75a7
 
6d75a7
 #include <sysdep.h>
6d75a7
+#include <stdint.h>
6d75a7
 
6d75a7
 #ifndef DL_CALL_FCT
6d75a7
 # define DL_CALL_FCT(fct, args) fct args
6d75a7
@@ -163,7 +163,6 @@
6d75a7
 # endif
6d75a7
 #endif
6d75a7
 
6d75a7
-
6d75a7
 /* How many bytes are needed at most for the from-charset.  */
6d75a7
 #ifndef MAX_NEEDED_FROM
6d75a7
 # define MAX_NEEDED_FROM	MIN_NEEDED_FROM
6d75a7
@@ -204,10 +203,10 @@
6d75a7
 /* Define macros which can access unaligned buffers.  These macros are
6d75a7
    supposed to be used only in code outside the inner loops.  For the inner
6d75a7
    loops we have other definitions which allow optimized access.  */
6d75a7
-#ifdef _STRING_ARCH_unaligned
6d75a7
+#if _STRING_ARCH_unaligned
6d75a7
 /* We can handle unaligned memory access.  */
6d75a7
-# define get16u(addr) *((__const uint16_t *) (addr))
6d75a7
-# define get32u(addr) *((__const uint32_t *) (addr))
6d75a7
+# define get16u(addr) *((const uint16_t *) (addr))
6d75a7
+# define get32u(addr) *((const uint32_t *) (addr))
6d75a7
 
6d75a7
 /* We need no special support for writing values either.  */
6d75a7
 # define put16u(addr, val) *((uint16_t *) (addr)) = (val)
6d75a7
@@ -216,13 +215,13 @@
6d75a7
 /* Distinguish between big endian and little endian.  */
6d75a7
 # if __BYTE_ORDER == __LITTLE_ENDIAN
6d75a7
 #  define get16u(addr) \
6d75a7
-     (((__const unsigned char *) (addr))[1] << 8			      \
6d75a7
-      | ((__const unsigned char *) (addr))[0])
6d75a7
+     (((const unsigned char *) (addr))[1] << 8				      \
6d75a7
+      | ((const unsigned char *) (addr))[0])
6d75a7
 #  define get32u(addr) \
6d75a7
-     (((((__const unsigned char *) (addr))[3] << 8			      \
6d75a7
-	| ((__const unsigned char *) (addr))[2]) << 8			      \
6d75a7
-       | ((__const unsigned char *) (addr))[1]) << 8			      \
6d75a7
-      | ((__const unsigned char *) (addr))[0])
6d75a7
+     (((((const unsigned char *) (addr))[3] << 8			      \
6d75a7
+	| ((const unsigned char *) (addr))[2]) << 8			      \
6d75a7
+       | ((const unsigned char *) (addr))[1]) << 8			      \
6d75a7
+      | ((const unsigned char *) (addr))[0])
6d75a7
 
6d75a7
 #  define put16u(addr, val) \
6d75a7
      ({ uint16_t __val = (val);						      \
6d75a7
@@ -241,13 +240,13 @@
6d75a7
 	(void) 0; })
6d75a7
 # else
6d75a7
 #  define get16u(addr) \
6d75a7
-     (((__const unsigned char *) (addr))[0] << 8			      \
6d75a7
-      | ((__const unsigned char *) (addr))[1])
6d75a7
+     (((const unsigned char *) (addr))[0] << 8				      \
6d75a7
+      | ((const unsigned char *) (addr))[1])
6d75a7
 #  define get32u(addr) \
6d75a7
-     (((((__const unsigned char *) (addr))[0] << 8			      \
6d75a7
-	| ((__const unsigned char *) (addr))[1]) << 8			      \
6d75a7
-       | ((__const unsigned char *) (addr))[2]) << 8			      \
6d75a7
-      | ((__const unsigned char *) (addr))[3])
6d75a7
+     (((((const unsigned char *) (addr))[0] << 8			      \
6d75a7
+	| ((const unsigned char *) (addr))[1]) << 8			      \
6d75a7
+       | ((const unsigned char *) (addr))[2]) << 8			      \
6d75a7
+      | ((const unsigned char *) (addr))[3])
6d75a7
 
6d75a7
 #  define put16u(addr, val) \
6d75a7
      ({ uint16_t __val = (val);						      \
6d75a7
@@ -410,7 +409,7 @@
6d75a7
   /* If the function is called with no input this means we have to reset
6d75a7
      to the initial state.  The possibly partly converted input is
6d75a7
      dropped.  */
6d75a7
-  if (__builtin_expect (do_flush, 0))
6d75a7
+  if (__glibc_unlikely (do_flush))
6d75a7
     {
6d75a7
       /* This should never happen during error handling.  */
6d75a7
       assert (outbufstart == NULL);
6d75a7
@@ -461,7 +460,7 @@
6d75a7
 
6d75a7
 		      if (result != __GCONV_EMPTY_INPUT)
6d75a7
 			{
6d75a7
-			  if (__builtin_expect (outerr != outbuf, 0))
6d75a7
+			  if (__glibc_unlikely (outerr != outbuf))
6d75a7
 			    {
6d75a7
 			      /* We have a problem.  Undo the conversion.  */
6d75a7
 			      outbuf = outstart;
6d75a7
@@ -502,8 +501,9 @@
6d75a7
     }
6d75a7
   else
6d75a7
     {
6d75a7
-      /* We preserve the initial values of the pointer variables.  */
6d75a7
-      const unsigned char *inptr = *inptrp;
6d75a7
+      /* We preserve the initial values of the pointer variables,
6d75a7
+	 but only some conversion modules need it.  */
6d75a7
+      const unsigned char *inptr __attribute__ ((__unused__)) = *inptrp;
6d75a7
       unsigned char *outbuf = (__builtin_expect (outbufstart == NULL, 1)
6d75a7
 			       ? data->__outbuf : *outbufstart);
6d75a7
       unsigned char *outend = data->__outbufend;
6d75a7
@@ -514,7 +514,7 @@
6d75a7
       size_t *lirreversiblep = irreversible ? &lirreversible : NULL;
6d75a7
 
6d75a7
       /* The following assumes that encodings, which have a variable length
6d75a7
-	 what might unalign a buffer even though it is a aligned in the
6d75a7
+	 what might unalign a buffer even though it is an aligned in the
6d75a7
 	 beginning, either don't have the minimal number of bytes as a divisor
6d75a7
 	 of the maximum length or have a minimum length of 1.  This is true
6d75a7
 	 for all known and supported encodings.
6d75a7
@@ -523,7 +523,7 @@
6d75a7
 	 INTERNAL, for which the subexpression evaluates to 1, but INTERNAL
6d75a7
 	 buffers are always aligned correctly.  */
6d75a7
 #define POSSIBLY_UNALIGNED \
6d75a7
-  (!defined _STRING_ARCH_unaligned					      \
6d75a7
+  (!_STRING_ARCH_unaligned					              \
6d75a7
    && (((FROM_LOOP_MIN_NEEDED_FROM != 1					      \
6d75a7
 	 && FROM_LOOP_MAX_NEEDED_FROM % FROM_LOOP_MIN_NEEDED_FROM == 0)	      \
6d75a7
 	&& (FROM_LOOP_MIN_NEEDED_TO != 1				      \
6d75a7
@@ -554,8 +554,8 @@
6d75a7
 	  && consume_incomplete && (data->__statep->__count & 7) != 0)
6d75a7
 	{
6d75a7
 	  /* Yep, we have some bytes left over.  Process them now.
6d75a7
-             But this must not happen while we are called from an
6d75a7
-             error handler.  */
6d75a7
+	     But this must not happen while we are called from an
6d75a7
+	     error handler.  */
6d75a7
 	  assert (outbufstart == NULL);
6d75a7
 
6d75a7
 # if FROM_LOOP_MAX_NEEDED_FROM > 1
6d75a7
@@ -593,8 +593,6 @@
6d75a7
 
6d75a7
       while (1)
6d75a7
 	{
6d75a7
-	  struct __gconv_trans_data *trans;
6d75a7
-
6d75a7
 	  /* Remember the start value for this round.  */
6d75a7
 	  inptr = *inptrp;
6d75a7
 	  /* The outbuf buffer is empty.  */
6d75a7
@@ -604,7 +602,7 @@
6d75a7
 	  SAVE_RESET_STATE (1);
6d75a7
 #endif
6d75a7
 
6d75a7
-	  if (__builtin_expect (!unaligned, 1))
6d75a7
+	  if (__glibc_likely (!unaligned))
6d75a7
 	    {
6d75a7
 	      if (FROM_DIRECTION)
6d75a7
 		/* Run the conversion loop.  */
6d75a7
@@ -635,38 +633,31 @@
6d75a7
 
6d75a7
 	  /* If we were called as part of an error handling module we
6d75a7
 	     don't do anything else here.  */
6d75a7
-	  if (__builtin_expect (outbufstart != NULL, 0))
6d75a7
+	  if (__glibc_unlikely (outbufstart != NULL))
6d75a7
 	    {
6d75a7
 	      *outbufstart = outbuf;
6d75a7
 	      return status;
6d75a7
 	    }
6d75a7
 
6d75a7
-	  /* Give the transliteration module the chance to store the
6d75a7
-	     original text and the result in case it needs a context.  */
6d75a7
-	  for (trans = data->__trans; trans != NULL; trans = trans->__next)
6d75a7
-	    if (trans->__trans_context_fct != NULL)
6d75a7
-	      DL_CALL_FCT (trans->__trans_context_fct,
6d75a7
-			   (trans->__data, inptr, *inptrp, outstart, outbuf));
6d75a7
-
6d75a7
 	  /* We finished one use of the loops.  */
6d75a7
 	  ++data->__invocation_counter;
6d75a7
 
6d75a7
 	  /* If this is the last step leave the loop, there is nothing
6d75a7
-             we can do.  */
6d75a7
-	  if (__builtin_expect (data->__flags & __GCONV_IS_LAST, 0))
6d75a7
+	     we can do.  */
6d75a7
+	  if (__glibc_unlikely (data->__flags & __GCONV_IS_LAST))
6d75a7
 	    {
6d75a7
 	      /* Store information about how many bytes are available.  */
6d75a7
 	      data->__outbuf = outbuf;
6d75a7
 
6d75a7
 	      /* Remember how many non-identical characters we
6d75a7
-                 converted in a irreversible way.  */
6d75a7
+		 converted in an irreversible way.  */
6d75a7
 	      *irreversible += lirreversible;
6d75a7
 
6d75a7
 	      break;
6d75a7
 	    }
6d75a7
 
6d75a7
 	  /* Write out all output which was produced.  */
6d75a7
-	  if (__builtin_expect (outbuf > outstart, 1))
6d75a7
+	  if (__glibc_likely (outbuf > outstart))
6d75a7
 	    {
6d75a7
 	      const unsigned char *outerr = data->__outbuf;
6d75a7
 	      int result;
6d75a7
@@ -677,14 +668,14 @@
6d75a7
 
6d75a7
 	      if (result != __GCONV_EMPTY_INPUT)
6d75a7
 		{
6d75a7
-		  if (__builtin_expect (outerr != outbuf, 0))
6d75a7
+		  if (__glibc_unlikely (outerr != outbuf))
6d75a7
 		    {
6d75a7
 #ifdef RESET_INPUT_BUFFER
6d75a7
 		      RESET_INPUT_BUFFER;
6d75a7
 #else
6d75a7
 		      /* We have a problem in one of the functions below.
6d75a7
 			 Undo the conversion upto the error point.  */
6d75a7
-		      size_t nstatus;
6d75a7
+		      size_t nstatus __attribute__ ((unused));
6d75a7
 
6d75a7
 		      /* Reload the pointers.  */
6d75a7
 		      *inptrp = inptr;
6d75a7
@@ -695,7 +686,7 @@
6d75a7
 		      SAVE_RESET_STATE (0);
6d75a7
 # endif
6d75a7
 
6d75a7
-		      if (__builtin_expect (!unaligned, 1))
6d75a7
+		      if (__glibc_likely (!unaligned))
6d75a7
 			{
6d75a7
 			  if (FROM_DIRECTION)
6d75a7
 			    /* Run the conversion loop.  */
6d75a7
@@ -738,7 +729,7 @@
6d75a7
 
6d75a7
 		      /* If we haven't consumed a single byte decrement
6d75a7
 			 the invocation counter.  */
6d75a7
-		      if (__builtin_expect (outbuf == outstart, 0))
6d75a7
+		      if (__glibc_unlikely (outbuf == outstart))
6d75a7
 			--data->__invocation_counter;
6d75a7
 #endif	/* reset input buffer */
6d75a7
 		    }
6d75a7
@@ -782,7 +773,7 @@
6d75a7
 	  STORE_REST
6d75a7
 # else
6d75a7
 	  /* Make sure the remaining bytes fit into the state objects
6d75a7
-             buffer.  */
6d75a7
+	     buffer.  */
6d75a7
 	  assert (inend - *inptrp < 4);
6d75a7
 
6d75a7
 	  size_t cnt;