Commit Graph

76 Commits

Author SHA1 Message Date
Sebastian Huber 4de8754bac Change time_t to 64-bit by default
In order to avoid the year 2038 problem, define time_t to a signed
integer with at least 64-bits.  The type for time_t can be forced to
long with the --enable-newlib-long-time_t configure option or with the
_USE_LONG_TIME_T system configuration define.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-09-07 15:39:34 +02:00
Kito Cheng 363dbb9e44 Add RISC-V port for newlib
Contributor list:
    - Andrew Waterman  <andrew@sifive.com>
    - Palmer Dabbelt  <palmer@dabbelt.com>
    - Kito Cheng  <kito.cheng@gmail.com>
    - Scott Beamer  <sbeamer@eecs.berkeley.edu>
2017-08-16 18:00:58 -04:00
Jozef Lawrynowicz 25138cc2a6 MSP430: Define __BUFSIZ__ as 256 to prevent default of 1024 being used 2017-07-20 16:18:54 +02:00
Sebastian Huber a254c82486 Add --enable-newlib-global-stdio-streams
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-30 07:45:16 +02:00
Sebastian Huber d2e256a36a Enable _REENT_GLOBAL_STDIO_STREAMS for RTEMS
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-30 07:45:16 +02:00
Sebastian Huber 477463a201 Eliminate use of Newlib-specific <machine/types.h>
This change solves a glibc/BSD compatibility problem.

glibc and BSD use double underscore types for internal types.  The Linux
port of Newlib uses some glibc provided internal type definitions which
are not protected by guard defines, e.g. __off_t.  To avoid a conflict
Newlib uses single underscore types for some internal types, e.g.
_off_t.  However, for BSD compatibility we have to define the internal
types with double underscore names in <sys/_types.h>.

The header file <machine/types.h> is Newlib-specific.  It was used
instead of <sys/_types.h> to provide the internal type definitions
_CLOCK_T, _TIME_T_, _CLOCKID_T_, _TIMER_T_, and __suseconds_t.  Move
these definitions to <sys/_types.h> (there exist two instances of this
file, one for Linux and one for all other targets).  This makes the
_HAVE_SYSTYPES configuration define obsolete (could possibly break the
__RDOS__ target).  Use the standard <sys/_types.h> include throughout.

Move __loff_t defintion to default (non-Linux) <sys/_types.h>.  Define
it via _off64_t to avoid a dependency on the compiler.

Provide the __off_t definition via default (non-Linux) <sys/_types.h>
based on _off_t for all systems except Cygwin.  For Cygwin use _off64_t.
Define off_t via __off_t.

Provide the __pid_t definition via default (non-Linux) <sys/_types.h>.
This prevents a potential __pid_t and pid_t incompatibility.  Add BSD
guard defines for pid_t.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2016-04-13 13:30:27 +02:00
Yaakov Selkowitz 6ba26630e0 Feature test macros overhaul: sys/features.h
This is the complete rework of the feature tests macros for better
compatibility with GNU libc, primarily based on the Linux man pages
documentation:

http://man7.org/linux/man-pages/man7/feature_test_macros.7.html

