about summary refs log tree commit diff
path: root/include/wchar.h
Commit message (Collapse)AuthorAgeFilesLines
* make FILE a complete type for pre-C11 standard profilesRich Felker2019-03-121-0/+4
| | | | | | | | | | | | | | | | | | | | C11 removed the requirement that FILE be a complete type, which was deemed erroneous, as part of the changes introduced by N1439 regarding completeness of types (see footnote 6 for specific mention of FILE). however the current version of POSIX is still based on C99 and incorporates the old requirement that FILE be a complete type. expose an arbitrary, useless complete type definition because the actual object used to represent FILE streams cannot be public/ABI. thanks to commit 13d1afa46f8098df290008c681816c9eb89ffbdb, we now have a framework for suppressing the public complete-type definition of FILE when stdio.h is included internally, so that a different internal definition can be provided. this is perfectly well-defined, since the same struct tag can refer to different types in different translation units. it would be a problem if the implementation were accessing the application's FILE objects or vice versa, but either would be undefined behavior.
* remove parameter names from public headersRich Felker2016-10-201-2/+2
| | | | | inclusion of these names was unintentional and in most cases is a namespace violation. Daniel Sabogal tracked down and reported these.
* add missing *_unlocked and wcsftime_l prototypes to wchar.hDaniel Sabogal2016-09-161-0/+15
| | | | these functions had been implemented, but prototypes were not made available
* improve iswdigit macro to diagnose errorsRich Felker2015-05-021-1/+1
| | | | | this is analogous to commit 2ca55a93f2a11185d72dcb69006fd2c30b5c3144 for the macros in ctype.h.
* suppress macro definitions of ctype functions under C++Rich Felker2014-10-141-0/+3
| | | | based on patch by Sergey Dmitrouk.
* implement uchar.h (C11 UTF-16/32 conversion) interfacesRich Felker2014-10-131-5/+1
|
* restore type of NULL to void * except when used in C++ programsRich Felker2013-11-241-0/+4
| | | | | | | | | | | | | | unfortunately this eliminates the ability of the compiler to diagnose some dangerous/incorrect usage, but POSIX requires (as an extension to the C language, i.e. CX shaded) that NULL have type void *. plain C allows it to be defined as any null pointer constant. the definition 0L is preserved for C++ rather than reverting to plain 0 to avoid dangerous behavior in non-conforming programs which use NULL as a variadic sentinel. (it's impossible to use (void *)0 for C++ since C++ lacks the proper implicit pointer conversions, and other popular alternatives like the GCC __null extension seem non-conforming to the standard's requirements.)
* fix feature test macro logic for _BSD_SOURCERich Felker2013-08-021-4/+4
| | | | | | in several places, _BSD_SOURCE was not even implying POSIX, resulting in it being subtractive rather than additive (compared to the default features).
* change wint_t to unsignedRich Felker2013-07-221-1/+1
| | | | | | | | | | | | aside from the obvious C++ ABI purpose for this change, it also brings musl into alignment with the compiler's idea of the definition of wint_t (use in -Wformat), and makes the situation less awkward on ARM, where wchar_t is unsigned. internal code using wint_t and WEOF was checked against this change, and while a few cases of storing WEOF into wchar_t were found, they all seem to operate properly with the natural conversion from unsigned to signed.
* refactor headers, especially alltypes.h, and improve C++ ABI compatRich Felker2013-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the arch-specific bits/alltypes.h.sh has been replaced with a generic alltypes.h.in and minimal arch-specific bits/alltypes.h.in. this commit is intended to have no functional changes except: - exposing additional symbols that POSIX allows but does not require - changing the C++ name mangling for some types - fixing the signedness of blksize_t on powerpc (POSIX requires signed) - fixing the limit macros for sig_atomic_t on x86_64 - making dev_t an unsigned type (ABI matching goal, and more logical) in addition, some types that were wrongly defined with long on 32-bit archs were changed to int, and vice versa; this change is non-functional except for the possibility of making pointer types mismatch, and only affects programs that were using them incorrectly, and only at build-time, not runtime. the following changes were made in the interest of moving non-arch-specific types out of the alltypes system and into the headers they're associated with, and also will tend to improve application compatibility: - netdb.h now includes netinet/in.h (for socklen_t and uint32_t) - netinet/in.h now includes sys/socket.h and inttypes.h - sys/resource.h now includes sys/time.h (for struct timeval) - sys/wait.h now includes signal.h (for siginfo_t) - langinfo.h now includes nl_types.h (for nl_item) for the types in stdint.h: - types which are of no interest to other headers were moved out of the alltypes system. - fast types for 8- and 64-bit are hard-coded (at least for now); only the 16- and 32-bit ones have reason to vary by arch. and the following types have been changed for C++ ABI purposes; - mbstate_t now has a struct tag, __mbstate_t - FILE's struct tag has been changed to _IO_FILE - DIR's struct tag has been changed to __dirstream - locale_t's struct tag has been changed to __locale_struct - pthread_t is defined as unsigned long in C++ mode only - fpos_t now has a struct tag, _G_fpos64_t - fsid_t's struct tag has been changed to __fsid_t - idtype_t has been made an enum type (also required by POSIX) - nl_catd has been changed from long to void * - siginfo_t's struct tag has been removed - sigset_t's has been given a struct tag, __sigset_t - stack_t has been given a struct tag, sigaltstack - suseconds_t has been changed to long on 32-bit archs - [u]intptr_t have been changed from long to int rank on 32-bit archs - dev_t has been made unsigned summary of tests that have been performed against these changes: - nsz's libc-test (diff -u before and after) - C++ ABI check symbol dump (diff -u before, after, glibc) - grepped for __NEED, made sure types needed are still in alltypes - built gcc 3.4.6
* respect iso c namespace in stdio.h and wchar.h regarding va_listRich Felker2013-06-251-7/+8
| | | | | | | | | | despite declaring functions that take arguments of type va_list, these headers are not permitted by the c standard to expose the definition of va_list, so an alias for the type must be used. the name __isoc_va_list was chosen to convey that the purpose of this alternate name is for iso c conformance, and to avoid the multitude of names which gcc mangles with its hideous "fixincludes" monstrosity, leading to serious header breakage if these "fixes" are run.
* eliminate bits/wchar.hRich Felker2013-04-041-1/+7
| | | | | | | the preprocessor can reliably determine the signedness of wchar_t. L'\0' is used for 0 in the expressions so that, if the underlying type of wchar_t is long rather than int, the promoted type of the expression will match the type of wchar_t.
* use a common definition of NULL as 0L for C and C++Rich Felker2013-01-181-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the historical mess of having different definitions for C and C++ comes from the historical C definition as (void *)0 and the fact that (void *)0 can't be used in C++ because it does not convert to other pointer types implicitly. however, using plain 0 in C++ exposed bugs in C++ programs that call variadic functions with NULL as an argument and (wrongly; this is UB) expect it to arrive as a null pointer. on 64-bit machines, the high bits end up containing junk. glibc dodges the issue by using a GCC extension __null to define NULL; this is observably non-conforming because a conforming application could observe the definition of NULL via stringizing and see that it is neither an integer constant expression with value zero nor such an expression cast to void. switching to 0L eliminates the issue and provides compatibility with broken applications, since on all musl targets, long and pointers have the same size, representation, and argument-passing convention. we could maintain separate C and C++ definitions of NULL (i.e. just use 0L on C++ and use (void *)0 on C) but after careful analysis, it seems extremely difficult for a C program to even determine whether NULL has integer or pointer type, much less depend in subtle, unintentional ways, on whether it does. C89 seems to have no way to make the distinction. on C99, the fact that (int)(void *)0 is not an integer constant expression, along with subtle VLA/sizeof semantics, can be used to make the distinction, but many compilers are non-conforming and give the wrong result to this test anyway. on C11, _Generic can trivially make the distinction, but it seems unlikely that code targetting C11 would be so backwards in caring which definition of NULL an implementation uses. as such, the simplest path of using the same definition for NULL in both C and C++ was chosen. the #undef directive was also removed so that the compiler can catch and give a warning or error on redefinition if buggy programs have defined their own versions of NULL prior to inclusion of standard headers.
* default features: make musl usable without feature test macrosRich Felker2012-09-071-5/+1
| | | | | | | | | | the old behavior of exposing nothing except plain ISO C can be obtained by defining __STRICT_ANSI__ or using a compiler option (such as -std=c99) that predefines it. the new default featureset is POSIX with XSI plus _BSD_SOURCE. any explicit feature test macros will inhibit the default. installation docs have also been updated to reflect this change.
* use restrict everywhere it's required by c99 and/or posix 2008Rich Felker2012-09-061-40/+46
| | | | | | | | to deal with the fact that the public headers may be used with pre-c99 compilers, __restrict is used in place of restrict, and defined appropriately for any supported compiler. we also avoid the form [restrict] since older versions of gcc rejected it due to a bug in the original c99 standard, and instead use the form *restrict.
* add all missing wchar functions except floating point parsersRich Felker2012-03-011-0/+15
| | | | | these are mostly untested and adapted directly from corresponding byte string functions and similar.
* fix the type of wchar_t on arm; support wchar_t varying with archRich Felker2011-09-191-6/+2
| | | | | | | | | | | | | | really wchar_t should never vary, but the ARM EABI defines it as an unsigned 32-bit int instead of a signed one, and gcc follows this nonsense. thus, to give a conformant environment, we have to follow (otherwise L""[0] and L'\0' would be 0U rather than 0, but the application would be unaware due to a mismatched definition for WCHAR_MIN and WCHAR_MAX, and Bad Things could happen with respect to signed/unsigned comparisons, promotions, etc.). fortunately no rules are imposed by the C standard on the relationship between wchar_t and wint_t, and WEOF has type wint_t, so we can still make wint_t always-signed and use -1 for WEOF.
* implement open_wmemstreamRich Felker2011-09-031-0/+1
| | | | | | not heavily tested, but it seems to be correct, including the odd behavior that seeking is in terms of wide character count. this precludes any simple buffering, so we just make the stream unbuffered.
* missing prototypes for mbsnrtowcs and wcsnrtombsRich Felker2011-05-301-0/+6
|
* missing prototype for wcscoll (stub)Rich Felker2011-03-291-0/+1
|
* implement [v]swprintfRich Felker2011-03-181-2/+2
|
* more header fixes, minor warning fixRich Felker2011-02-141-4/+12
|
* initial check-in, version 0.5.0 v0.5.0Rich Felker2011-02-121-0/+152