Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-01-17ansification: remove _HAVE_STDCYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _EXFUN, _EXFUN_NOTHROWYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _EXFNPTR, _EXPARMYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _DEFUNYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _VOIDYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _DEFUN_VOIDYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _CAST_VOIDYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _PTRYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _PARAMSYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _DOTSYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _CONSTYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _ANDYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-09newlib: fvprintf: fix get_arg for !_MB_CAPABLEIvan Grokhotkov
Code path for _MB_CAPABLE scans for the '%' character and advances 'fmt' pointer past '%'. Code path for !_MB_CAPABLE leaved fmt pointing to '%', which caused the state machine to go from START to DONE state immediately.
2018-01-08fix incompatible pointer type for va_list in nano versions of printf and ↵Alexander Fedotov
scanf for target like PowerPC
2017-12-18newlib: ftello{64}: Handle appending stream without fflushingCorinna Vinschen
Neither upstream FreeBSD nor glibc ever call fflush from ftell and friends. In border cases it has the tendency to return wrong or unexpected values, for instance on block devices. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-12-18newlib: ftello{64}: Fix type of returned valueCorinna Vinschen
Especially don't just use -1L since _off_t/_off64_t are not guaranteed to be of type long. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-12-07makedoc: make errors visibleJon Turney
Discard QUICKREF sections, rather than writing them to stderr Discard MATHREF sections, rather than discarding as an error Pass NOTES sections through to texinfo, rather than discarding as an error Don't redirect makedoc stderr to .ref file Remove makedoc output on error Remove .ref files from CLEANFILES Regenerate Makefile.ins Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-12-04newlib: vfwscanf: fix negation bug in %[ conversionCorinna Vinschen
Old BSD bug: While ^ is recognized and the set of matching characters is negated, the code neglects to increment the pointer pointing to the matching characters. Thus, on a negation expression like %[^xyz], the matching doesn't only stop at x, y, or z, but incorrectly also on ^. Fix this by setting the start pointer after recognizing the ^. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-12-01newlib: vfscanf: Implement %l[Corinna Vinschen
Just as %lc and %ls, this is only enabled on ELIX_LEVEL >= 2. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-12-01newlib: vf[w]scanf: Fix conversion multibyte <-> wchar_tCorinna Vinschen
* vfscanf: per POSIX, if the target type is wchar_t, the width is counted in (multibyte) characters, not in bytes. * vfscanf: Handle UTF-8 multibyte sequences converted to surrogate pairs on UTF-16 systems. * vfwscanf: Don't count high surrogates in input against field width counting. Per POSIX, input is Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-12-01newlib: vf[w]scanf: Drop width computation mixupCorinna Vinschen
The width value keeps the maximum field width. This is the maximum field width of the *input*. It's *never* to be used in conjunction with the number of bytes or characters written to the output argument. However, especially in vfwscanf, the code is partially taken from NetBSD which erroneously subtracts the number of multibyte chars written to the argument from the width variable, thus potentially subtracting up to MB_CUR_MAX from width for a single character in the input stream. To make matters worse, the previous patch adding %m added basically the same mistake for 'c' type input. Fix it. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-12-01stdio: remove TRAD_SYNOPSISYaakov Selkowitz
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-30newlib: vf[w]scanf: Implement POSIX %m modifierCorinna Vinschen
* The new code is guarded with _WANT_IO_POSIX_EXTENSIONS, but this is automatically enabled with _WANT_IO_C99_FORMATS for now. * vfscanf neglects to implement %l[, so %ml[ is not implemented yet either. * Sidenote: vfwscanf doesn't allow ranges in %[ yet. Strictly this is allowed per POSIX, but it differes from vfscanf as well as from glibc. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-30newlib: vfwscanf: fix miscomputation of max field width in %[] caseCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-30newlib: vf[w]scanf: add validity checksCorinna Vinschen
POSIX requires that directive characters appear in a certain sequence: 1. '%' or '%<n>$' 2. optional '*' 3. optional field width digits 4. optional 'm' (not yet implemented) 5. optional length modifier ('l', 'L', 'll', 'h', 'hh', 'j', 't', 'z') 6. conversion specifier ('d', 's', etc) Add a few basic validity checks to that effect, otherwise reject directive as match failure. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-30newlib: vf[w]scanf: Use SIZE_MAX rather than ~0Corinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-30newlib: vfscanf: fix formattingCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-30newlib: vf[w]scanf: Only return from a single point to simplify cleanupCorinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-11-29newlib: [w]scanf: Fix behaviour on matching failureCorinna Vinschen
The special handling of %\0 in [w]scanf is flawed. It's just a matching failure and should be handled as such. scanf also fakes an int input value on %X with X being an invalid conversion char. This is also just a matching failure and should be handled the same way as %\0. There's no indication of the reason for this "disgusting backwards compatibility hacks" in the logs, given this code made it into newlib before setting up the CVS repo. Just handle these cases identically as matching failures. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-07-28stdio: Fix make rule overrideSebastian Huber
The Makefile.am contained two rules for the vfwscanf object. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-30Enable _REENT_GLOBAL_STDIO_STREAMS for RTEMSSebastian Huber
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-30Introduce _REENT_GLOBAL_STDIO_STREAMSSebastian Huber
In Newlib, the stdio streams are defined to thread-specific pointers _reent::_stdin, _reent::_stdout and _reent::_stderr. In case _REENT_SMALL is not defined, then these pointers are initialized via _REENT_INIT_PTR() or _REENT_INIT_PTR_ZEROED() to thread-specific FILE objects provided via _reent::__sf[3]. There are two problems with this (at least in case of RTEMS). (1) The thread-specific FILE objects are closed by _reclaim_reent(). This leads to problems with language run-time libraries that provide wrappers to the C/POSIX stdio streams (e.g. C++ and Ada), since they use the thread-specific FILE objects of the initialization thread. In case the initialization thread is deleted, then they use freed memory. (2) Since thread-specific FILE objects are used with a common output device via file descriptors 0, 1 and 2, the locking at FILE object level cannot ensure atomicity of the output, e.g. a call to printf(). Introduce a new Newlib configuration option _REENT_GLOBAL_STDIO_STREAMS to enable the use of global stdio FILE objects. As a side-effect this reduces the size of struct _reent by more than 50%. The _REENT_GLOBAL_STDIO_STREAMS should not be used without _STDIO_CLOSE_PER_REENT_STD_STREAMS. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-30Add stdin_init(), stdout_init() and stderr_init()Sebastian Huber
This simplifies further changes in this area. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-30Remove superfluous parameter from std()Sebastian Huber
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-06-19Revert "Don't overread or write memory returned by _DTOA_R"Corinna Vinschen
This reverts commit efaef1bba263501e1e7264833ddfc9b8c20f9ebc.
2017-06-09Don't overread or write memory returned by _DTOA_RSilviu Baranga
Don't over-read memory returned by _DTOA_R, and never write to it since the result might be a string literal. For example, when doing: swprintf(tt, 20, L"%.*f", 6, 0.0); we will get back "0". Instead, write the result returned by _DTOA_R to the output buffer. After this, write the 0 chars directly to the the output buffer (if there are any). This also has the (marginal) advantage that we read/write less memory overall.
2017-06-07Print sign of NaN values.Kito Cheng
2017-04-18Add __packed to struct ldieeeKito Cheng
- We don't want any padding in struct ldieee, otherwise the offset might wrong in most compiler.
2017-04-03Use enum __packed in favour of -fshort-enumsSebastian Huber
Some architectures like ARM encode the short enum option state in the object file and the linker checks that this option is consistent for all objects of an executable. In case applications use -fno-short-enums, then this leads to linker warnings. Use the enum __packed attribute for the relevent enums to avoid the -fshort-enums compiler option. This attribute is at least available on GCC, LLVM/clang and the Intel compiler. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2017-02-07Unify names of all lock objectsFreddie Chopin
In preparation for the patch that would allow retargeting of locking routines, rename all lock objects to follow this pattern: "__<name>_[recursive_]mutex". Following locks were renamed: __dd_hash_lock -> __dd_hash_mutex __sfp_lock -> __sfp_recursive_mutex __sinit_lock -> __sinit_recursive_mutex __atexit_lock -> __atexit_recursive_mutex _arc4random_mutex -> __arc4random_mutex __env_lock_object -> __env_recursive_mutex __malloc_lock_object -> __malloc_recursive_mutex __atexit_mutex -> __at_quick_exit_mutex __tz_lock_object -> __tz_mutex
2016-12-152016-12-15 Giuseppe Musumeci <giuseppe.musumeci@broadcom.com>Jeff Johnston
__sinit initialises some common file descriptors as line buffered and relies on the first users of such FDs to call __smakebuf_r. If __smakebuf_r realises there's no space for a buffer (malloc returns NULL), it makes them unbuffered. However, while setting the __SNBF bit, it doesn't clear the __SLBF bit in the flags. Depending on the order in which functions check buffering flags in the FD, sometime they assume it's line buffered (e.g. __sfvwrite_r), trashing application memory that's not really been allocated to them. This patch solves the problem by clearing the unbuffered/line buffered flag when setting the line buffered/unbuffered flag.
2016-10-22Fix a potential buffer overflow in wscanf familyCorinna Vinschen
Fixes Coverity CID 60046 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15Consolidate wctomb/mbtowc calls for POSIX-1.2008Corinna Vinschen
- Remove charset parameter from low level __foo_wctomb/__foo_mbtowc calls. - Instead, create array of function for ISO and Windows codepages to point to function which does not require to evaluate the charset string on each call. Create matching helper functions. I.e., __iso_wctomb, __iso_mbtowc, __cp_wctomb and __cp_mbtowc are functions returning the right function pointer now. - Create __WCTOMB/__MBTOWC macros utilizing per-reent locale and replace calls to __wctomb/__mbtowc with calls to __WCTOMB/__MBTOWC. - Drop global __wctomb/__mbtowc vars. - Utilize aforementioned changes in Cygwin to get rid of charset in other, calling functions and simplify the code. - In Cygwin restrict global cygheap locale info to the job performed by internal_setlocale. Use UTF-8 instead of ASCII on the fly in internal conversion functions. - In Cygwin dll_entry, make sure to initialize a TLS area with a NULL _REENT->_locale pointer. Add comment to explain why. Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15POSIX-1.2008 per-thread locales, groundwork part 2Corinna Vinschen
Move all locale category structure definitions into setlocale.h and remove other headers in locale subdir. Create inline accessor functions for current category struct pointers and use throughout. Use pointers to "C" locale category structs by default in __global_locale. Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-07-04Regenerate newlib MakefilesJon Turney
2016-03-18Feature test macros overhaul: stdio.hYaakov Selkowitz
Throughout, remove references to __STRICT_ANSI__ and use the proper internal macros and versions for C99, POSIX, ATFILE for the various *at functions, or LARGEFILE for fseeko and ftello. [v]asprintf are GNU extensions, but the *iprintf, *iscanf, and *asnprintf functions are unique to newlib. getw and putw were removed from POSIX.1-2001. funopen is BSD, and fopencookie is GNU. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-03-13setvbuf: Drop setting reent->__cleanupCorinna Vinschen
The __sinit call added with 1eb6db6 already sets reent->__cleanup. * libc/stdio/setvbuf.c (setvbuf): Drop setting reent->__cleanup. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-13Update setvbuf to latest OpenBSD implementationCorinna Vinschen
Newlib's setvbuf function is very old and has two bugs: - It sets the SRD/SWR flags incorrectly in case of files opened for reading and writing. See https://cygwin.com/ml/cygwin/2016-03/msg00180.html for a desription of the effect. - It always sets the buffer size to BUFSIZ if it's not provided by the application, independent of the optimal blocksize for the underlying IO device. Update setvbuf to latest code from OpenBSD to fix both problems. * libc/stdio/setvbuf.c (setvbuf): Import latest OpenBSD implementation. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-13Add __swhatbuf function from OpenBSDCorinna Vinschen
To fix a long-standing setvbuf bug, import __swhatbuf function from OpenBSD and only slightly rearrange for newlib. * libc/stdio/local.h (__swhatbuf_r): Declare. * libc/stdio/makebuf (__smakebuf_r): New function. (__smakebuf_r): Drop file handling code and call __smakebuf_r. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-02-08printf(3): Handle multibyte decimal point in field size computationCorinna Vinschen
This patch fixes the problem reported in https://cygwin.com/ml/cygwin/2016-02/msg00014.html The 2009 changes to handle multibyte decimal point and thousands separator missed to take the length of a multibyte decimal point into account when computing the field size. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>