olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

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

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