#
c8a9c221 |
|
24-Nov-2013 |
Rich Felker <dalias@aerifal.cx> |
restore type of NULL to void * except when used in C++ programs 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.)
|
#
9448b051 |
|
22-Jul-2013 |
Rich Felker <dalias@aerifal.cx> |
refactor headers, especially alltypes.h, and improve C++ ABI compat 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
|
#
b823ef2d |
|
18-Jul-2013 |
Rich Felker <dalias@aerifal.cx> |
fix FILENAME_MAX to match PATH_MAX POSIX is not clear on whether it includes the termination, but ISO C requires that it does. the whole concept of this macro is rather useless, but it's better to be correct anyway.
|
#
a3e2f3c2 |
|
25-Jun-2013 |
Rich Felker <dalias@aerifal.cx> |
respect iso c namespace in stdio.h and wchar.h regarding va_list 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.
|
#
41d7c77d |
|
18-Jan-2013 |
Rich Felker <dalias@aerifal.cx> |
use a common definition of NULL as 0L for C and C++ 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.
|
#
d18a410b |
|
28-Dec-2012 |
Rich Felker <dalias@aerifal.cx> |
expose [v]asprintf under _BSD_SOURCE reported/requested by Strake; simplified from the provided patch
|
#
769fd4ce |
|
03-Dec-2012 |
Rich Felker <dalias@aerifal.cx> |
feature test macros: make _GNU_SOURCE enable everything previously, a few BSD features were enabled only by _BSD_SOURCE, not by _GNU_SOURCE. since _BSD_SOURCE is default in the absence of other feature test macros, this made adding _GNU_SOURCE to a project not a purely additive feature test macro; it actually caused some features to be suppressed. most of the changes made by this patch actually bring musl in closer alignment with the glibc behavior for _GNU_SOURCE. the only exceptions are the added visibility of functions like strlcpy which were BSD-only due to being disliked/rejected by glibc maintainers. here, I feel the consistency of having _GNU_SOURCE mean "everything", and especially the property of it being purely additive, are more valuable than hiding functions which glibc does not have.
|
#
c1a9658b |
|
07-Sep-2012 |
Rich Felker <dalias@aerifal.cx> |
default features: make musl usable without feature test macros 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.
|
#
400c5e5c |
|
06-Sep-2012 |
Rich Felker <dalias@aerifal.cx> |
use restrict everywhere it's required by c99 and/or posix 2008 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.
|
#
9bff7c13 |
|
25-Aug-2012 |
Rich Felker <dalias@aerifal.cx> |
implement "low hanging fruit" from C11 based on Gregor's patch sent to the list. includes: - stdalign.h - removing gets in C11 mode - adding aligned_alloc and adjusting other functions to use it - adding 'x' flag to fopen for exclusive mode
|
#
61718273 |
|
11-Aug-2012 |
Rich Felker <dalias@aerifal.cx> |
add bsd fgetln function optimized to avoid allocation and return lines directly out of the stream buffer whenever possible.
|
#
25b88f08 |
|
03-Jul-2012 |
Rich Felker <dalias@aerifal.cx> |
add prototypes for getw/putw
|
#
3b94daba |
|
04-Jun-2012 |
Rich Felker <dalias@aerifal.cx> |
_GNU_SOURCE is supposed to imply _LARGEFILE64_SOURCE this is ugly and stupid, but now that the *64 symbol names exist, a lot of broken GNU software detects them in configure, then either breaks during build due to missing off64_t definition, or attempts to compile without function declarations/prototypes. "fixing" it here is easier than telling everyone to add yet another feature test macro to their builds.
|
#
a34b0465 |
|
28-May-2012 |
Rich Felker <dalias@aerifal.cx> |
there is no such GNU function fpurge, only __fpurge. no idea where I got the idea fpurge should exist...
|
#
b63cab76 |
|
28-May-2012 |
Rich Felker <dalias@aerifal.cx> |
add prototype for BSD/GNU stdio *_unlocked extension functions also fix up distinction of what is GNU-only and what's GNU+BSD
|
#
15c7af3e |
|
28-May-2012 |
Rich Felker <dalias@aerifal.cx> |
remove duplicate lfs64 cruft in stdio.h
|
#
419ae6d5 |
|
22-May-2012 |
Rich Felker <dalias@aerifal.cx> |
support _BSD_SOURCE feature test macro patch by Isaac Dunham. matched closely (maybe not exact) to glibc's idea of what _BSD_SOURCE should make visible.
|
#
2dd8d5e1 |
|
03-May-2012 |
Rich Felker <dalias@aerifal.cx> |
add support for ugly *64 functions with _LARGEFILE64_SOURCE musl does not support legacy 32-bit-off_t whatsoever. off_t is always 64 bit, and correct programs that use off_t and the standard functions will just work out of the box. (on glibc, they would require -D_FILE_OFFSET_BITS=64 to work.) however, some programs instead define _LARGEFILE64_SOURCE and use alternate versions of all the standard types and functions with "64" appended to their names. we do not want code to actually get linked against these functions (it's ugly and inconsistent), so macros are used instead of prototypes with weak aliases in the library itself. eventually the weak aliases may be added at the library level for the sake of using code that was originally built against glibc, but the macros will still be the desired solution in the headers.
|
#
ce17ea6f |
|
11-Sep-2011 |
Rich Felker <dalias@aerifal.cx> |
add prototypes for GNU *_unlocked stdio functions actually these are just weak aliases for the normal locking versions right now, and they will probably stay that way since making them lock-free without slowing down the normal versions would require significant code duplication for no benefit.
|
#
d4fa6f0e |
|
03-Sep-2011 |
Rich Felker <dalias@aerifal.cx> |
implement fmemopen testing so far has been minimal. may need further work.
|
#
b158b32a |
|
02-Sep-2011 |
Rich Felker <dalias@aerifal.cx> |
implement open_memstream this is the first attempt, and may have bugs. only minimal testing has been performed.
|
#
7640497f |
|
30-Jun-2011 |
Rich Felker <dalias@aerifal.cx> |
implement the nonstandard GNU function fpurge this is a really ugly and backwards function, but its presence will prevent lots of broken gnulib software from trying to define its own version of fpurge and thereby failing to build or worse.
|
#
e7218008 |
|
04-Apr-2011 |
Rich Felker <dalias@aerifal.cx> |
add more legacy functions: setlinebuf and setbuffer
|
#
46b99426 |
|
20-Feb-2011 |
Rich Felker <dalias@aerifal.cx> |
prototypes for GNU asprintf/vasprintf
|
#
571312de |
|
15-Feb-2011 |
Rich Felker <dalias@aerifal.cx> |
move stdio stuff that's not arch-specific out of bits
|
#
80695b1d |
|
14-Feb-2011 |
Rich Felker <dalias@aerifal.cx> |
begin namespace-cleanup of standard C headers
|
#
0b44a031 |
|
11-Feb-2011 |
Rich Felker <dalias@aerifal.cx> |
initial check-in, version 0.5.0
|