1. 15 7月, 2022 1 次提交
  2. 06 7月, 2022 1 次提交
  3. 11 6月, 2021 1 次提交
  4. 08 1月, 2021 1 次提交
  5. 09 9月, 2020 1 次提交
  6. 13 3月, 2019 1 次提交
    • R
      make FILE a complete type for pre-C11 standard profiles · f368d9fd
      Rich Felker 提交于
      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 13d1afa4, 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.
      f368d9fd
  7. 21 10月, 2016 1 次提交
  8. 17 9月, 2016 1 次提交
  9. 03 5月, 2015 1 次提交
  10. 15 10月, 2014 1 次提交
  11. 14 10月, 2014 1 次提交
  12. 25 11月, 2013 1 次提交
    • R
      restore type of NULL to void * except when used in C++ programs · c8a9c221
      Rich Felker 提交于
      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.)
      c8a9c221
  13. 03 8月, 2013 1 次提交
  14. 23 7月, 2013 1 次提交
    • R
      change wint_t to unsigned · c4dd0c98
      Rich Felker 提交于
      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.
      c4dd0c98
  15. 22 7月, 2013 1 次提交
    • R
      refactor headers, especially alltypes.h, and improve C++ ABI compat · 9448b051
      Rich Felker 提交于
      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
      9448b051
  16. 26 6月, 2013 1 次提交
    • R
      respect iso c namespace in stdio.h and wchar.h regarding va_list · a3e2f3c2
      Rich Felker 提交于
      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.
      a3e2f3c2
  17. 05 4月, 2013 1 次提交
    • R
      eliminate bits/wchar.h · c7af2710
      Rich Felker 提交于
      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.
      c7af2710
  18. 19 1月, 2013 1 次提交
    • R
      use a common definition of NULL as 0L for C and C++ · 41d7c77d
      Rich Felker 提交于
      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.
      41d7c77d
  19. 08 9月, 2012 1 次提交
    • R
      default features: make musl usable without feature test macros · c1a9658b
      Rich Felker 提交于
      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.
      c1a9658b
  20. 07 9月, 2012 1 次提交
    • R
      use restrict everywhere it's required by c99 and/or posix 2008 · 400c5e5c
      Rich Felker 提交于
      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.
      400c5e5c
  21. 02 3月, 2012 1 次提交
  22. 20 9月, 2011 1 次提交
    • R
      fix the type of wchar_t on arm; support wchar_t varying with arch · 224c7a37
      Rich Felker 提交于
      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.
      224c7a37
  23. 04 9月, 2011 1 次提交
    • R
      implement open_wmemstream · 1461e027
      Rich Felker 提交于
      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.
      1461e027
  24. 31 5月, 2011 1 次提交
  25. 30 3月, 2011 1 次提交
  26. 18 3月, 2011 1 次提交
  27. 15 2月, 2011 1 次提交
  28. 12 2月, 2011 1 次提交