* 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.
* libc/include/sys/features.h: Redefine compilation environment
definitions for Cygwin to cover 64 bit Cygwin.
* libc/ctype/ctype_.c (_ctype_): Fix definition for 64 bit Cygwin.
* libc/include/machine/setjmp.h: Change definition of _JBLEN to allow
different values for 32 bit and 64 bit Cygwin.
* libc/include/reent.h (stat64): Define as stat under Cygwin, instead
of as __stat64. Undef stat64 if not building Newlib.
* libc/include/sys/stat.h (stat64): Define as stat under Cygwin.
* libc/machine/arm/memcpy-stub.c: Use generic memcpy if unaligned
access is not enabled.
* libc/machine/arm/memcpy.S: Faster memcpy implementation for
Cortex A15 cores using NEON and VFP if available.
* newlib.hin (_WCHAR_ORIENT): Undef
* configure.in (--enable-newlib-wchar-orient): New option.
* configure: Regenerated.
* libc/configure.in (--enable-newlib-wchar-orient): New option.
* libc/configure: Regenerated.
* libc/stdio/Makefile.am (NEWLIB_WIDE_ORIENT): Use.
* libc/stdio/Makefile.in: Regenerated.
* libc/stdio/local.h (ORIENT): Use _WCHAR_ORIENT to control
the definition. Add alternative definition.
* libc/stdio/vfprintf.c (__sfputs_r, __sprint_r): Use _WCHAR_ORIENT
to control the wide char output.
* newlib.hin (_FVWRITE_IN_STREAMIO): Undefine.
* configure.in (--disable-newlib-fvwrite-in-streamio): New option.
* configure: Regenerated.
* libc/stdio/fputs.c (_fputs_r): Use _FVWRITE_IN_STREAMIO to
control __sfvwrite_r. Add alternative implementation.
* libc/stdio/fputws.c (_fputws_r): Ditto.
* libc/stdio/fwrite.c (_fwrite_r): Ditto.
* libc/stdio/puts.c (_puts_r): Ditto.
* libc/stdio/vfprintf.c (__ssputs_r, __sfputs_r): New function.
(_VFPRINTF_R): Use _FVWRITE_IN_STREAMIO to control vector buffer.
(__SPRINT): Use _FVWRITE_IN_STREAMIO to control macro definition.
* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Use _FVWRITE_IN_STREAMIO
to control vector buffer.
from int to _off_t.
* libc/stdio/ftell.c: Use _ftello_r().
* libc/stdio/ftello.c: Copy implementation from previous
_ftell_r().
* libc/stdio/fseek.c: Use _fseeko_r().
* libc/stdio/fseeko.c: Copy implementation from previous
_fseek_r().
* configure.in: Comment out the --enable-newlib-fp-hw option
as the mathfp library is inaccurate and should not be used.
* Makefile.am: Add comment regarding the mathfp directory.
* configure: Regenerated.
* Makefile.in: Ditto.
* libm/mathfp/README: New file that details why the mathfp
directory is not used.
throughout in place of explicit GNUC version checks.
* libc/include/_ansi.h (_NOINLINE): Define.
(_NOINLINE_STATIC): Define.
* libc/stdio/vfprintf.c (__sbprintf): Define _NOINLINE_STATIC.
when WRDE_DOOFFS is in use. Restructure the code so that the memory
needed to be freed is instead kept in an internal linked list...
* libc/posix/wordexp2.h: ...as defined here...
* libc/posix/wordexp.c (wordexp): ...and build this internal
linked list here, avoiding wasteful strdup calls in the process.
macros, to avoid dependence on the line separation character.
* rl78/crt0.S (_interrupt_vector_table): Convert from CPP macros
to GAS macros, to avoid dependence on the line separation
character.
array of undefined size, to avoid problems when compiled with
-msda=4.
* v850/sbrk.c (_sbrk): Change heap_start to be an array of
undefined size, to avoid problems when compiled with -msda=4.
compiler warnings found this way.
* libc/stdio/freopen.c (_freopen_r): Fix bug setting _flags.
* libc/include/stdio.h (_rename): Define when building newlib.
* libc/include/sys/signal.h (_kill): Ditto.
* libc/include/sys/stat.h (_mkdir): Ditto.
* libc/include/sys/time.h (_gettimeofday): Ditto.
* libc/include/sys/times.h (_times): Ditto.
* libc/include/sys/wait.h (_wait): Ditto.
* libc/locale/lmessages.c (empty): Don't define for Cygwin.
* libc/locale/lmonetary.c (cnv): Ditto.
* libc/locale/nl_langinfo.c (nl_langinfo): Ditto for variable s.
* libc/posix/collate.c: Throughout cast to avoid compiler warning.
* libc/posix/engine.c (matcher): Initialize dp to avoid compiler
warning.
* libc/posix/glob.c: Disable on Cygwin. Explain why.
* libc/posix/regcomp.c: Fix "uninitialized" compiler warnings.
(dissect): Deliberately silence gcc compiler warning. Add comment to
explain why.
* libc/posix/wordexp.c (wordexp): Remove num_bytes variable since result
is never used.
* libc/posix/popen.c (popen): Ditto for variable last.
* libc/reent/mkdirr.c: Include sys/stat.h.
* libc/reent/renamer.c: Include stdio.h.
* libc/search/hash.c: Throughout use underscored variants of the stat
function family.
(init_hash): Add missing definition for the __USE_INTERNAL_STAT64 case.
* libc/search/hash_bigkey.c (__big_insert): Add parenthesis to avoid
compiler warning.
* libc/search/hash_page.c (overflow_page): Initalize freep to NULL to
avoid compiler warning.
* libc/stdio/asiprintf.c (_asiprintf_r): Cast unsigned char * to char *
to avoid compiler warning.
(asiprintf): Ditto.
* libc/stdio/asprintf.c (_asprintf_r): Ditto.
(asprintf): Ditto.
* libc/stdio/vasiprintf.c (_vasiprintf_r): Ditto.
* libc/stdio/vasprintf.c (_vasprintf_r): Ditto.
* libc/stdio/mktemp.c (_gettemp): Cast to unsigned char in call to
isdigit to avoid compiler warning.
* libc/stdio/vfprintf.c (_VFPRINTF_R): Initialize variables used for
grouping to avoid compiler warning. Only define and set nseps and
nrepeats if they are really used.
* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Ditto. Only define state if
it is really used.
* libc/stdio/vfscanf.c (u_char): Revert to be defined as unsigned char.
(__SVFSCANF_R): Cast fmt in call to __mbtowc.
* libc/stdlib/mbtowc_r.c (JIS_state_table): Disable when building
Cygwin.
(JIS_action_table): Ditto.
* libc/stdlib/wctomb_r.c (__utf8_wctomb): Add parenthesis to avoid
compiler warning.
* libc/string/strcasestr.c: Deliberately silence gcc compiler warning.
Add comment to explain why.
* libc/time/strptime.c (strptime): Cast to unsigned char in calls to
isspace to avoid compiler warning.
* libm/math/e_atan2.c (__ieee754_atan2): Add parenthesis to avoid
compiler warning.
* libm/math/e_exp.c (__ieee754_exp): Initialize k to 0 to avoid
compiler warning. Drop setting it to 0 later.
* libm/math/ef_exp.c (__ieee754_expf): Ditto.
* libm/math/e_pow.c (__ieee754_pow): Add braces to avoid compiler
warning.
* libm/math/ef_pow.c (__ieee754_powf): Ditto.
* libm/math/er_lgamma.c (__ieee754_lgamma_r): Initialize nadj to 0 to
avoid compiler warning.
* libm/math/erf_lgamma.c (__ieee754_lgammaf_r): Ditto.
* libm/math/e_rem_pio2.c (__ieee754_rem_pio2): Ditto for variable z.
* libm/common/sf_round.c (roundf): Remove signbit variable since result
is never used.
* libc/include/sys/time.h: Drop _WINSOCK_H guard. Just use
_TIMEVAL_DEFINED instead.
* libc/include/sys/types.h: Check for _WINSOCKAPI_ along with
_WINSOCK_H.
* libc/include/sys/unistd.h: Ditto.
secure stream related critical section against thread cancellation.
(_newlib_flockfile_exit): Ditto.
(_newlib_sfp_lock_end): Ditto.
(_newlib_sfp_lock_start): Ditto for the list of streams.
(_newlib_sfp_lock_exit): Ditto.
(_newlib_sfp_lock_end): Ditto.
Use aforementioned macros in place of _flockfile/_funlockfile
and __sfp_lock_acquire/__sfp_lock_release throughout the code.
* libc/stdio/fclose.c: Explicitely disable and re-enable thread
cancellation. Explain why.
* libc/stdio/freopen.c: Ditto.
* libc/stdio64/freopen64.c: Ditto.
Thomas Klein <th.r.klein@web.de>
* libc/sys/arm/crt0.S: Manually set the target architecture
when compiling for Thumb1 on EABI targets.
Don't use SWI on M-profile cores.
Avoid v6-only Thumb-1 MOV instruction.
memchr.S.
* libc/machine/arm/arm_asm.h: Add ifdef to allow it to be included
in .S files.
* libc/machine/arm/memchr-stub.c: New file - just selects what to
compile.
* libc/machine/arm/memchr.S: New file - ARMv6t2/v7 version.
* libc/machine/arm/Makefile.am (lib_a_SOURCES): Add strlen-armv7.S.
* libc/machine/arm/strlen-armv7.S: New file.
* libc/machine/arm/strlen.c: Add ifdef optimised code so it isn't
for v7 or 6t2.
* libc/machine/arm/Makefile.in: Regenerate.
memcpy function optimized for the cortex-a15.
* libc/machine/arm/memcpy-stub.c: New file.
* libc/machine/arm/Makefile.am (lib_a_SOURCES): Add memcpy-stub.c,
memcpy.S.
* libc/machine/arm/Makefile.in: Regenerate.
* libc/posix/regexec.c: Define "nope" only #ifndef NDEBUG.
* libc/stdio/vfscanf.c: Define "state" only #ifdef _MB_CAPABLE.
* libc/string/wcwidth.c: Include <wctypes.h> for "iswprint" and
"iswcntrl".
* libc/string/index.c: Include <strings.h> for "index".
* libc/string/rindex.c: Include <strings.h> for "rindex".
* libc/string/strcasecmp.c: Include <strings.h> for "strcasecmp".
Don't include <string.h>.
* libc/string/strncasecmp.c: Include <strings.h> for "strncasecmp".
Don't include <string.h>.
* libc/string/bzero.c: Include <strings.h> for "bzero".
Don't include <string.h>
* libc/misc/ffs.c: Include <strings.h> for "ffs".
Don't include <_ansi.h>.
* libc/stdio/vasiprintf.c: Include "local.h" for "_svfiprintf_r".
* libc/stdio/vasprintf.c Include "local.h" for "_svfprintf_r".
* libc/stdio/vsiprintf.c: Include "local.h" for "_svfiprintf_r".
* libc/stdio/vsniprintf.c: Include "local.h" for "_svfiprintf_r".
* libc/stdio/vsnprintf.c: Include "local.h" for "_svfprintf_r"
* libc/stdio/vsprintf.c: Include "local.h" for "_svfprintf_r"
* libc/string/bcmp.c: Include <strings.h> for "bcmp".
* libc/string/bcopy.c: Include <strings.h> for "bcopy".
* libc/string/strcasestr.c: Include <strings.h> for "strncasecmp".
* libc/time/strptime.c: Include <strings.h> for "strncasecmp".
* libc/include/sys/types.h: XML and RTEMS define
_UNIX98_THREAD_MUTEX_ATTRIBUTES and can use the standard
definitions. This avoids redefinition warnings.
* libc/stdio/vfwprintf.c (wcvt): Add a new parameter len of type
int. *length is set to the value of (rev - digits) regardless
of whether _MB_CAPABLE is defined or not. Replace BUF with len
in calling _mbsnrtowcs_r and also in the loop where _MB_CAPABLE
is not defined.
(_VFWPRINTF_R): Call wcvt with an extra argument. Call wcvt
again with allocated new buffer if buf is not large enough for
the conversion.
* testsuite/newlib.stdio/stdio.exp: New.
* testsuite/newlib.stdio/swprintf.c: Likewise.
accidental declaration of __numeric_load_locale.
* libc/locale/locale.c: Include timelocal.h to get declaration of
__time_load_locale.
(__set_locale_from_locale_alias): Fix return type.
(__locale_msgcharset): Avoid compiler warnings.
(_localeconv_r): Ditto.
* libc/locale/locale.c (current_categories): On Cygwin, set LC_CTYPE
to C.UTF-8 to match initial __wctomb and __mbtowc settings.
(lc_ctype_charset): On Cygwin, initialize to "UTF-8".
(loadlocale): Remove unused Cygwin-specifc code.
(__CONCAT): Define.
(__STRING): Define.
(__XSTRING): Define.
(__ASMNAME): Define.
* libc/include/string.h (strerror_r): Use __ASMNAME to take target
specific label prefixes into account.
changes of flags and fp lock.
* libc/stdio/freopen.c: Ditto.
* libc/stdio/freopen64.c: Ditto.
* libc/stdio/fgetc.c: Revert change from 2009-04-24, remove sfp locks
which guard entire function to avoid potential deadlocks when using
stdio functions in multiple thraeds.
* libc/stdio/fgets.c: Ditto.
* libc/stdio/fgetwc.c: Ditto.
* libc/stdio/fgetws.c: Ditto.
* libc/stdio/fread.c: Ditto.
* libc/stdio/fseek.c: Ditto.
* libc/stdio/getc.c: Ditto.
* libc/stdio/getdelim.c: Ditto.
* libc/stdio/gets.c: Ditto.
* libc/stdio/vfscanf.c: Ditto.
* libc/stdio/vfwscanf.c: Ditto.
* libc/stdio/fflush.c (_fflush_r): Split out core functionality into
new function __sflush_r. Just lock file and call __sflush_r from here.
* libc/stdio/fwalk.c (_fwalk): Remove static helper function and move
functionality back into main function. Don't walk a file with flags
value of 1. Add comment.
(_fwalk_reent): Ditto.
* libc/stdio/local.h (__sflush_r): Declare.
* libc/stdio/refill.c (__srefill): Before calling fwalk, set flags
value to 1 so this file pointer isn't walked. Revert flags afterwards
and call __sflush_r for this fp if necessary. Add comments.
* configure.host: Add noinclude variable to allow specification
of header files to remove from installation.
* acinclude.m4: Provide NO_INCLUDE_LIST variable based on
noinclude variable in configure.host.
* configure: Regenerated.
* Makefile.am: Remove all header files in NO_INCLUDE_LIST.
* Makefile.in: Regenerated.
* libm/common/s_log2.c: Change from using M_LOG2_E to M_LN2 define
(from math.h--the latter is POSIX, the former non-standard).
* libm/common/sf_log2.c: Ditto. Change cast for M_LN2 from float to
float_t (in case all math not done in float).
* libc/include/math.h: Ditto (same 2 things as sf_log2.c).
* libc/stdlib/strtol.c: Make sure signed characters are not
sign-extended when converted to int and passed to ctype macros.
* libc/stdlib/strtoul.c: Ditto.
* libc/stdlib/strtoll_r.c: Ditto.
* libc/stdlib/strtoull_r.c: Ditto.
* libm/common/s_lrint.c (lrint): Annotate shift operations with
possible shift amount ranges, and use SAFE_RIGHT_SHIFT to avoid
undefined behaviour.
* libm/common/s_llrint.c (llrint): Likewise.
* libm/common/s_lround.c (lround): Correct some comments on ranges.
* libm/common/s_llround.c (llround): Likewise.
Gina Verlekar <gina.verlekar@kpitcummins.com>
* configure.host: Compact v850* support and add
check for newlib_may_supply_syscalls.
* libc/sys/sysnecv850/Makefile.am: Add support for
'--disable-newlib-supplied-syscalls' option.
* libc/sys/sysnecv850/Makefile.in: Regenerated.
(SAFE_RIGHT_SHIFT): Likewise.
* libm/common/s_llround.c (llround): Annotate shift operations with
possible shift amount ranges, and use SAFE_RIGHT_SHIFT to avoid
undefined behaviour.
* libm/common/s_lround.c (lround): Likewise.
* libc/include/machine/ieeefp.h[__arm__][!__VFP_FP__]: Set to
__IEEE_BIG_ENDIAN and set __IEEE_BYTES_LITTLE_ENDIAN appropriately
based on __ARMEL flag.
* libc/include/machine/endian.h: To set byte order to LITTLE_ENDIAN,
check for __IEEE_LITTLE_ENDIAN or __IEEE_BYTES_LITTLE_ENDIAN.
* configure.in: Add test for enable-newlib-register-fini
to set the _WANT_REGISTER_FINI flag.
* configure: Regenerated.
* Makefile.in: Ditto.
* newlib.hin: Add _WANT_REGISTER_FINI flag.
* libc/stdlib/__call_atexit.c: Add test for
_WANT_REGISTER_FINI to enable the register_fini function.
(_C_ctype_locale): Add braces to initializer.
(__ctype_load_locale): Fix compiler warnings in non-Cygwin case.
* libc/locale/nl_langinfo.c (nl_langinfo): Expose _NL_CTYPE_MB_CUR_MAX
case only if __HAVE_LOCALE_INFO__ is defined.
pwc to pmb and convert to array to avoid buffer overflow. Rename c to
wc. Check wc for WEOF instead of for EOF. Return first byte of pmb if
__wctomb conversion returned exactly one byte, EOF otherwise.
if __HAVE_LOCALE_INFO_EXTENDED__ is defined.
* libc/include/langinfo.h (enum __nl_item): New type. Define all
native values accessible through nl_langinfo. Define previously
existing POSIX-compatible values as macros as well.
* libc/include/stdlib.h (__mb_cur_max): Drop declaration.
(__locale_mb_cur_max): Declare.
(MB_CUR_MAX): Re-define calling __locale_mb_cur_max.
* libc/locale/Makefile.am (ELIX_SOURCES): Add lctype.c.
* libc/locale/Makefile.in: Regenerate.
* libc/locale/lctype.c: New file to define and load LC_CTYPE category.
* libc/locale/lctype.h: New file, matching header.
* libc/locale/lmessages.c (_C_messages_locale): Add default values for
wide char members.
(__messages_load_locale): Add _C_messages_locale in call to
__set_lc_messages_from_win.
* libc/locale/lmessages.h (struct lc_messages_T): Add wide char members.
* libc/locale/lmonetary.c (_C_monetary_locale): Add default values for
wide char members.
(__monetary_load_locale): Add _C_monetary_locale in call to
__set_lc_monetary_from_win.
* libc/locale/lmonetary.h (struct lc_monetary_T): Add wide char members.
Add numerical values for international currency formatting per
POSIX-1.2008, if __HAVE_LOCALE_INFO_EXTENDED__ is defined.
* libc/locale/lnumeric.c (_C_numeric_locale): Add default values for
wide char members.
(__numeric_load_locale): Add _C_numeric_locale in call to
__set_lc_numeric_from_win.
* libc/locale/lnumeric.h (struct lc_numeric_T): Add wide char members.
* libc/locale/locale.c (loadlocale): Return doing nothing if category
locale didn't change. Convert category if chain to switch statement.
Call __ctype_load_locale in LC_CTYPE case.
(__locale_charset): Add (but disable for now) returning codeset from
__get_current_ctype_locale.
(__locale_mb_cur_max): Add (but disable for now) returning mb_cur_max
from __get_current_ctype_locale.
(__locale_msgcharset): Add returning codeset from
__get_current_messages_locale.
(_localeconv_r): Accommodate int_XXX values.
* libc/locale/nl_langinfo.c (nl_ext): New array to define what is to
be returned for non-POSIX values.
(nl_Langinfo): Return correct codeset for each locale category. Return
extended values if __HAVE_LOCALE_INFO_EXTENDED__ is defined.
* libc/locale/timelocal.c (_C_time_locale): Add default values for
wide char members.
(__time_load_locale): Add _C_time_locale in call to
__set_lc_time_from_win.
* libc/locale/timelocal.h (struct lc_time_T): Add wide char members.
* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Use wide char decimal point
and thousands_sep if __HAVE_LOCALE_INFO_EXTENDED__ is defined.
* libc/time/strftime.c: Rework to accommodate availability of wide char
strings in LC_TIME category if __HAVE_LOCALE_INFO_EXTENDED__ is defined.
* libc/stdlib/__atexit.c (__atexit_lock): Initialise as recursive
rather than non-recursive lock type.
(__register_exitproc): Use recursive locking APIs on it.
* libc/stdlib/__call_atexit.c (__call_exitprocs): Likewise.
* libc/include/sched.h: Include prototypes for
sched_* methods.
* libc/include/sys/sched.h: Update to POSIX
1003.1b-2008. Rework constants to allow sharing
between RTEMS and Cygwin.
Cygwin only: Allow GB2312 and EUC-CN as alternative codeset names
for GBK. Add to documentation.
* libc/locale/nl_langinfo.c (nl_langinfo): On Cygwin, translate EUCCN
to GB2312.
* libm/common/s_rint.c: Fix error when integral part had 18 bits and
fraction had bits set beyond first radix bit. Also, make 2-part
adjustment consistent with 1-part adjustment when adjusting fractional
bits.
* libm/common/sf_rint.c: Make fractional-bit adjustment consistent
with s_rint.c by setting 0b.01 instead of 0b.001.
* libc/stdlib/getenv.c: Delete "char *_findenv_r ();", as is not a
proper prototype, and is properly prototyped in stdlib.h, anyway.
* libc/stdlib/getenv_r.c: Ditto.
* libc/search/hash.c: Add _DEFUN to __hash_open() declaration; add
#define __DBINTERFACE_PRIVATE to activate prototypes from db_local.h.
* libc/search/db_local.h: Correct __hash_open() prototype.
* libc/sys/linux/cmath/math_private.h: Eliminate compiler warnings:
Remove #define INFINITY (redefines from math.h); remove #define __isnanf
and #define __isinff isinff.
* 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.
* libc/include/rpc/types.h: Add public types used
by RPC implementations.
* libc/include/rpc/xdr.h: Add defines used by RPC
implementations.
* libc/xdr/Makefile.am: Eliminate automake warning.
* libc/xdr/Makefile.in: Regenerate.
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.
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.
value for LC_TIME entry date_fmt.
(_DATE_FMT): Define "official" GNU name same as _NL_TIME_DATE_FMT.
* libc/locale/nl_langinfo.c (nl_langinfo): Add case for _DATE_FMT.
* libc/ctype/iswprint.c (iswprint): Ditto.
* libc/ctype/iswpunct.c (iswpunct): Drop standalone implementation.
Define in terms of other wctype functions instead.
* libc/ctype/towlower.c (towlower): Update to Unicode 5.2. Add comment
to explain how to fetch the data from the Unicode database.
* libc/ctype/towupper.c (towupper): Ditto.
* libc/ctype/utf8alpha.h: Ditto.
* libc/ctype/utf8print.h: Ditto.
* libc/ctype/utf8punct.h: Remove.
* libc/ctype/iswcntrl.c (iswcntrl): Add comment to explain how to
fetch the data from the Unicode database.
members.
* libc/locale/timelocal.c (_C_time_local): Set new members to empty
strings.
* libc/locale/nl_langinfo.c (nl_langinfo): Return values from
__get_current_time_locale() for ERA related requests.
U+00A0 and U+200B. Add Unicode character U+180E. Add comment
to explain how to generate from Unicode data file.
* libc/ctype/iswspace.c (iswspace): Ditto.
* libm/common/s_ilogb.c: Adjust documentation to reflect new returns
(see next items) and that ilogb() and ilogbf() are C99/POSIX.
* libm/common/s_ilogb.c (ilogb): Use C99/POSIX FP_ILOGB0 and
FP_ILOGBNAN returns for 0 and NAN arguments, respectively, instead of
the prior -INT_MAX and INT_MAX. The FP_ILOGBx defines in math.h
presently match the prior hard-codes, so no functional change is
actually introduced. (Not at this time, nor planned, but the values
are permitted to be different, so subsequent edits of math.h could
possibly cause a functional change.)
* libm/common/sf_ilogb.c (ilogbf): Ditto.
parameters for wide char to multibyte conversion. Call
__set_lc_messages_from_win on Cygwin.
* libc/locale/lmessages.h: Make C++-safe.
(__messages_load_locale): Change declaration.
* libc/locale/lmonetary.c (__monetary_load_locale): Use
_monetary_locale_buf as buffer pointer.
* libc/locale/lnumeric.c (__numeric_load_locale): Use
_numeric_locale_buf as buffer pointer.
* libc/locale/timelocal.c (__time_load_locale): Use time_locale_buf
as buffer pointer.
* libc/locale/locale.c (loadlocale): Enable loading LC_MESSAGES data
on Cygwin.
support to documentation.
(__set_locale_from_locale_alias): Declare when build for Cygwin.
(loadlocale): On Cygwin, if locale can't be recognized, call
__set_locale_from_locale_alias to check for locale alias.
Define FAIL macro to replace `return NULL' statements. Replace
throughout.
(_CTYPE_GEORGIAN_PS_255): Define.
(_CTYPE_PT154_128_254): Define.
(_CTYPE_PT154_255): Define.
(__ctype_cp): Add array members for above ctype definitions.
* libc/locale/locale.c (loadlocale): Make TIS-620 charset name
available for all targets. Add guards for setting the conversion
function pointers. Add support for GEORGIAN-PS and PT154 charsets.
Change documentation to reflect current behaviour more closely.
* libc/locale/nl_langinfo.c (nl_langinfo): On Cygwin, translate
"CP101" to "GEORGIAN-PS" and "CP102" to "PT154".
* libc/stdlib/sb_charsets.c (__cp_conv): Add conversion arrays
for GEORGIAN-PS and PT154.
(__cp_index): Map invalid Windows codepage number 101 to
GEORGIAN-PS conversion array, 102 to PT154 conversion array.
is defined. Raise conversion buffer size to make sure it has enough
room for numbers plus grouping character. Define GROUPING flag.
(_VFPRINTF_R): Add PRINTANDPAD macro. Handle grouping flag character.
Handle grouping for decimal integer and float values.
* libc/stdio/vfwprintf.c: Ditto.
parameters for wide char to multibyte conversion. Call
__set_lc_monetary_from_win on Cygwin.
* libc/locale/lmonetary.h: Make C++-safe.
(__monetary_load_locale): Change declaration.
* libc/locale/lnumeric.c (__numeric_load_locale): Take additional
parameters for wide char to multibyte conversion. Call
__set_lc_numeric_from_win on Cygwin.
* libc/locale/lnumeric.h: Make C++-safe.
(__numeric_load_locale): Change declaration.
* libc/locale/locale.c (lconv): De-constify for Cygwin.
(__set_charset_from_locale): Rename from
__set_charset_from_codepage. Take locale as parameter instead of
a codepage.
(loadlocale): Allow "EUC-JP" for "EUCJP" and "EUC-KR" for "EUCKR".
Change documnetation accordingly. Enable LC_COLLATE, LC_MONETARY,
LC_NUMERIC, and LC_TIME handling on Cygwin.
(_localeconv_r): On Cygwin, copy values from monetary and numeric
domain if change has been noted.
* libc/locale/nl_langinfo.c (nl_langinfo): Accommodate change of
am/pm layout in struct lc_time_T.
* libc/locale/timelocal.c (_C_time_locale): Accommodate
redefinition of am/pm members.
(__time_load_locale): Take additional parameters for wide char
to multibyte conversion. Call __set_lc_time_from_win on Cygwin.
* libc/locale/timelocal.h: Make C++-safe.
(struct lc_time_T): Convert am and pm to a am_pm array for easier
consumption by strftime and strptime.
(__time_load_locale): Change declaration.
* libc/time/strftime.c: Change documentation to reflect changes to
strftime. Remove locale constant strings in favor of access to
locale-specifc data.
(_ctloc): Define access method for locale-specifc data.
(TOLOWER): Define for tolower conversion.
(strftime): Throughout, convert locale-specific formats to use
locale-specific data. Add GNU-specific "%P" format.
* libc/time/strptime.c: Remove locale constant strings in favor of
access to locale-specifc data.
(_ctloc): Define access method for locale-specifc data.
(strptime): Throughout, convert locale-specific formats to use
locale-specific data.
* libc/iconv/lib/local.h[!__GNUC__]: Add alternative version of
ICONV_ZERO_MB_STATE_T macro.
* libc/iconv/lib/ucsconv.c (ucs_based_conversion_get_state): Use
temporary local variable nullstate to hold empty mbstate_t.
* libc/include/_ansi.h: Add new _EXFNPTR macro for using with
function pointer arguments.
* libc/iconv/lib/conv.h: Use _EXFNPTR rather than _EXPARM macro.
* libc/iconv/lib/ucsconv.h: Ditto.
* libc/include/stdlib.h: Use new _EXFNPTR macro for function pointers.
* libc/include/sys/reent.h: Ditto.
* libc/include/sys/unistd.h: Ditto.
* libc/search/bsearch.c: Ditto.
* libc/stdio/fseek.c: Ditto.
* libc/stdio64/fseeko64.c: Ditto.
* libc/stdlib/atexit.c: Ditto.
* libc/stdlib/on_exit.c: Ditto.
* libc/include/sys/reent.h (_Kmax): Define here based on the sizeof
size_t, as in latest NetBSD.
* libc/reent/reent.c (_reclaim_reent): Use _Kmax rather than constant
value 15.
* libc/stdlib/mprec.c (_Kmax): Don't define here. Explain why.
_mbtowc_r with direct call to __mbtowc.
* libc/stdio/vfscanf.c: Ditto.
* libc/stdlib/btowc.c: Include local.h. Replace call to _mbtowc_r
with direct call to __mbtowc.
* libc/stdlib/mblen.c: Ditto.
* libc/stdlib/mblen_r.c: Ditto.
* libc/stdlib/mbrtowc.c: Ditto.
* libc/stdlib/mbstowcs_r.c: Ditto.
* libc/stdlib/mbtowc.c: Ditto.
* libc/stdlib/wcrtomb.c: Include local.h. Replace call to _wctomb_r
with direct call to __wctomb.
* libc/stdlib/wcsnrtombs.c: Ditto.
(_wcsnrtombs_r): Ditto.
* libc/stdlib/wcstombs_r.c: Ditto.
* libc/stdlib/wctob.c: Ditto.
* libc/stdlib/wctomb.c: Ditto.
* libc/stdlib/mbrtowc.c (mbrtowc): Implement independently from
_mbrtowc_r, unless PREFER_SIZE_OVER_SPEED or __OPTIMIZE_SIZE__ are
defined.
* libc/stdlib/wcrtomb.c (wcrtomb): Implement independently from
_wcrtomb_r, unless PREFER_SIZE_OVER_SPEED or __OPTIMIZE_SIZE__ are
defined.
* libc/stdlib/mbtowc_r.c (__utf8_mbtowc): Drop unnecessary test for
ch >= 0.
low-level seek error condition. Restore old errno in case of
success. Don't use new position after seek as error condition,
rather check for return value of -1 and errno. Handle EINVAL
just like ESPIPE. Only set fp->_offset if errno is 0.
* configure.host: Add support for RX architecture.
* libc/include/machine/ieeefp.h: Likewise.
* libc/include/machine/setjmp.h: Likewise.
* libc/include/machine/configure.in: Likewise.
* libc/include/machine/configure: Regenerate.
* libc/machine/rx: New directory.
* libc/machine/rx/*: New files to support RX architecture.
libgloss:
* configure.in: Add support for RX sub-directory.
* configure: Regenerate.
* rx: New directory.
* rx/*: New files to support RX architecture.
* libc/include/ctype.h (__ctype_lookup): New macro.
(isalpha, isupper, islower, isdigit, isxdigit, isspace, ispunct)
(isalnum, isprint, isgraph, iscntrl, isblank): Use it to fix bug
on 64-bit machines.
* 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.
* configure.host: For RTEMS, define HAVE_ASSERT_FUNC.
* libc/stdlib/assert.c (_assert_func): Do not specify
__assert_func if HAVE_ASSERT_FUNC flag is set.
(lc_message_charset): Ditto.
(loadlocale): Set charset of the "C" locale to "UTF-8" on Cygwin.
* libc/stdlib/mbtowc_r.c (__mbtowc): Default to __utf8_mbtowc on
Cygwin.
* libc/stdlib/wctomb_r.c (__wctomb): Default to __utf8_wctomb on
Cygwin.
* libc/stdlib/sb_charsets.c (__micro_atoi): Allow five-digit codepage
numbers.
* libc/locale/locale.c (loadlocale): Set MB_CUR_MAX to 1 for KOI8
charsets.
* libc/stdlib/local.h (__cp_conv): Remove incorrect number of codepages.
* libc/locale/locale.c: Update documentation.
(loadlocale): Map "KOI8-R" and "KOI8-U" to CP20866 and CP21866.
2009-08-24 Andy Koppe <andy.koppe@gmail.com>
* libc/stdlib/sb_charsets.c (__cp_conv): Add KOI8-R (Russian, CP20866)
and KOI8-U (Ukrainian, CP21866) to Windows codepage conversion tables.
* libc/ctype/ctype_cp.h (__ctype_cp): Likewise for ctype tables.
* libc/posix/popen.c (popen): Fix documented prototype.
Improve popen compatibility with glibc.
* libc/posix/popen.c (popen): The 2006-08-22 change to use
FD_CLOEXEC disagrees with other implementations; instead, use
pidlist to work even when fcntl is not available. Meanwhile,
support the 'e' modifier to set CLOEXEC, as in glibc. Drop
cygwin-specific code, now that cygwin has its own version.
* libc/posix/Makefile.am (CHEWOUT_FILES): Document popen.
* libc/posix/posix.tex: New file.
* libc/posix/popen.c (popen): The 2006-08-22 change to use
FD_CLOEXEC disagrees with other implementations; instead, use
pidlist to work even when fcntl is not available. Meanwhile,
support the 'e' modifier to set CLOEXEC, as in glibc. Drop
cygwin-specific code, now that cygwin has its own version.
* libc/posix/Makefile.am (CHEWOUT_FILES): Document popen.
* libc/posix/posix.tex: New file.
pair handling to be more bullet-proof even with incomplete UTF-8
sequences. Add check for 4 byte sequences resulting in values
outside the valid Unicode range. Add a comment to clarify checking
for invalid CESU-8 sequences.
radix char instead of assuming length 1.
* libc/stdlib/gdtoa-gethex.c: Remove use of USE_LOCALE.
(gethex): Allow multibyte decimal point.
Fix compiler warnings due to different signedness of pointer types.
* libc/stdlib/strtod.c: Remove use of USE_LOCALE.
(_strtod_r): Allow multibyte decimal point.
* libc/stdlib/wcstod.c (_wcstod_r): Evaluate correct wide char
endptr position if the decimal point is a multibyte char.
* libc/include/math.h: Simplify fpclassify, isinf, isnan, and signbit
macros to remove un-necessary extension use. isinf and isnan also
changed to use fpclassify. isfinite macro modified to run faster by
only calling fpclassify once instead of possibly twice.
* libc/locale/locale.c (lc_ctype_cjk_lang): New static int.
(loadlocale): In case of setting LC_CTYPE, set lc_ctype_cjk_lang
to 1 if the language is "jp", "ko", or "zh", to 0 otherwise.
(__locale_cjk_lang): New function.
* libc/string/local.h (__locale_cjk_lang): Declare.
* libc/string/wcwidth.c: Fix comments.
(__wcwidth): Handle CJK Ambiguous Width characters according
to setting returned by __locale_cjk_lang.
(__jp2uc): Change the scope to static function.
* libc/ctype/local.h (_jp2uc): Define as macro if defined __CYGWIN__.
* libc/string/local.h (_jp2uc): Include ../ctype/local.h.
* configure.in: Add configuration test for long double type existing
and set flag _HAVE_LONG_DOUBLE if true. Fix INIT_ARRAY (.init_array)
and _LDBL_EQ_DBL tests to not link so that will work with
cross-compilers.
* configure: Regenerated.
* Makefile.in: Ditto.
* newlib.hin: Add _HAVE_LONG_DOUBLE flag.
* libc/include/math.h: Change non-builtin defines for HUGE_VAL,
HUGE_VALF, and HUGE_VALL to be constant expressions. Add definitions
for the non-builtin case for INFINITY and NAN. Gate HUGE_VALL and
union __ldmath definitions with (new) _HAVE_LONG_DOUBLE.
*libm/common/s_infconst.c: Change definitions to use values from
float.h instead of non-so-portable integer forms. Mark as being
deprecated (because now removed from math.h, are not used anywhere
in Newlib, itself).
* libc/string/wcswidth.c (wcswidth): Convert japanese wide
characters to Unicode here. Handle surrogate pairs for UTF-16
systems. Call __wcwidth rather than wcwidth.
* libc/string/wcwidth.c: New implementation using Markus Kuhn's
wcwidth implementation for Unicode.
(bisearch): New static function.
(__wcwidth): New function. Take wint_t rather than wchar_t as
parameter to allow full Unicode handling on UTF-16 systems.
Move old wcwidth implementation here for non-multibyte aware
systems.
(wcwidth): Convert japanese wide characters to Unicode here.
Call __wcwidth rather than using iswprint/iswcntrl.
* libc/include/ctype.h (toupper, tolower)
[_MB_EXTENDED_CHARSETS_ISO]: Allow gcc warning when called with
'char' even when we must call the function for correct behavior.
[!_MB_EXTENDED_CHARSETS_ISO]: Fix regression in result type.
* libc/stdio/fgetc.c: Make sure sfp lock is acquired before the
file lock and released before the file lock to avoid a deadlock
scenario.
* libc/stdio/fgets.c: Ditto.
* libc/stdio/fgetwc.c: Ditto.
* libc/stdio/fgetws.c: Ditto.
* libc/stdio/fread.c: Ditto.
* libc/stdio/fseek.c: Ditto.
* libc/stdio/getc.c: Ditto.
* libc/stdio/getdelim.c: Ditto.
* libc/stdio/gets.c: Ditto.
* configure.in: Add configuration test for long double equals dbl
and set flag _LDBL_EQ_DBL if true.
* configure: Regenerated.
* newlib.hin: Add _LDBL_EQ_DBL flag.
* libc/include/math.h: Use _LDBL_EQ_DBL flag instead of
_HAVE_LDBL_MATH.
* libc/include/stdlib.h: Use _LDBL_EQ_DBL flag instead of
_HAVE_LDBL_STDLIB.
* libc/common/local.h: Remove _LDBL_EQ_DBL flag setting.
* libc/stdlib/local.h: Ditto.
* libc/include/ctype.h (isalpha, isupper, islower, isdigit)
(isxdigit, isspace, ispunct, isalnum, isprint, isgraph)
(iscntrl, isblank, toupper, tolower): Rewrite to let 'gcc -Wall'
warn when user calls macro with a char argument.
Kazu Hirata <kazu@codesourcery.com>
* libc/stdlib/__atexit.c (__register_exitproc): Use weak reference
to malloc. Allocate dynamically only if it is present.
* libc/stdlib/__call_atexit.c (__call_exitprocs): Use weak
reference to free. Call free only if it is present.