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