This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Build fails with an error in setlocale.h

Hi Matthew,

[please don't CC me.  I'm subscribed to the newlib ML anyway.  Thanks.]

On Aug 16 11:37, Matthew Wahab wrote:
> Hello,
> I get a build failure when cross-compiling for aarch64-none-elf, the error
> message is
> ----
> newlib-cygwin/newlib/libc/stdlib/../locale/setlocale.h:206:38: error:
> unknown type name 'locale_t'; did you mean 'clockid_t'?
>          size_t, size_t, mbstate_t *, locale_t);
>                                       ^~~~~~~~
>                                       clockid_t

What on earth is the compiler thinking here?

> ----
> The error points to the declaration
> diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h
> +extern size_t _wcsnrtombs_l (struct _reent *, char *, const wchar_t **,
> +			     size_t, size_t, mbstate_t *, locale_t);
> +
> [...]
> Looking at the surrounding code in that file, I think that locale_t should
> have been __locale_t.

Almost.  It should have been `struct __locale_t *':

diff --git a/newlib/libc/locale/setlocale.h b/newlib/libc/locale/setlocale.h
index de2bd67..03b1dd7 100644
--- a/newlib/libc/locale/setlocale.h
+++ b/newlib/libc/locale/setlocale.h
@@ -203,7 +203,7 @@ extern const char *__get_locale_env(struct _reent *, int);
 extern struct lconv *__localeconv_l (struct __locale_t *locale);
 extern size_t _wcsnrtombs_l (struct _reent *, char *, const wchar_t **,
-			     size_t, size_t, mbstate_t *, locale_t);
+			     size_t, size_t, mbstate_t *, struct __locale_t *);
 /* In POSIX terms the global locale is the process-wide locale.  Use this
    function to always refer to the global locale. */

> Let me know if there's anything else I should check,

Can you test that the above patch works for you?  I'll check it in then.


Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: signature.asc
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]