When HANDLE_MULTIBYTE is disabled, the 'c' variable is an int, but
tescape expects a char * as its second argument. This causes a type
mismatch error.
This fixes the following failure seen with br-arm-basic toolchain:
./printf.def:1230:26: error: passing argument 2 of 'tescape' from incompatible
pointer type [-Werror=incompatible-pointer-types]
1230 | s += tescape (s, &c, (int *)NULL, &temp);
| ^~
| |
| int *
./printf.def:1068:30: note: expected 'char *' but argument is of type 'int *'
1068 | tescape (char *estart, char *cp, int *lenp, int *sawc)
| ~~~~~~^~
Signed-off-by: Shubham Chakraborty <[email protected]>
---
builtins/printf.def | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/builtins/printf.def b/builtins/printf.def
index f7abf53..7332736 100644
--- a/builtins/printf.def
+++ b/builtins/printf.def
@@ -1227,7 +1227,11 @@ bexpand (char *string, size_t len, int *sawc, size_t
*lenp)
memset (mbch, '\0', sizeof (mbch));
s += tescape (s, mbch, &mblen, &temp);
#else
- s += tescape (s, &c, (int *)NULL, &temp);
+ {
+ char cc;
+ s += tescape (s, &cc, (int *)NULL, &temp);
+ c = cc;
+ }
#endif
if (temp)
{
--
2.55.0