[PATCH] D17146: [libcxx] locale portability refactor

Ben Craig via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 11 09:05:12 PST 2016


bcraig created this revision.
bcraig added reviewers: EricWF, jroelofs, howard.hinnant, mclow.lists.
bcraig added subscribers: cfe-commits, joerg, jfb, scshunt.
Herald added subscribers: srhines, danalbert, tberghammer.

Note: This was tested on Linux x86_64 with a host compiler of Clang 3.4 and a glibc standard library.  Attempts were made to test on Cygwin, but it was pretty severely broken prior to this patch.  It is likely that I have accidentally broken other OSes and C libraries.  I'm open to recommendations on ways to test this that are better than "Submit, watch build bots, revert as necessary".

This patch attempts to consolidate the handling of *_l and posix locale management functions into the support headers.  Outside of the support headers, _CXX_* versions of the functions will be called instead.  _CXX_ was chosen as the prefix as it is a reserved name for the "implementation", so we won't conflict with user names.  __* was avoided as a prefix because some C libraries already use __* for internal versions of these functions and structures (e.g. GLIBC has an __locale_t, so we use _CXX_locale_t instead).

This patch also adds a configuration option that I see being useful for embedded users.  Setting LIBCXX_ENABLE_LOCALE_EXTENSIONS to OFF will stub out a lot of the locale functionality in an inline friendly way.

As a consequence of fixing the locale portability headers, some other support headers got rearranged.  Notably, monolothic support headers got split along functionality lines, and helpers for __builtin_* replacements got moved around as well.

http://reviews.llvm.org/D17146

Files:
  CMakeLists.txt
  include/__config
  include/__config_site.in
  include/__locale
  include/algorithm
  include/ctype.h
  include/locale
  include/stdlib.h
  include/support/__builtin_support.h
  include/support/android/locale_bionic.h
  include/support/ibm/locale_mgmt_aix.h
  include/support/ibm/xlocale.h
  include/support/musl/xlocale.h
  include/support/newlib/xlocale.h
  include/support/solaris/xlocale.h
  include/support/win32/builtin_support.h
  include/support/win32/locale_mgmt_win32.h
  include/support/win32/locale_win32.h
  include/support/win32/support.h
  include/support/xlocale/__defaults.h
  include/support/xlocale/__locale_management.h
  include/support/xlocale/__non_bsd_defaults.h
  include/support/xlocale/__non_posix_ctype_defaults.h
  include/support/xlocale/__nop_locale_mgmt.h
  include/support/xlocale/xlocale.h
  src/locale.cpp
  src/support/solaris/xlocale.c
  src/support/win32/locale_win32.cpp
  src/support/win32/support.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17146.47655.patch
Type: text/x-patch
Size: 136848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160211/9a8aaf63/attachment-0001.bin>


More information about the cfe-commits mailing list