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