summaryrefslogtreecommitdiffstats
path: root/newlib/libc/include
Commit message (Collapse)AuthorAgeFilesLines
* stdio.h: Don't define unlocked macros using static inline on C++cygwin-2_9_0-releaseCorinna Vinschen2017-09-041-1/+1
| | | | | | | | | | | | In C++, the usage of static inline functions for getchar_unlocked and putchar_unlocked may result in error messages like error: ‘_putchar_unlocked’ was not declared in this scope Fix this by not using the _getchar_unlocked and _putchar_unlocked macros in C++. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* include: fix ffs, fls guardsYaakov Selkowitz2017-08-301-2/+4
| | | | Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Port strnstr.c to newlib.Sichen Zhao2017-08-251-0/+3
|
* Revert "headers: avoid bareword attributes" for clangEric Blake2017-08-251-14/+16
| | | | | | | | | | | | | | | This reverts most of commit 979d467ff6e39ee5c52cf1aac7a6c9c63058141c. We cannot avoid some bareword attributes until clang is fixed to properly support __-decorated attributes; see this bug: https://bugs.llvm.org/show_bug.cgi?id=34319 The macros in question expand to the empty string under gcc, so only compilation under clang is affected, and since clang has the bug, the obvious solution is to roll back the changes, and document the issue. Signed-off-by: Eric Blake <eblake@redhat.com>
* Make _CLOCK_T_ system configurableSebastian Huber2017-08-251-0/+3
| | | | | | | Let systems optionally provide the _CLOCK_T_ type via <machine/_types.h>. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* cygwin: Implement renameat2Ken Brown2017-08-191-0/+3
| | | | | | Define the RENAME_NOREPLACE flag in <cygwin/fs.h> as defined on Linux in <linux/fs.h>. The other RENAME_* flags defined on Linux are not supported.
* headers: avoid bareword attributesEric Blake2017-08-171-14/+14
| | | | | | | | | Always use the __-decorated form of an attribute name in public headers, as the bareword form is in the user's namespace, and we don't want compilation to break just because the user defines the bareword to mean something else. Signed-off-by: Eric Blake <eblake@redhat.com>
* Add RISC-V port for newlibKito Cheng2017-08-164-2/+15
| | | | | | | | Contributor list: - Andrew Waterman <andrew@sifive.com> - Palmer Dabbelt <palmer@dabbelt.com> - Kito Cheng <kito.cheng@gmail.com> - Scott Beamer <sbeamer@eecs.berkeley.edu>
* Define sigsetjmp/siglongjmp only if __POSIX_VISIBLEKen Brown2017-08-071-2/+2
|
* Proper locking for getchar() and putchar()Sebastian Huber2017-08-071-7/+32
| | | | | | | | | | | | | Add internal inline functions _getchar_unlocked() and _putchar_unlocked() if __CUSTOM_FILE_IO__ is not defined. These functions get _REENT only once. Use them for getchar_unlocked() and putchar_unlocked(). Define getchar() and putchar() to these unlocked internal functions if __SINGLE_THREAD__ is defined, otherwise use the external functions to use proper locking of the FILE object. Assumes that __SINGLE_THREAD__ is not defined if __CYGWIN__ is defined. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Importing wcstoumax inttypes method from FreeBSD.Aditya Upadhyay2017-08-021-0/+2
|
* Importing wcstoimax inttypes method from FreeBSD.Aditya Upadhyay2017-08-021-0/+2
|
* Importing strtoumax inttypes method from FreeBSD.Aditya Upadhyay2017-08-021-0/+2
|
* Importing strtoimax inttypes method from FreeBSD.Aditya Upadhyay2017-08-021-0/+12
|
* Add elf.h to newlibYaakov Selkowitz2017-08-021-0/+3146
| | | | | | | This is copied from musl (MIT license). This is newer and more thorough than that of FreeBSD currently shipped only on Cygwin. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* cygwin: Set __STDC_ISO_10646__ to Unicode 5.2 valueCorinna Vinschen2017-07-261-4/+3
| | | | | | Now that XP is not supported anymore we can freely do that. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* MSP430: Define __BUFSIZ__ as 256 to prevent default of 1024 being usednewlib-snapshot-20170720Jozef Lawrynowicz2017-07-201-0/+1
|
* Rename __in and __out in headers to avoid collision with Windows APIsDavid Macek2017-07-071-9/+9
| | | | | * string.h: Local variables in expansion of strdupa and strndupa * sys/wait.h: Fields in anonymous union in expansion of __wait_status_to_int
* Fixed warnings for some long double complex methodsAditya Upadhyay2017-07-051-5/+5
|
* Synchronize <strings.h> with latest FreeBSDSebastian Huber2017-07-052-59/+62
| | | | | | | | | | Include <strings.h> in <string.h> if __BSD_VISIBLE like on FreeBSD. Remove redundant declarations from <string.h>. Make ffsl(), ffsll(), strncasecmp(), strcasecmp_l(), and strncasecmp_l() visible via __BSD_VISIBLE instead of __GNU_VISIBLE. Add fls(), flsl(), and flsll() to <strings.h> if __BSD_VISIBLE. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Feature test macros overhaul: unistd.h, part 2cygwin-2_8_1-releaseYaakov Selkowitz2017-06-301-4/+17
| | | | | | | This fixes commit f70aad3de4d845f8b720010a2f8817db842d81e8 as well as some other functions which were never properly guarded. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Add --enable-newlib-global-stdio-streamsSebastian Huber2017-06-301-0/+6
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Enable _REENT_GLOBAL_STDIO_STREAMS for RTEMSSebastian Huber2017-06-301-0/+1
| | | | Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
* Introduce _REENT_GLOBAL_STDIO_STREAMSSebastian Huber2017-06-301-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* unistd.h: Remove trailing whitespaceDionna Glaze2017-06-291-1/+1
|
* unistd.h: remove mktempCorinna Vinschen2017-06-291-1/+0
| | | | | | mktemp is already correctly declared in stdlib.h Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Make gethostname, getdtablesize, mktemp, ualarm available in BSD, ↵Dionna Glaze2017-06-291-2/+5
| | | | XOPEN_SOURCE >= 500.
* string: add strverscmpYaakov Selkowitz2017-06-191-0/+4
| | | | | | The actual implementation is from musl (MIT license). Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Fix guard for siginfo_t and pthread_t definitionThomas Preud'homme2017-06-192-8/+12
| | | | | | | | | | | | | Commit 8a3b3bb4d7224d419cc1a4af60ccf7e70edc876b changed the guard on some functions from _POSIX_THREADS to __POSIX_VISIBLE. As a consequence, some use of siginfo_t and pthread_t became visible under configurations where _POSIX_THREADS is unset but __POSIX_VISIBLE is. Build then fails because the definition of those types are still unavailable. This commit make those type definition visible for __POSIX_VISIBLE configurations. This requires moving the siginfo_t definition out of the RTEMS specific definitions in sys/signal.h while still guarding it against cygwin case.
* Export XSI sigpauseYaakov Selkowitz2017-06-141-1/+13
| | | | | | | | | | There are two common sigpause variants, both of which take an int argument. If you request _XOPEN_SOURCE or _GNU_SOURCE, you get the System V version, which removes the given signal from the process's signal mask; otherwise you get the BSD version, which sets the process's signal mask to the given value. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Feature test macros overhaul: signal.h (part 3)Yaakov Selkowitz2017-06-141-8/+16
| | | | | | | Notably, sigaction and friends are POSIX, but the form of sigpause currently provided is BSD. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* stdio.h: guard function macros with !__cplusplusYaakov Selkowitz2017-06-141-0/+2
| | | | | | | | While POSIX allows these functions to also be defined as macros in C, in C++ this is not allowed, and prevents these names (particularly feof) from being used in a custom namespace. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
* Remove legacy unions which are no longer usedJeff Johnston2017-04-171-23/+0
| | | | - remove __fmath, __dmath, and __ldmath unions
* Add BSD-specific reallocarray()Sebastian Huber2017-04-041-0/+2
| | | | | It is available in FreeBSD, NetBSD and OpenBSD, but not in glibc. It is used for example by OpenSSH.
* Renumber copyright clause 4imp2017-04-041-1/+1
| | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96
* queue.3: Document existing QMD_* macroscem2017-04-041-0/+39
| | | | | | Feedback from: bapt, bdrewery, emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D3983
* queue(3): Enhance queue debugging macroscem2017-04-041-5/+37
| | | | | | | | | | | | | Split the QUEUE_MACRO_DEBUG into QUEUE_MACRO_DEBUG_TRACE and QUEUE_MACRO_DEBUG_TRASH. Add the debug macrso QMD_IS_TRASHED() and QMD_SLIST_CHECK_PREVPTR(). Document these in queue.3. Reviewed by: emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D3984
* Add two new macros, SLIST_CONCAT and LIST_CONCATmckusick2017-04-041-2/+36
| | | | | | | | | Add two new macros, SLIST_CONCAT and LIST_CONCAT. Note in both the queue.h header file and in the queue.3 manual page that they are O(n) so should be used only in low-usage paths with short lists (otherwise an STAILQ or TAILQ should be used). Reviewed by: kib
* Make the <sys/queue.h> fully usable within C++hselasky2017-04-041-14/+73
| | | | | | | | | | | | | | | | | | Make the system queue header file fully usable within C++ programs by adding macros to define class lists. This change is backwards compatible for all use within C and C++ programs. Only C++ programs will have added support to use the queue macros within classes. Previously the queue macros could only be used within structures. The queue.3 manual page has been updated to describe the new functionality and some alphabetic sorting has been done while at it. Differential Revision: https://reviews.freebsd.org/D2745 PR: 200827 (exp-run) MFC after: 2 weeks
* Pass macro arguments properly.hselasky2017-04-041-2/+2
| | | | MFC after: 1 week
* Fix order of arguments in the TRACEBUF_INITIALIZERhselasky2017-04-041-1/+1
| | | | | | | Fix order of arguments in the TRACEBUF_INITIALIZER macro so that we can define QUEUE_MACRO_DEBUG to debug list problems. MFC after: 1 week
* Add new FOREACH_FROM variants for queue(3)lstewart2017-04-041-0/+53
| | | | | | | | | | | | | Add new FOREACH_FROM variants of the queue(3) FOREACH macros which can optionally start the traversal from a previously found element by passing the element in as "var". Passing a NULL "var" retains the same semantics as the regular FOREACH macros. Kudos to phk for suggesting the "FROM" suffix instead of my original proposal. Reviewed by: jhb (previous version), rpaulo MFC after: 1 week
* Renumber copyright clause 4imp2017-04-041-1/+1
| | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96
* don't use C99 static array indices with older GCC versionsavg2017-04-041-0/+1
| | | | | | | | | | | | | | For example, the FreeBSD GCC (4.2.1) has a spotty support for that feature. If the static keyword is used with an unnamed array parameter in a function declaration, then the compilation fails with: error: static or type qualifiers in abstract declarator The feature does work if the parameter is named. So, the restriction introduced in this commit can be removed when all affected function prototypes have the workaround. MFC after: 1 week Sponsored by: Panzura
* Addition of clang nullability qualifiers.pfg2017-04-041-0/+7
| | | | | | | | | | | | | | | For consistency with the qualifiers added in r310977, define a new qualifier _Null_unspecified which is also defined in clang 3.7+. Add two new macros: __NULLABILITY_PRAGMA_PUSH __NULLABILITY_PRAGMA_POP These are for use in headers when we want avoid noisy warnings if some pointers are left without nullability annotations. These are added with way ahead of their first use to teach the GCC ports headers of their existance before their first use.
* Remove unused __gnu_inline() attribute.pfg2017-04-041-16/+0
| | | | | | | | | | | | This was meant to be used by a future FORTIFY_SOURCE implementation. Probably for good, FORTIFY_SOURCE and this particular GCCism were never well supported by clang or other compilers. Furthermore, the technology has long since been replaced by either static checkers, sanitizers, or even just the strong stack protector that was enabled by default. Drop __gnu_inline to avoid cluttering the headers. MFC after: 5 days
* Addition of clang nullability qualifiers.pfg2017-04-041-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | Add two new qualifiers for use by the static checkers: _Nonnull The _Nonnull nullability qualifier indicates that null is not a meaningful value for a value of the _Nonnull pointer type. _Nullable The _Nullable nullability qualifier indicates that a value of the _Nullable pointer type can be null. These were introduced in Clang 3.7. For more information, see: http://clang.llvm.org/docs/AttributeReference.html#nonnull We add these now without using them so that the GCC ports have time to pick up the header change. Hinted by: Android Bionic libc [1] Also seen in: Apple's Libc-1158.20.4 [1] https://github.com/android/platform_bionic/commit/baa2a973bd776a51bb05a8590ab05d86eea7b321
* Fix C++ includability of crypto headers with static array sizesasomers2017-04-041-0/+14
| | | | | | | | | | | | | | | | | | | | | | C99 allows array function parameters to use the static keyword for their sizes. This tells the compiler that the parameter will have at least the specified size, and calling code will fail to compile if that guarantee is not met. However, this syntax is not legal in C++. This commit reverts r300824, which worked around the problem for sys/md5.h only, and introduces a new macro: min_size(). min_size(x) can be used in headers as a static array size, but will still compile in C++ mode. Reviewed by: cem, ed MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8277 fix a typo in __STDC_VERSION__ in __min_size requirements MFC after: 1 week Sponsored by: Panzura
* Stop exposing the C11 _Atomic() macro in <sys/cdefs.h>, when compiling for C++.dim2017-04-041-1/+2
| | | | | | | | | | | It clashes with the one in libc++'s <atomic> header. (Previously, the _Atomic() macro was defined in <stdatomic.h>, which is only for use with C11, but for various reasons it was moved to its current location in r251804.) Discussed with: bdrewery, ed MFC after: 2 weeks
* Rename __sentinel to __null_sentinelpfg2017-04-041-2/+2
| | | | | | GCC 5 uses a conflicting __sentinel definition in include/c++/bits/stl_algo.h Reported by: matteo