The previous implementation was flawed in its approach that macros were
often used to hide symbols if defined (e.g. !defined __STRICT_ANSI__ or
!defined _POSIX_SOURCE), whereas the approach of glibc is that these macros
make symbols available when defined (e.g. defined _BSD_SOURCE, or as used
internally, #if __BSD_VISIBLE).  As much open-source software is written
with glibc in mind, this necessitated patching numerous packages just to
compile.

In particular, __STRICT_ANSI__ (which is defined by gcc -ansi or -std=c*)
was given too much importance.  This implementation limits the influence
of __STRICT_ANSI__ to controlling the default when no other feature test
macros are defined, and to the inclusion of <alloca.h> in <stdlib.h> as
documented.  These are the only places where __STRICT_ANSI__ should be
tested.

The following macros are now accepted: _ATFILE_SOURCE, _BSD_SOURCE,
_DEFAULT_SOURCE, _ISOC99_SOURCE, _ISOC11_SOURCE, _LARGEFILE_SOURCE,
_SVID_SOURCE, _XOPEN_SOURCE_EXTENDED.

The existing __*_VISIBLE internal macros have been kept mostly
compatible with the original BSD implementation, with some changes to
the criteria which controls them.  Several more macros in this style
have been added where needed for concision or accuracy.

Enabling C++11 or newer in the compiler also enables C99 and C11
functions.  Doing so should help move away from the need to define
_GNU_SOURCE in g++ for _GLIBCXX_USE_C99 support as on Linux:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51749

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-17 21:06:40 -05:00
Corinna Vinschen 6109eadff5 Improve check for int32_t being long or int
* libc/include/sys/config.h: Move evaluation of _UINTPTR_EQ_ULONG and
        _UINTPTR_EQ_ULONGLONG from here...
        * libc/include/sys/_intsup.h: ...to here.  Rename to _INTPTR_EQ_LONG
        and _INTPTR_EQ_LONGLONG to refer to signed base type.  Add test for
        base type of int32_t and set _INT32_EQ_LONG accordingly.
        * libc/include/stdint.h: Change checks for __have_long32 to checks
        for _INT32_EQ_LONG.
        * libc/include/inttypes.h: Ditto.  Accommodate aforementioned name
        change.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-04-29 13:07:17 +02:00
Joel Sherrill 380c00f175 Change from configure time to compile time probe for intptr_t definition.
2015-03-23  Joel Sherrill <joel.sherrill@oarcorp.com

	* configure.in: Delete logic to determine _UINTPTR_EQ_ULONGLONG
	and _UINTPTR_EQ_ULONG at configuration time.
	*libc/include/sys/config.h: Add logic to determine
	_UINTPTR_EQ_ULONGLONG and _UINTPTR_EQ_ULONG at compilation time.
	* libc/include/inttypes.h: Add include of <sys/config.h>.
	* configure: Regenerated.
2015-04-23 21:57:06 +02:00
Corinna Vinschen 29193dd04c * configure.host: Add extra system for OpenRISC baremetal
* libc/include/sys/config.h: Dynamic reentrancy for or1k sys targets
	* libc/sys/or1k/: New system for or1k baremetal
	* libc/sys/or1k/Makefile.am: New file
	* libc/sys/or1k/Makefile.in: New file
	* libc/sys/or1k/aclocal.m4: New file
	* libc/sys/or1k/configure.in: New file
	* libc/sys/or1k/configure: New file
	* libc/sys/or1k/getreent.S: New file
	* libc/sys/or1k/mlock.S: New file
	* libc/sys/or1k/or1k-asm.S: New file
2015-01-14 09:25:16 +00:00
Jeff Johnston 6811cfb0b9 2014-08-18 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/config.h[__m68k__]: Set _READ_WRITE_RETURN_TYPE
        to _ssize_t to match underlying code in libgloss.
2014-08-18 16:43:42 +00:00
Corinna Vinschen 0c3d8e5ab5 * libc/include/stdio.h (funopen): Change prototype of
__readfn and __writefn parameter to match new definition of
	FILE's _read and _write methods.
	(_funopen_r): Ditto.
	(funopen): Ditto.
	(_funopen_r): Ditto.
	* libc/include/sys/config.h (_READ_WRITE_BUFSIZE_TYPE) Define
	as type int if not already defined.  Add comment to explain.
	* libc/include/sys/reent.h: Include stddef.h.
	(struct __sFILE): Change type of last parameter in declaration
	of _read and _write methods to _READ_WRITE_BUFSIZE_TYPE.
	(struct __sFILE64): Ditto.
	* libc/stdio/local.h (__sread): Declare with last parameter set
	to _READ_WRITE_BUFSIZE_TYPE.
	(__seofread): Ditto.
	(__swrite): Ditto.
	(__swrite64): Ditto.
	* libc/stdio/fvwrite.c (__sfvwrite_r): Change type of local
	variables w and s to _READ_WRITE_RETURN_TYPE.
	* libc/stdio/fflush.c (__sflush_r): Change type of local variables
	n and t to _READ_WRITE_BUFSIZE_TYPE and _READ_WRITE_RETURN_TYPE.
	Add local variables flags to keep _flags value.
	* libc/stdio/fmemopen.c (fmemreader): Align to above change.
	(fmemwriter): Ditto.
	* libc/stdio/fopencookie.c (fcreader): Ditto.
	(fcwriter): Ditto.
	* libc/stdio/funopen.c (funread): Ditto.
	(funwrite): Ditto.
	(funreader): Ditto.
	(funwriter): Ditto.
	* libc/stdio/open_memstream.c (memwriter): Ditto.
	* libc/stdio/stdio.c (__sread): Ditto.
	(__seofread): Ditto.
	(__swrite): Ditto.
	* libc/stdio64/stdio64.c (__swrite64): Ditto.
2013-10-23 10:04:43 +00:00
Corinna Vinschen 9b51cd8c6b * libc/include/sys/config.h (__DYNAMIC_REENT__): Define for RTEMS. 2013-07-09 13:14:31 +00:00
DJ Delorie 2f2a304234 [newlib]
* configure.host (msp430): Add.
* libc/include/machine/ieeefp.h: Add MSP430 support.
* libc/include/machine/setjmp.h: Likewise.
* libc/include/sys/config.h: Likewise.
* libc/machine/configure.in (msp430): Add.
* libc/machine/configure: Regenerate.
* libc/machine/msp430: New directory.

[libgloss]
* configure.in (msp430*-*-elf): Add.
* configure: Regenerate.
* msp430: New directory.
2013-05-13 21:39:51 +00:00
Jeff Johnston 1b7ad41e50 2013-05-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/sys/config.h (_REENT_GLOBAL_ATEXIT): Define for
        RTEMS.
        * libc/include/sys/reent.h (_reent): Use _REENT_GLOBAL_ATEXIT.
        (_global_atexit): Declare if _REENT_GLOBAL_ATEXIT is defined.
        * libc/reent/reent.c (_reclaim_reent): Remove atexit cleanup if
        _REENT_GLOBAL_ATEXIT is defined.
        (_wrapup_reent): Remove atexit handling if _REENT_GLOBAL_ATEXIT
        is defined.
        * libc/stdlib/__atexit.c (_global_atexit0): Define if
        _REENT_GLOBAL_ATEXIT is defined.
        * libc/stdlib/__call_atexit.c (_global_atexit): Define if
        _REENT_GLOBAL_ATEXIT is defined.
2013-05-08 23:13:51 +00:00
Jeff Johnston c3fe5bf771 2012-09-26 Ian Bolton <ian.bolton@arm.com>
Jim MacArthur  <jim.macarthur@arm.com>
        Marcus Shawcroft  <marcus.shawcroft@arm.com>
        Nigel Stephens  <nigel.stephens@arm.com>
        Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
        Richard Earnshaw  <rearnsha@arm.com>
        Sofiane Naci  <sofiane.naci@arm.com>
        Tejas Belagod  <tejas.belagod@arm.com>
        Yufeng Zhang  <yufeng.zhang@arm.com>

        * configure.host: Add AArch64.
        * libc/include/machine/ieeefp.h: Add AArch64.
        * libc/include/machine/setjmp.h: Add AArch64.
        * libc/include/machine/time.h: Add AArch64.
        * libc/include/sys/config.h: Add AArch64.
        * libc/machine/aarch64/Makefile.am: New file.
        * libc/machine/aarch64/Makefile.in: Generated.
        * libc/machine/aarch64/aclocal.m4: Generated.
        * libc/machine/aarch64/configure: Generated.
        * libc/machine/aarch64/configure.in: New file.
        * libc/machine/aarch64/setjmp.S: New file.
        * libc/machine/configure.in: Add AArch64.
        * libc/machine/configure: Re-generated.
        * libm/machine/aarch64/Makefile.am: New file.
        * libm/machine/aarch64/Makefile.in: Generated.
        * libm/machine/aarch64/aclocal.m4: Generated.
        * libm/machine/aarch64/configure: Generated.
        * libm/machine/aarch64/configure.in: New file.
        * libm/machine/aarch64/s_ceil.c: New file.
        * libm/machine/aarch64/s_floor.c: New file.
        * libm/machine/aarch64/s_fma.c: New file.
        * libm/machine/aarch64/s_fmax.c: New file.
        * libm/machine/aarch64/s_fmin.c: New file.
        * libm/machine/aarch64/s_llrint.c: New file.
        * libm/machine/aarch64/s_llround.c: New file.
        * libm/machine/aarch64/s_lrint.c: New file.
        * libm/machine/aarch64/s_lround.c: New file.
        * libm/machine/aarch64/s_nearbyint.c: New file.
        * libm/machine/aarch64/s_rint.c: New file.
        * libm/machine/aarch64/s_round.c: New file.
        * libm/machine/aarch64/s_trunc.c: New file.
        * libm/machine/aarch64/sf_ceil.c: New file.
        * libm/machine/aarch64/sf_floor.c: New file.
        * libm/machine/aarch64/sf_fma.c: New file.
        * libm/machine/aarch64/sf_fmax.c: New file.
        * libm/machine/aarch64/sf_fmin.c: New file.
        * libm/machine/aarch64/sf_llrint.c: New file.
        * libm/machine/aarch64/sf_llround.c: New file.
        * libm/machine/aarch64/sf_lrint.c: New file.
        * libm/machine/aarch64/sf_lround.c: New file.
        * libm/machine/aarch64/sf_nearbyint.c: New file.
        * libm/machine/aarch64/sf_rint.c: New file.
        * libm/machine/aarch64/sf_round.c: New file.
        * libm/machine/aarch64/sf_trunc.c: New file.
        * libm/machine/configure.in: Add AArch64.
        * libm/machine/configure: Re-generated.
2012-09-26 20:06:50 +00:00
Jeff Johnston 874a87f8cd 2010-12-02 Jayant Sonar jayant.sonar@kpitcummins.com
Kaushik Phatak  kaushik.phatak@kpitcummins.com

        * configure.host: Add CR16 support.
        * libc/include/machine/ieeefp.h: Ditto.
        * libc/include/machine/setjmp.h: Ditto.
        * libc/include/sys/config.h: Ditto.
        * libc/machine/configure.in: Ditto
        * libc/machine/configure: Regenerated
        * libc/machine/cr16/aclocal.m4: New.
        * libc/machine/cr16/configure.in: New
        * libc/machine/cr16/configure: New
        * libc/machine/cr16/getenv.c: New
        * libc/machine/cr16/Makefile.am: New
        * libc/machine/cr16/Makefile.in: New
        * libc/machine/cr16/setjmp.S: New
        * libc/machine/cr16/sys/asm.h: New
        * libc/machine/cr16/sys/libh.h: New
        * libc/machine/cr16/sys/syscall.h: New
2010-12-02 19:30:47 +00:00
Jeff Johnston 6fc25b2d1e 2010-03-02 Craig Howland <howland@LGSInnovations.com>
* libc/include/sys/features.h:  Add POSIX.1-permitted definition of
        _POSIX_C_SOURCE if not already defined and _XOPEN_SOURCE has an
        appropriate value.  Specifically, check for POSIX.1-2008 & 2001 values.
        * libc/include/sys/config.h:  Add #include <sys/features.h> so that all
        includes get the new check added to it.
2010-03-02 19:28:39 +00:00
Corinna Vinschen be7f7a7503 * libc/time/strftime.c: Add support for era and alt_digits data from
LC_TIME locale category.  Conditionalize using _WANT_C99_TIME_FORMATS
	flag.
	(STRTOUL): Define differently for building strftime or wcsftime.
	(STRCPY): Ditto.
	(STRCHR): Ditto.
	(STRLEN): Ditto.
	(CHECK_LENGTH): Define to simplify code.
	(era_info_t): New type to store era info.
	(get_era_info): New function to fetch era info matching incoming
	struct tm.
	(free_era_info): New function to free era info.
	(alt_digits_t): New type to store alternative digits.
	(get_alt_digits): New function to convert alt_digits string into
	alt_digits_t structure.
	(free_alt_digits): New function to free alt_digits info.
	(conv_to_alt_digits): New function to convert unsigned value into
	alternative digits.
	(strftime): Conditionalize on _WANT_C99_TIME_FORMATS.  If
	_WANT_C99_TIME_FORMATS is defined, define as just a wrapper function
	providing era_info and alt_digits pointers and call ...
	(__strftime): Rename from strftime and make static if
	_WANT_C99_TIME_FORMATS is defined.  Add parameters for era_info and
	alt_digits pointers.  Handle conversion modifiers according to
	POSIX-1.2008.  Redefine %F and %Y according to POSIX.  Add default case
	to allow to bail out on invalid conversion specifiers.
	* libc/include/sys/config.h: Move Cygwin build flags to Cygwin's
	config.h.

	* libc/include/stdio.h: Remove __CYGWIN_USE_BIG_TYPES__ condition.
2010-02-26 09:41:44 +00:00
Corinna Vinschen 830686ec0b * libc/locale/locale.c: Throughout, extensively comment on the
reason for using __CYGWIN__.
	(lconv): Remove _CONST entirely.
	(loadlocale): Guard calls to function loading locale-specific
	category data with __HAVE_LOCALE_INFO__ rather than __CYGWIN__.
	* libc/sys/config.h (__HAVE_LOCALE_INFO__): Define for Cygwin.
2010-02-25 16:10:42 +00:00
Jeff Johnston 655e435357 2009-12-10 Conny Marco Menebrocker <c-m-m@gmx.de>
* configure.host: Add xc16x support.
        * libc/include/machine/ieeefp.h: Ditto.
        * libc/include/sys/config.h: Ditto.
        * libc/machine/configure.in: Ditto.
        * libc/machine/Makefile.in: Regenerated.
        * libc/machine/aclocal.m4: Ditto.
        * libc/machine/configure: Ditto.
        * libc/machine/xc16x/Makefile.am: New file.
        * libc/machine/xc16x/Makefile.in: Ditto.
        * libc/machine/xc16x/aclocal.m4: Ditto.
        * libc/machine/xc16x/configure: Ditto.
        * libc/machine/xc16x/configure.in: Ditto.
        * libc/machine/xc16x/putchar.c: Ditto.
        * libc/machine/xc16x/puts.c: Ditto.
        * libc/machine/xc16x/setjmp.S: Ditto.
2009-12-10 17:12:11 +00:00
Jeff Johnston 1e1b6f8003 2009-10-16 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/config.h[__CYGWIN__]: Set __USE_XOPEN2K flag
        if not __STRICT_ANSI__ or stdc version C99 or greater.
        * libc/include/stdio.h[__STRICT_ANSI__]: Add __USE_XOPEN2K check
        for fseeko and ftello prototypes.
2009-10-20 16:44:11 +00:00
Jeff Johnston 6c249577fb 2009-09-28 Michael Eager <eager@eagercon.com>
* configure.host: Add microblaze.
        * libc/include/machine/ieeefp.h [MICROBLAZE]: Define __IEEE_BIG_ENDIAN.
        * libc/include/machine/setjmp.h [MICROBLAZE]: Define _JBLEN, _JBTYPE.
        * libc/include/sys/config.h [MICROBLAZE]: Define _REENT_SMALL,
        _UNIX98_THREAD_MUTEX_ATTRIBUTES.
        * libc/include/sys/types.h: Treat XMK like rtems, define
        PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_RECURSIVE,
        PTHREAD_MUTEX_DEFAULT, PTHREAD_STACK_MIN, define stuct pthread_attr_s.
        * libc/machine/configure.in: Add microblaze.
        * libc/machine/configure: Add microblaze (not regenerated).
        * libc/machine/microblaze/configure.in: NEW.
        * libc/machine/microblaze/configure: Generate.
        * libc/machine/microblaze/Makefile.am: NEW.
        * libc/machine/microblaze/Makefile.in: Generate.
        * libc/machine/microblaze/{abort.c, strcmp.c, strcpy.c, strlen.c,
        mallocr.c, longjmp.S, setjmp.S}: NEW.
        * libc/stdlib/mallocr.c [MICROBLAZE]: Don't declare sbrk prototype,
        mALLOc(): return malloc value.
2009-09-28 16:42:21 +00:00
Jeff Johnston 9b09fb22e2 2009-06-02 Richard Earnshaw <rearnsha@arm.com>
* libc/include/sys/config.h: Remove specification of _REENT_SMALL for
        thumb2.
2009-06-02 20:39:17 +00:00
Corinna Vinschen 4bc42c05aa * libc/ctype/Makefile.am: Remove _tolower.c and _toupper.c
source files.  Add a dependency rule for ctype_o to note
	changes in ctype_iso.h and ctype_cp.h.
	* libc/ctype/Makefile.in: Regenerate.
	* libc/ctype/_tolower.c: Remove file.
	* libc/ctype/_toupper.c: Remove file.
	* libc/ctype/ctype_.c: Make sure ALLOW_NEGATIVE_CTYPE_INDEX
	is always defined on Cygwin.
	(_ctype_b): Don't make `static const' on Cygwin.
	(ctype_iso.h): Include if _MB_EXTENDED_CHARSETS_ISO is set.
	(ctype_cp.h): Include if _MB_EXTENDED_CHARSETS_WINDOWS is set.
	(__ctype_ptr): Drop definition.
	(__ctype_ptr__): De-constify.  Mark as __EXPORT symbol.
	(_ctype_): Add Cygwin-specifc asm define.
	(__set_ctype): New function to set __ctype_ptr__ according to
	current charset.
	* libc/ctype/ctype_cp.h: New file containing Windows codepage
	specific character class tables.
	* libc/ctype/ctype_iso.h: New file containing ISO-8859-x
	specific character class tables.
	* libc/ctype/tolower.c (tolower): Reimplement to support any singlebyte
	charset if one of the extended charsets is enabled.
	* libc/ctype/toupper.c (toupper): Ditto.
	* libc/include/ctype.h (_tolower): Define as macro per POSIX.
	(_toupper): Ditto.
	(__ctype_ptr__): De-constify.
	(toupper): Disable macro on systems supporting extended charsets.
	(tolower): Ditto.
	* libc/include/sys/config.h (__EXPORT): Define empty if not defined.
	* libc/locale/locale.c (__mb_cur_max): Mark as __EXPORT symbol.
	(__set_ctype): Declare unconditionally.
	(loadlocale): Remove __CYGWIN__ guard around __set_ctype call.
2009-03-31 09:31:38 +00:00
Corinna Vinschen 28186e81d9 * libc/ctype/iswalpha.c: Handle all wchar_t as unicode on
_MB_CAPABLE systems.
	* libc/ctype/iswblank.c: Ditto.
	* libc/ctype/iswcntrl.c: Ditto.
	* libc/ctype/iswprint.c: Ditto.
	* libc/ctype/iswpunct.c: Ditto.
	* libc/ctype/iswspace.c: Ditto.
	* libc/ctype/jp2uc.c (__jp2uc): On Cygwin, just return c.
	Explain why.
	* libc/ctype/towlower.c: Ditto.
	* libc/ctype/towupper.c: Ditto.
	* libc/include/sys/config.h: Define _MB_EXTENDED_CHARSETS_ISO
	and _MB_EXTENDED_CHARSETS_WINDOWS if _MB_EXTENDED_CHARSETS_ALL is
	defined.  Define _MB_EXTENDED_CHARSETS_ALL on Cygwin only for now.
	* libc/include/sys/reent.h (struct _reent): Mark _current_category
	and _current_locale as unused.
	* libc/locale/locale.c: Add new charset support to documentation.
	Include ../stdio/local.h from here.
	(lc_ctype_charset): Set to "ASCII" by default.
	(lc_message_charset): Ditto.
	(_setlocale_r): Don't set _current_category and _current_locale.
	(loadlocale): Add Cygwin codepage support.  On _MB_CAPABLE
	systems, set __mbtowc and __wctomb function pointers to function
	corresponding with current charset.  Don't allow non-existant
	ISO-8859-12 charset.  Add support for Windows singlebyte codepages.
	On Cygwin, add support for GBK, CP949, and BIG5.  On Cygwin,
	call __set_ctype() in case the catorgy is LC_CTYPE.  Don't set
	_current_category and _current_locale.
	* libc/stdlib/Makefile.am (GENERAL_SOURCES): Add sb_charsets.c.
	* libc/stdlib/Makefile.in: Regenerate.
	* libc/stdlib/local.h: Add prototype for __locale_charset.
	Add prototypes for __mbtowc and __wctomb pointers.
	Add prototypes for charset-specific _wctomb_r and _mbtowc_r
	functions.
	Declare tables and functions from sb_charsets.c.
	* libc/stdlib/mbtowc_r.c (__mbtowc): Define.  Set to __ascii_mbtowc
	by default.
	(_mbtowc_r): Just call __mbtowc from here.
	(__ascii_mbtowc): New function.
	(__iso_mbtowc): New function.
	(__cp_mbtowc): New function.
	(__utf8_mbtowc): New function.
	(__sjis_mbtowc): New function.  Disable on Cygwin.
	(__eucjp_mbtowc): New function.  Disable on Cygwin.
	(__jis_mbtowc): New function.  Disable on Cygwin.
	* libc/stdlib/sb_charsets.c: New file, adding singlebyte to UTF
	conversion tables for all ISO and CP charsets.
	(__iso_8859_index): New function.
	(__cp_index): New function.
	* libc/stdlib/wctomb_r.c (__wctomb): Define.  Set to __ascii_wctomb
	by default.
	(_wctomb_r): Just call __wctomb from here.
	(__ascii_wctomb): New function.
	(__utf8_wctomb): New function.
	(__sjis_wctomb): New function.  Disable on Cygwin.
	(__eucjp_wctomb): New function.  Disable on Cygwin.
	(__jis_wctomb): New function.  Disable on Cygwin.
	(__iso_wctomb): New function.
	(__cp_wctomb): New function.
2009-03-24 10:13:27 +00:00
Jeff Johnston e8846923cf 2009-03-20 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/errno.h: Protect various non-standard errnos
        with either __LINUX_ERRNO_EXTENSIONS__ or __CYGWIN__.
        * libc/include/sys/config.h[__CYGWIN__]: Define
        __LINUX_ERRNO_EXTENSIONS__.
2009-03-20 20:44:14 +00:00
Jeff Johnston 0e9810262d 2008-11-19 Joel Sherrill <joel.sherrill@oarcorp.com>
* libc/include/sys/config.h[__mips__]: Don't bother
        setting __ATTRIBUTE_IMPURE_PTR__ here.
        [__rtems__][__mips__]: No need to undef the __ATTRIBUTE_IMPURE_PTR__
        macro anymore.
2008-11-19 21:05:31 +00:00
Jeff Johnston 34ff0a4e6f 2008-11-19 Ralf Corsepius <ralf.corsepius@rtems.org>
* libc/include/sys/config.h: Don't put
        __ATTRIBUTE_IMPURE_PTR__ into .sdata section for mips-rtems.
2008-11-19 19:48:31 +00:00
Jeff Johnston 826b5591dd 2007-03-15 Jeff Johnston <jjohnstn@redhat.com>
* configure.in: Add new --enable-newlib-reent-small option.
        * configure: Regenerated.
        * acconfig.h: Add _WANT_REENT_SMALL.
        * newlib.hin: Regenerated minus PACKAGE macros to add
        _WANT_REENT_SMALL macro.
        * libc/include/sys/config.h[_WANT_REENT_SMALL]: Set _REENT_SMALL
        if not already set.
        * libc/stdio/fflush.c[_REENT_SMALL]: Return immediately if
        there is no buffer.
        * libc/stdio/local.h[_REENT_SMALL]: Fix CHECK_INIT macro to
        use reentrant pointer passed in when resetting the file
        pointer to one of the std streams.
2007-03-15 21:32:13 +00:00
Jeff Johnston 7d592bb178 2007-02-01 Joel Schopp <jschopp@austin.ibm.com>
Kazunori Asayama <asayama@sm.sony.co.jp>

        * configure.host: Enable SPU specific stdio directory.
        * libc/machine/spu/Makefile.am: Add objects.
        * libc/machine/spu/Makefile.in: Regenerated.
        * libc/machine/spu/c99ppe.h: Add macros and function
        declarations to initialize SPU specific stdio stuffs.
        * libc/machine/spu/stdio.c: Add functions to manage Cell SPU
        specific FILE structures.
        * libc/machine/spu/perror.c: Add initialization routine of
        stdio stuffs.
        * libc/machine/spu/printf.c: Ditto.
        * libc/machine/spu/putchar.c: Ditto.
        * libc/machine/spu/puts.c: Ditto.
        * libc/machine/spu/vprintf.c: Ditto.
        * libc/machine/spu/clearerr.c: New file. Add a stdio function
        implementation.
        * libc/machine/spu/feof.c: Ditto.
        * libc/machine/spu/ferror.c: Ditto.
        * libc/machine/spu/fileno.c: Ditto.
        * libc/machine/spu/fopen.c: Ditto.
        * libc/machine/spu/fclose.c: Ditto.
        * libc/machine/spu/freopen.c: Ditto.
        * libc/machine/spu/fflush.c: Ditto.
        * libc/machine/spu/fseek.c: Ditto.
        * libc/machine/spu/ftell.c: Ditto.
        * libc/machine/spu/rewind.c: Ditto.
        * libc/machine/spu/fgetpos.c: Ditto.
        * libc/machine/spu/fsetpos.c: Ditto.
        * libc/machine/spu/fread.c: Ditto.
        * libc/machine/spu/fwrite.c: Ditto.
        * libc/machine/spu/getc.c: Ditto.
        * libc/machine/spu/getchar.c: Ditto.
        * libc/machine/spu/gets.c: Ditto.
        * libc/machine/spu/fgetc.c: Ditto.
        * libc/machine/spu/fgets.c: Ditto.
        * libc/machine/spu/ungetc.c: Ditto.
        * libc/machine/spu/putc.c: Ditto.
        * libc/machine/spu/fputc.c: Ditto.
        * libc/machine/spu/fputs.c: Ditto.
        * libc/machine/spu/vfprintf.c: Ditto.
        * libc/machine/spu/vfscanf.c: Ditto.
        * libc/machine/spu/fprintf.c: Ditto.
        * libc/machine/spu/fscanf.c: Ditto.
        * libc/machine/spu/scanf.c: Ditto.
        * libc/machine/spu/vscanf.c: Ditto.
        * libc/machine/spu/setbuf.c: Ditto.
        * libc/machine/spu/setvbuf.c: Ditto.
        * libc/machine/spu/tmpfile.c: Ditto.

2007-02-01  Jeff Johnston  <jjohnstn@redhat.com>

        * libc/include/sys/config.h[__SPU__]: Define __CUSTOM_FILE_IO__.
        * libc/include/stdio.h[!__CUSTOM_FILE_IO__]: Add flag check
        around stdio macros that manipulate fields in the normal file
        structure.
        * libc/include/sys/reent.h[__CUSTOM_FILE_IO__]: Include
        <sys/custom_file.h> to define custom FILE structure.
        * libc/include/sys/custom_file.h: New default header file
        that generates error if not overridden when __CUSTOM_FILE_IO__ set.
        * libc/machine/spu/sys/custom_file.h: New file.
2007-02-01 16:33:05 +00:00
Jeff Johnston 859742654a 2006-08-29 Paul Brook <paul@codesourcery.com>
* libc/include/sys/config.h: Define _REENT_SMALL for Thumb-2.
2006-08-29 21:00:59 +00:00
Jeff Johnston 734e841435 2006-08-16 Joel Schopp <jschopp@austin.ibm.com>
* configure.host: Add spu support.
        * libc/include/stdint.h: Ditto.
        * libc/include/machine/ieeefp.h: Ditto.
        * libc/include/machine/setjmp.h: Ditto.
        * libc/include/sys/config.h: Ditto.
        * libc/include/sys/types.h: Ditto.
        * libc/machine/spu/Makefile.am: New file.
        * libc/machine/spu/Makefile.in: Ditto.
        * libc/machine/spu/aclocal.m4: Ditto.
        * libc/machine/spu/configure: Ditto.
        * libc/machine/spu/configure.in: Ditto.
        * libc/machine/spu/memcpy.c: Ditto.
        * libc/machine/spu/setjmp.S: Ditto.
2006-08-16 21:39:43 +00:00
Jeff Johnston a121349405 2006-08-01 Thiemo Seufer <ths@mips.com>
Nigel Stephens  <nigel@mips.com>

	* libc/include/sys/config.h (__ATTRIBUTE_IMPURE_PTR__): For MIPS
	define this to force _impure_ptr to live in the .sdata section.
2006-08-01 15:54:04 +00:00
Jeff Johnston d968b3c86f 2006-01-31 Leif Ekblad <leif@rdos.net>
* configure.host: RDOS support added
        * libc/include/sys/config.h: Ditto.
        * libc/sys/rdos/Makefile.am, libc/sys/rdos/Makefile.in: New files.
        * libc/sys/rdos/aclocal.m4, libc/sys/rdos/chown.c: Ditto.
        * libc/sys/rdos/close.c, libc/sys/rdos/config.h: Ditto.
        * libc/sys/rdos/configure, libc/sys/rdos/configure.in: Ditto.
        * libc/sys/rdos/crt0.S, libc/sys/rdos/execve.c: Ditto.
        * libc/sys/rdos/fork.c, libc/sys/rdos/fstat.c: Ditto.
        * libc/sys/rdos/getenv.c, libc/sys/rdos/getpid.c: Ditto.
        * libc/sys/rdos/gettod.c, libc/sys/rdos/isatty.c: Ditto.
        * libc/sys/rdos/kill.c, libc/sys/rdos/link.c: Ditto.
        * libc/sys/rdos/lseek.c, libc/sys/rdos/open.c: Ditto.
        * libc/sys/rdos/rdos.S, libc/sys/rdos/rdos.h: Ditto.
        * libc/sys/rdos/rdoshelp.c, libc/sys/rdos/read.c: Ditto.
        * libc/sys/rdos/readlink.c, libc/sys/rdos/sbrk.c: Ditto.
        * libc/sys/rdos/stat.c, libc/sys/rdos/symlink.c: Ditto.
        * libc/sys/rdos/times.c, libc/sys/rdos/unlink.c: Ditto.
        * libc/sys/rdos/user.def, libc/sys/rdos/wait.c: Ditto.
        * libc/sys/rdos/write.c: Ditto.
2006-01-31 19:33:56 +00:00
Jeff Johnston 56448afa06 2005-08-10 DJ Delorie <dj@redhat.com>
* configure.host: Add m32c support.
        * libc/include/machine/ieeefp.h: Likewise.
        * libc/include/machine/setjmp.h: Likewise.
        * libc/include/sys/config.h: Likewise.
        * libc/machine/m32c: New directory, Renesas R8C/M16C/M32C support.
        * libc/machine/m32c/aclocal.m4: New file.
        * libc/machine/m32c/configure: Ditto.
        * libc/machine/m32c/configure.in: Ditto.
        * libc/machine/m32c/Makefile.am: Ditto.
        * libc/machine/m32c/Makefile.in: Ditto.
        * libc/machine/m32c/setjmp.S: Ditto.
2005-08-10 20:35:13 +00:00
Alexandre Oliva 9a6831be86 2003-07-02 Richard Sandiford <rsandifo@redhat.com>
* libc/machine/h8300/Makefile.am (lib_a_SOURCES): Add h8sx_strcpy.S.
* libc/machine/h8300/defines.h (LEN): New macro.
* libc/machine/h8300/memcpy.S: Add h8sx version.
* libc/machine/h8300/memset.S: Likewise.
* libc/machine/h8300/strcmp.S: Likewise.
* libc/machine/h8300/setjmp.S: Use h8sx move instructions.
* libc/machine/h8300/h8sx_strcpy.S: New file.
2003-06-30  Richard Sandiford  <rsandifo@redhat.com>
* libc/include/machine/ieeefp.h: Extend __H8300S__ handling to
__H8300SX__.
* libc/include/machine/setjmp.h: Likewise.
* libc/include/sys/config.h: Likewise.
* libc/machine/h8300/defines.h: Likewise.
* libc/machine/h8300/setjmp.S: Likewise.
* libc/machine/h8300/strcmp.S: Likewise.
* libc/sys/h8300hms/close.S: Likewise.
* libc/sys/h8300hms/fstat.S: Likewise.
* libc/sys/h8300hms/lseek.S: Likewise.
* libc/sys/h8300hms/read.S: Likewise.
* libc/sys/h8300hms/write.S: Likewise.
* libc/sys/h8300hms/crt0.S: Likewise.
* libc/machine/h8300/setarch.h: Use .h8300sx or .h8300sxn if
__H8300SX__ is defined.
* libc/sys/h8300hms/setarch.h: Likewise.
2004-06-22 21:54:52 +00:00
Corinna Vinschen 8a4b4764b8 * libc/ctype/ctype_.c: Remove checks for deprecated __CYGWIN32__.
* libc/include/stdio.h: Ditto.
	* libc/include/sys/config.h: Ditto.
	* libc/stdio/mktemp.c: Ditto.
2003-05-13 09:46:48 +00:00
Corinna Vinschen a3cc585138 * libc/include/sys/config.h: Remove all Cygwin specific configuration.
Include cygwin/config.h instead.
2003-05-09 21:38:31 +00:00
Corinna Vinschen 2c440f9c1a * libc/include/sys/config.h: Define __CYGWIN_USE_BIG_TYPES__ for
Cygwin.
2003-03-09 21:52:23 +00:00
Corinna Vinschen 5582abd2c7 * configure.host: Define stdio64_dir for Cygwin.
* libc/include/stdio.h: Change definition of fpos_t to fulfill
	Cygwin 64bit file access requirements.
	Drop definition of f*64() functions when compiled for Cygwin.
	* libc/include/sys/config.h: Define __LARGE64_FILES for Cygwin.
	* libc/reent/lseek64r.c: Use _off64_t instead of off64_t.
	* libc/stdio64/local64.h: Use _fpos64_t instead of fpos64_t.
2003-03-07 20:41:49 +00:00
Jeff Johnston 7da92d1527 2002-12-16 Kazu Hirata <kazu@cs.umass.edu>
* libc/include/sys/config.h: Change setting of INT_MAX
        and UINT_MAX, to use __INT_MAX__ for __H8300__, __H8300H__,
        __H8300S__.  Also consolidate flag settings for these
        platforms.
2002-12-16 22:35:32 +00:00
Richard Sandiford f770cf44c3 * libc/include/sys/config.h (SIZE_T_SMALLER_THAN_LONG): Undefine.
* libc/stdlib/mallocr.c (long_sub_size_t): Define in a way that
	doesn't require the SIZE_T_SMALLER_THAN_LONG macro.
2002-10-11 10:28:30 +00:00
Jeff Johnston da25e61f59 2002-09-20 Jeff Johnston <jjohnstn@redhat.com>
* configure.host: Minor comment and formatting changes.
        * libc/Makefile.am: Add libc_la_DEPENDENCIES.
        * libc/Makefile.in: Regenerated.
        * libc/include/sys/config.h: Minor format change.
2002-09-20 17:11:29 +00:00
Jeff Johnston 218b7a5638 2002-09-06 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/config.h (MB_LEN_MAX): Removed as this
        is defined by <limits.h>.
2002-09-06 15:45:58 +00:00
Jeff Johnston ca3a1a6b67 2002-09-04 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
* libc/include/sys/config.h: Define accordingly __WCHAR_MAX__.
        * libc/include/wchar.h: Define WCHAR_MIN as 0 and WCHAR_MAX as
        __WCHAR_MAX__ or 0x7fffffffu.
        * libc/string/wcscmp.c: Delete wrong and unnecessary type cast.
        * libc/string/wcsncmp.c: Ditto.
2002-09-04 18:17:55 +00:00
Jeff Johnston efa077ce22 2002-09-04 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
* libc/include/sys/config.h: Define accordingly __WCHAR_MAX__.
        * libc/include/wchar.h: Define WCHAR_MIN as 0 and WCHAR_MAX as
        __WCHAR_MAX__ or 0x7fffffffu.
        * libc/string/wcscmp.c: Delete wrong and unnecessary type cast.
        * libc/string/wcsncmp.c: Ditto.
2002-09-04 18:16:55 +00:00
Thomas Fitzsimmons 8d9112f2f3 * libc/include/langinfo.h: New file.
* libc/include/wchar.h: Likewise.
	* libc/include/sys/syslimits.h: Likewise.
	* libc/locale/fix_grouping.c: Likewise.
	* libc/locale/ldpart.c: Likewise.
	* libc/locale/ldpart.h: Likewise.
	* libc/locale/lmessages.c: Likewise.
	* libc/locale/lmessages.h: Likewise.
	* libc/locale/lmonetary.c: Likewise.
	* libc/locale/lmonetary.h: Likewise.
	* libc/locale/lnumeric.c: Likewise.
	* libc/locale/lnumeric.h: Likewise.
	* libc/locale/nl_langinfo.3: Likewise.
	* libc/locale/nl_langinfo.c: Likewise.
	* libc/locale/timelocal.c: Likewise.
	* libc/locale/timelocal.h: Likewise.
	* libc/stdlib/btowc.c: Likewise.
	* libc/stdlib/mbrlen.c: Likewise.
	* libc/stdlib/mbrtowc.c: Likewise.
	* libc/stdlib/mbsinit.c: Likewise.
	* libc/stdlib/mbsrtowcs.c: Likewise.
	* libc/stdlib/wcrtomb.c: Likewise.
	* libc/stdlib/wcsrtombs.c: Likewise.
	* libc/stdlib/wctob.c: Likewise.
	* libc/sys/linux/prof-freq.c: Likewise.
	* libc/sys/linux/profile.c: Likewise.
	* libc/sys/linux/machine/i386/dl-procinfo.c: Likewise.
	* libc/sys/linux/machine/i386/dl-procinfo.h: Likewise.
	* libc/include/stdlib.h: Change re-entrant functions to take
	mbstate_t pointers.
	* libc/include/sys/_types.h: Define _mbstate_t.
	* libc/include/sys/config.h (MB_LEN_MAX): New macro.
	* libc/include/sys/errno.h (EILSEQ): New error code.
	* libc/include/sys/reent.h: Include wchar.h.  Change reentrant
	structure to use mbstate_t.
	* libc/locale/Makefile.am (LIB_SOURCES): Add new files.
	* libc/machine/powerpc/vfprintf.c: Use mbstate_t.
	* libc/machine/powerpc/vfscanf.c: Likewise.
	* libc/stdio/getdelim.c: Reallocate buffer only when necessary.
	* libc/stdio/vfprintf.c: Likewise.
	* libc/stdio/vfscanf.c: Likewise.
	* libc/stdlib/Makefile.am (LIB_SOURCES): Add new files.
	* libc/stdlib/mblen.c: Use mbstate_t.
	* libc/stdlib/mblen_r.c: Likewise.
	* libc/stdlib/mbstowcs.c: Likewise.
	* libc/stdlib/mbstowcs_r.c: Likewise.
	* libc/stdlib/mbtowc.c: Likewise.
	* libc/stdlib/mbtowc_r.c: Likewise.
	* libc/stdlib/wcstombs.c: Likewise.
	* libc/stdlib/wcstombs_r.c: Likewise.
	* libc/stdlib/wctomb_r.c: Likewise.
	* libc/sys/linux/Makefile.am (LIB_SOURCES): Add prof-freq.c and
	profile.c.
	* libc/sys/linux/machine/i386/Makefile.am (LIB_SOURCES): Add
	dl-procinfo.c.
	* libc/sys/linux/sys/errno.h (EILSEQ): New error code.
	* libc/sys/linux/sys/types.h (off_t): Define type.
	* testsuite/newlib.locale/UTF-8.c: Change locale name from UTF-8
	to C-UTF-8.
	* testsuite/newlib.locale/UTF-8.exp: Likewise.
2002-08-23 01:56:05 +00:00
Jeff Johnston 29e17a863d 2002-08-17 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/config.h[__PPC__][__SPE__]: Set
        _LONG_DOUBLE to double.
2002-08-17 06:10:33 +00:00
Jeff Johnston a703e0f2ee 2002-07-24 Stephane Carrez <stcarrez@nerim.fr>
* configure.host: Recognize m6811-elf and m6812-elf targets.
        * libc/include/machine/setjmp.h (_JBLEN): Define for 68hc11/68hc12.
        * libc/include/machine/ieeefp.h (__IEEE_BIG_ENDIAN): Define for 68HC11.
        (_DOUBLE_IS_32BITS): Define when compiling with -fshort-double.
        * libc/include/sys/config.h (INT_MAX, UINT_MAX): Define
        according to __INT_MAX__.
        (_POINTER_INT): Define to short.
        * libc/machine/m68hc11/Makefile.am: New file.
        * libc/machine/m68hc11/Makefile.in: New file.
        * libc/machine/m68hc11/configure.in: New file.
        * libc/machine/m68hc11/configure: New file.
        * libc/machine/m68hc11/aclocal.m4: New file.
        * libc/machine/m68hc11/setjmp.S: New file.
2002-07-24 15:44:24 +00:00