Blame SOURCES/glibc-rh1505492-undef-43.patch

25845f
commit 32bead5b6d6edc4421a8ca628ce7dc14d435202a
25845f
Author: Will Newton <will.newton@linaro.org>
25845f
Date:   Thu Jul 10 09:18:03 2014 +0100
25845f
25845f
    iconv/loop.c: Fix -Wundef warning with !_STRING_ARCH_unaligned
25845f
    
25845f
    If code is required to handle the unaligned case then loop.c includes
25845f
    itself and relies on the #undefs at the end of the file to avoid
25845f
    outputting two copies of LOOPFCT and gconv_btowc. However
25845f
    MAX_NEEDED_INPUT is tested with #if so this causes a warning.
25845f
    Reorder the code so that the function definitions are in an #else
25845f
    block to make the behaviour clearer and fix the warning.
25845f
    
25845f
    Verified that code is unchanged on x86_64 and arm.
25845f
    
25845f
    ChangeLog:
25845f
    
25845f
    2014-07-17  Will Newton  <will.newton@linaro.org>
25845f
    
25845f
            * iconv/loop.c: Move definition of LOOPFCT and gconv_btowc
25845f
            into an #else block.
25845f
25845f
diff --git a/iconv/loop.c b/iconv/loop.c
25845f
index 7b2499a3d0657265..9152209b67d32481 100644
25845f
--- a/iconv/loop.c
25845f
+++ b/iconv/loop.c
25845f
@@ -354,12 +354,10 @@ FCTNAME (LOOPFCT) (struct __gconv_step *step,
25845f
 # define DEFINE_UNALIGNED
25845f
 # include "loop.c"
25845f
 # undef DEFINE_UNALIGNED
25845f
-#endif
25845f
-
25845f
-
25845f
-#if MAX_NEEDED_INPUT > 1
25845f
-# define SINGLE(fct) SINGLE2 (fct)
25845f
-# define SINGLE2(fct) fct##_single
25845f
+#else
25845f
+# if MAX_NEEDED_INPUT > 1
25845f
+#  define SINGLE(fct) SINGLE2 (fct)
25845f
+#  define SINGLE2(fct) fct##_single
25845f
 static inline int
25845f
 __attribute ((always_inline))
25845f
 SINGLE(LOOPFCT) (struct __gconv_step *step,
25845f
@@ -369,37 +367,37 @@ SINGLE(LOOPFCT) (struct __gconv_step *step,
25845f
 		 size_t *irreversible EXTRA_LOOP_DECLS)
25845f
 {
25845f
   mbstate_t *state = step_data->__statep;
25845f
-#ifdef LOOP_NEED_FLAGS
25845f
+#  ifdef LOOP_NEED_FLAGS
25845f
   int flags = step_data->__flags;
25845f
-#endif
25845f
-#ifdef LOOP_NEED_DATA
25845f
+#  endif
25845f
+#  ifdef LOOP_NEED_DATA
25845f
   void *data = step->__data;
25845f
-#endif
25845f
+#  endif
25845f
   int result = __GCONV_OK;
25845f
   unsigned char bytebuf[MAX_NEEDED_INPUT];
25845f
   const unsigned char *inptr = *inptrp;
25845f
   unsigned char *outptr = *outptrp;
25845f
   size_t inlen;
25845f
 
25845f
-#ifdef INIT_PARAMS
25845f
+#  ifdef INIT_PARAMS
25845f
   INIT_PARAMS;
25845f
-#endif
25845f
+#  endif
25845f
 
25845f
-#ifdef UNPACK_BYTES
25845f
+#  ifdef UNPACK_BYTES
25845f
   UNPACK_BYTES
25845f
-#else
25845f
+#  else
25845f
   /* Add the bytes from the state to the input buffer.  */
25845f
   assert ((state->__count & 7) <= sizeof (state->__value));
25845f
   for (inlen = 0; inlen < (size_t) (state->__count & 7); ++inlen)
25845f
     bytebuf[inlen] = state->__value.__wchb[inlen];
25845f
-#endif
25845f
+#  endif
25845f
 
25845f
   /* Are there enough bytes in the input buffer?  */
25845f
   if (MIN_NEEDED_INPUT > 1
25845f
       && __builtin_expect (inptr + (MIN_NEEDED_INPUT - inlen) > inend, 0))
25845f
     {
25845f
       *inptrp = inend;
25845f
-#ifdef STORE_REST
25845f
+#  ifdef STORE_REST
25845f
       while (inptr < inend)
25845f
 	bytebuf[inlen++] = *inptr++;
25845f
 
25845f
@@ -408,12 +406,12 @@ SINGLE(LOOPFCT) (struct __gconv_step *step,
25845f
       inend = &bytebuf[inlen];
25845f
 
25845f
       STORE_REST
25845f
-#else
25845f
+#  else
25845f
       /* We don't have enough input for another complete input
25845f
 	 character.  */
25845f
       while (inptr < inend)
25845f
 	state->__value.__wchb[inlen++] = *inptr++;
25845f
-#endif
25845f
+#  endif
25845f
 
25845f
       return __GCONV_INCOMPLETE_INPUT;
25845f
     }
25845f
@@ -453,11 +451,11 @@ SINGLE(LOOPFCT) (struct __gconv_step *step,
25845f
       result = __GCONV_OK;
25845f
 
25845f
       /* Clear the state buffer.  */
25845f
-#ifdef CLEAR_STATE
25845f
+#  ifdef CLEAR_STATE
25845f
       CLEAR_STATE;
25845f
-#else
25845f
+#  else
25845f
       state->__count &= ~7;
25845f
-#endif
25845f
+#  endif
25845f
     }
25845f
   else if (result == __GCONV_INCOMPLETE_INPUT)
25845f
     {
25845f
@@ -466,11 +464,11 @@ SINGLE(LOOPFCT) (struct __gconv_step *step,
25845f
       assert (inend != &bytebuf[MAX_NEEDED_INPUT]);
25845f
 
25845f
       *inptrp += inend - bytebuf - (state->__count & 7);
25845f
-#ifdef STORE_REST
25845f
+#  ifdef STORE_REST
25845f
       inptrp = &inptr;
25845f
 
25845f
       STORE_REST
25845f
-#else
25845f
+#  else
25845f
       /* We don't have enough input for another complete input
25845f
 	 character.  */
25845f
       assert (inend - inptr > (state->__count & ~7));
25845f
@@ -479,24 +477,25 @@ SINGLE(LOOPFCT) (struct __gconv_step *step,
25845f
       inlen = 0;
25845f
       while (inptr < inend)
25845f
 	state->__value.__wchb[inlen++] = *inptr++;
25845f
-#endif
25845f
+#  endif
25845f
     }
25845f
 
25845f
   return result;
25845f
 }
25845f
-# undef SINGLE
25845f
-# undef SINGLE2
25845f
-#endif
25845f
+#  undef SINGLE
25845f
+#  undef SINGLE2
25845f
+# endif
25845f
 
25845f
 
25845f
-#ifdef ONEBYTE_BODY
25845f
+# ifdef ONEBYTE_BODY
25845f
 /* Define the shortcut function for btowc.  */
25845f
 static wint_t
25845f
 gconv_btowc (struct __gconv_step *step, unsigned char c)
25845f
   ONEBYTE_BODY
25845f
-# define FROM_ONEBYTE gconv_btowc
25845f
-#endif
25845f
+#  define FROM_ONEBYTE gconv_btowc
25845f
+# endif
25845f
 
25845f
+#endif
25845f
 
25845f
 /* We remove the macro definitions so that we can include this file again
25845f
    for the definition of another function.  */