Re: [PATCH 3/3] Remove locale access for _REENT_SMALL

"Keith Packard" <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
"Anmin via newlib" <[email protected]> writes:

> Is there any way, such as using "configure" options or defines while
> building newlib, or defining some macros when building project, to
> make my small and simple project (with "C" locale) not to link with
> those "locale" objects?

I've got a long series of patches for newlib on arm-none-eabi that you
might be interested, and this is one of them.

diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h
index f74b3499b..0e283afd6 100644
--- a/newlib/libc/include/ctype.h
+++ b/newlib/libc/include/ctype.h
@@ -66,7 +66,12 @@ extern int toascii_l (int __c, locale_t __l);
 #define _X     0100
 #define        _B      0200
 
+#ifdef NEWLIB_DISABLE_LOCALE
+#define __locale_ctype_ptr()   _ctype_
+#else
 const char *__locale_ctype_ptr (void);
+#endif
+
 # define __CTYPE_PTR   (__locale_ctype_ptr ())
 
 #ifndef __cplusplus

This doesn't actually set the NEWLIB_DISABLE_LOCALE define anywhere;
that's done in my 'meson' newlib configuration. You would have to hack
up something with CFLAGS to use this under autotools.

I'm still cleaning this series up before submitting the
upstream-relevant patches here, but if you want to take a look and see
what you think, the sources are available here:

        https://salsa.debian.org/electronics-team/toolchains/newlib-nano

I've got a submission in the debian new queue for this, so it should
eventually be something you can just install.

-- 
-keith
signature.asc (application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAluIuP8ACgkQ2yIaaQAA
ABGUFRAAjxXa8nT1a2pRp3BozP2X1JjH7AXqZCEpILRzmKCwXnTpLIB5+uRb6vCw
lnUCIv6chkxIEKVW7bANPwCj+sEuU8ZoGsi7YCRiwzIleHtd9auD++Ulrh5eG8LW
9bZ5d21Disq3mDsp9OEEk78epuDcimqQGwx1KglYkEWL4RoCnj58R5Sv0XmS9JUH
oAMyY6lNsqAYs0yJF8BSSvm9+lRWRVDNH7jo2X7AGOdUSJpbXvCpnuJcByf65+4U
K+/Z0fCQSK55AVJtl2jYeJFKR1Yn98anCsdhgp8jehwvctx+CXS8PEzf/rrEvE/G
gllAWu/5RAPHNdPWGUqq5Nz12/J7zc/fuKFl2kw4IIUovvOEbTSAeF2eguVAav8Q
hkJ1mSE6ePsrWkOM2EWEDhwCnEcQdbrDmBOu7EGRxm8AGgEET34OUNnichzHrmhq
EShKW8fC4x9wYggK21QOlglwfF/YEC2sZlumIOcIlHwuOnnoqgjvgkI1KUzCoXDJ
wSMNW9FSI8QKH4bqH6s4avu2Ko0fVGX+yrDWYJm72aHgn8QqRuf5ptIEVt/SuSRt
E0NwljKGJCWL0xz/Z5T8tspx/l4p/LCKIjC857ownGA5J21nHuYYkkWc3tVNCLOu
w+Hpor1uhSNniDV9jd2MBvvp5NCr63xxeZ6WrztEsMc3/TTYVqI=
=z8oT
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.