diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml index 184fed2268e81..58427421a3739 100644 --- a/.github/workflows/libcxx-build-and-test.yaml +++ b/.github/workflows/libcxx-build-and-test.yaml @@ -47,209 +47,21 @@ env: jobs: - stage1: - if: github.repository_owner == 'llvm' - runs-on: libcxx-runners-8-set - continue-on-error: false - strategy: - fail-fast: false - matrix: - config: [ - 'generic-cxx03', - 'generic-cxx26', - 'generic-modules' - ] - cc: [ 'clang-19' ] - cxx: [ 'clang++-19' ] - include: - - config: 'generic-gcc' - cc: 'gcc-14' - cxx: 'g++-14' - steps: - - uses: actions/checkout@v4 - - name: ${{ matrix.config }}.${{ matrix.cxx }} - run: libcxx/utils/ci/run-buildbot ${{ matrix.config }} - env: - CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 - if: always() - with: - name: ${{ matrix.config }}-${{ matrix.cxx }}-results - path: | - **/test-results.xml - **/*.abilist - **/CMakeError.log - **/CMakeOutput.log - **/crash_diagnostics/* - stage2: - if: github.repository_owner == 'llvm' - runs-on: libcxx-runners-8-set - needs: [ stage1 ] - continue-on-error: false - strategy: - fail-fast: false - matrix: - config: [ - 'generic-cxx11', - 'generic-cxx14', - 'generic-cxx17', - 'generic-cxx20', - 'generic-cxx23' - ] - cc: [ 'clang-19' ] - cxx: [ 'clang++-19' ] - include: - - config: 'generic-gcc-cxx11' - cc: 'gcc-14' - cxx: 'g++-14' - - config: 'generic-cxx23' - cc: 'clang-17' - cxx: 'clang++-17' - - config: 'generic-cxx26' - cc: 'clang-18' - cxx: 'clang++-18' - steps: - - uses: actions/checkout@v4 - - name: ${{ matrix.config }} - run: libcxx/utils/ci/run-buildbot ${{ matrix.config }} - env: - CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 - if: always() # Upload artifacts even if the build or test suite fails - with: - name: ${{ matrix.config }}-${{ matrix.cxx }}-results - path: | - **/test-results.xml - **/*.abilist - **/CMakeError.log - **/CMakeOutput.log - **/crash_diagnostics/* - stage3: - if: github.repository_owner == 'llvm' - needs: [ stage1, stage2 ] - continue-on-error: false - strategy: - fail-fast: false - max-parallel: 8 - matrix: - config: [ - 'generic-abi-unstable', - 'generic-hardening-mode-debug', - 'generic-hardening-mode-extensive', - 'generic-hardening-mode-fast', - 'generic-hardening-mode-fast-with-abi-breaks', - 'generic-merged', - 'generic-modules-lsv', - 'generic-no-exceptions', - 'generic-no-experimental', - 'generic-no-filesystem', - 'generic-no-localization', - 'generic-no-terminal', - 'generic-no-random_device', - 'generic-no-threads', - 'generic-no-tzdb', - 'generic-no-unicode', - 'generic-no-wide-characters', - 'generic-no-rtti', - 'generic-optimized-speed', - 'generic-static', - # TODO Find a better place for the benchmark and bootstrapping builds to live. They're either very expensive - # or don't provide much value since the benchmark run results are too noise on the bots. - 'benchmarks', - 'bootstrapping-build' - ] - machine: [ 'libcxx-runners-8-set' ] - include: - - config: 'generic-cxx26' - machine: libcxx-runners-8-set - - config: 'generic-asan' - machine: libcxx-runners-8-set - - config: 'generic-tsan' - machine: libcxx-runners-8-set - - config: 'generic-ubsan' - machine: libcxx-runners-8-set - # Use a larger machine for MSAN to avoid timeout and memory allocation issues. - - config: 'generic-msan' - machine: libcxx-runners-8-set - runs-on: ${{ matrix.machine }} - steps: - - uses: actions/checkout@v4 - - name: ${{ matrix.config }} - run: libcxx/utils/ci/run-buildbot ${{ matrix.config }} - env: - CC: clang-19 - CXX: clang++-19 - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 - if: always() - with: - name: ${{ matrix.config }}-results - path: | - **/test-results.xml - **/*.abilist - **/CMakeError.log - **/CMakeOutput.log - **/crash_diagnostics/* - - macos: - needs: [ stage1 ] - strategy: - fail-fast: false - matrix: - include: - - config: generic-cxx03 - os: macos-latest - - config: generic-cxx23 - os: macos-latest - - config: generic-modules - os: macos-latest - - config: apple-configuration - os: macos-latest - - config: apple-system - os: macos-13 - - config: apple-system-hardened - os: macos-13 - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: 'latest' - - uses: seanmiddleditch/gha-setup-ninja@master - - name: Build and test - run: | - python3 -m venv .venv - source .venv/bin/activate - python -m pip install psutil - bash libcxx/utils/ci/run-buildbot ${{ matrix.config }} - - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 - if: always() # Upload artifacts even if the build or test suite fails - with: - name: macos-${{ matrix.config }}-results - path: | - **/test-results.xml - **/*.abilist - **/CMakeError.log - **/CMakeOutput.log - **/crash_diagnostics/* - windows: runs-on: windows-2022 - needs: [ stage1 ] strategy: fail-fast: false matrix: include: - { config: clang-cl-dll, mingw: false } - - { config: clang-cl-static, mingw: false } - - { config: clang-cl-no-vcruntime, mingw: false } - - { config: clang-cl-debug, mingw: false } - - { config: clang-cl-static-crt, mingw: false } - - { config: mingw-dll, mingw: true } - - { config: mingw-static, mingw: true } - - { config: mingw-dll-i686, mingw: true } - - { config: mingw-incomplete-sysroot, mingw: true } + # - { config: clang-cl-static, mingw: false } + # - { config: clang-cl-no-vcruntime, mingw: false } + # - { config: clang-cl-debug, mingw: false } + # - { config: clang-cl-static-crt, mingw: false } + # - { config: mingw-dll, mingw: true } + # - { config: mingw-static, mingw: true } + # - { config: mingw-dll-i686, mingw: true } + # - { config: mingw-incomplete-sysroot, mingw: true } steps: - uses: actions/checkout@v4 - name: Install dependencies diff --git a/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h b/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h index e88eb4fa41d7a..e0c0b88d37ff6 100644 --- a/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h +++ b/libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h @@ -27,7 +27,9 @@ #define __libcpp_mbrtowc_l(pwc, s, n, ps, l) mbrtowc_l(pwc, s, n, ps, l) #define __libcpp_mbtowc_l(pwc, pmb, max, l) mbtowc_l(pwc, pmb, max, l) #define __libcpp_mbrlen_l(s, n, ps, l) mbrlen_l(s, n, ps, l) -#define __libcpp_localeconv_l(l) localeconv_l(l) +inline _LIBCPP_HIDE_FROM_ABI lconv* __libcpp_localeconv_l(locale_t __loc) { + return localeconv_l(__loc); +} #define __libcpp_mbsrtowcs_l(dest, src, len, ps, l) mbsrtowcs_l(dest, src, len, ps, l) #define __libcpp_snprintf_l(...) snprintf_l(__VA_ARGS__) #define __libcpp_asprintf_l(...) asprintf_l(__VA_ARGS__) diff --git a/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h b/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h index ae2db6ae70beb..e5195bed228fb 100644 --- a/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h +++ b/libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h @@ -79,6 +79,7 @@ inline _LIBCPP_HIDE_FROM_ABI size_t __libcpp_mbrlen_l(const char* __s, size_t __ #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS inline _LIBCPP_HIDE_FROM_ABI lconv* __libcpp_localeconv_l(locale_t __l) { + fprintf(stderr, "Entering __libcpp_localeconv_l() in bsd_locale_fallbacks.h\n"); __locale_guard __current(__l); return localeconv(); } diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp index 99a2d50f207ed..9553027cc0e60 100644 --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -150,7 +150,11 @@ class _LIBCPP_HIDDEN locale::__imp : public facet { void install(facet* f, long id); template void install(F* f) { - install(f, f->id.__get()); + std::fprintf(stderr, "Entering install(Facet*)\n"); + long id = f->id.__get(); + + std::fprintf(stderr, "Calling install(Facet*, long id)\n"); + install(f, id); } template void install_from(const __imp& other); @@ -219,63 +223,78 @@ locale::__imp::__imp(size_t refs) : facet(refs), facets_(N), name_("C") { } locale::__imp::__imp(const string& name, size_t refs) : facet(refs), facets_(N), name_(name) { + std::fprintf(stderr, "Entering __imp(string const&) constructor\n"); #if _LIBCPP_HAS_EXCEPTIONS try { #endif // _LIBCPP_HAS_EXCEPTIONS facets_ = locale::classic().__locale_->facets_; + for (unsigned i = 0; i < facets_.size(); ++i) if (facets_[i]) facets_[i]->__add_shared(); - install(new collate_byname(name_)); + +#define _DOIT(...) \ + do { \ + std::fprintf(stderr, "Creating " #__VA_ARGS__ "\n"); \ + auto* the_facet = new __VA_ARGS__(name_); \ + \ + std::fprintf(stderr, "Installing " #__VA_ARGS__ "\n"); \ + install(the_facet); \ + } while (false) + + _DOIT(collate_byname); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - install(new collate_byname(name_)); + _DOIT(collate_byname); #endif - install(new ctype_byname(name_)); + _DOIT(ctype_byname); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - install(new ctype_byname(name_)); + _DOIT(ctype_byname); #endif - install(new codecvt_byname(name_)); + _DOIT(codecvt_byname); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - install(new codecvt_byname(name_)); + _DOIT(codecvt_byname); #endif _LIBCPP_SUPPRESS_DEPRECATED_PUSH - install(new codecvt_byname(name_)); - install(new codecvt_byname(name_)); + _DOIT(codecvt_byname); + _DOIT(codecvt_byname); _LIBCPP_SUPPRESS_DEPRECATED_POP #if _LIBCPP_HAS_CHAR8_T - install(new codecvt_byname(name_)); - install(new codecvt_byname(name_)); + _DOIT(codecvt_byname); + _DOIT(codecvt_byname); #endif - install(new numpunct_byname(name_)); + _DOIT(numpunct_byname); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - install(new numpunct_byname(name_)); + _DOIT(numpunct_byname); #endif - install(new moneypunct_byname(name_)); - install(new moneypunct_byname(name_)); + _DOIT(moneypunct_byname); + _DOIT(moneypunct_byname); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - install(new moneypunct_byname(name_)); - install(new moneypunct_byname(name_)); + _DOIT(moneypunct_byname); + _DOIT(moneypunct_byname); #endif - install(new time_get_byname(name_)); + _DOIT(time_get_byname); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - install(new time_get_byname(name_)); + _DOIT(time_get_byname); #endif - install(new time_put_byname(name_)); + _DOIT(time_put_byname); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - install(new time_put_byname(name_)); + _DOIT(time_put_byname); #endif - install(new messages_byname(name_)); + _DOIT(messages_byname); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS - install(new messages_byname(name_)); + _DOIT(messages_byname); #endif #if _LIBCPP_HAS_EXCEPTIONS } catch (...) { + std::fprintf(stderr, "Releasing facets in catch block\n"); for (unsigned i = 0; i < facets_.size(); ++i) if (facets_[i]) facets_[i]->__release_shared(); throw; } #endif // _LIBCPP_HAS_EXCEPTIONS + + std::fprintf(stderr, "Done installing facets\n"); } locale::__imp::__imp(const __imp& other) : facets_(max(N, other.facets_.size())), name_(other.name_) { @@ -471,12 +490,25 @@ locale::__imp::~__imp() { } void locale::__imp::install(facet* f, long id) { + std::fprintf(stderr, "Entering install(facet*, long id)\n"); + + std::fprintf(stderr, "Calling facet->__add_shared()\n"); f->__add_shared(); + + std::fprintf(stderr, "Creating unique_ptr to hold facet\n"); unique_ptr hold(f); - if (static_cast(id) >= facets_.size()) + + if (static_cast(id) >= facets_.size()) { + std::fprintf(stderr, "Resizing facets vector\n"); facets_.resize(static_cast(id + 1)); - if (facets_[static_cast(id)]) + } + + if (facets_[static_cast(id)]) { + std::fprintf(stderr, "Releasing facets[id]\n"); facets_[static_cast(id)]->__release_shared(); + } + + std::fprintf(stderr, "Releasing unique_ptr\n"); facets_[static_cast(id)] = hold.release(); } @@ -533,8 +565,15 @@ const locale& locale::operator=(const locale& other) noexcept { return *this; } -locale::locale(const char* name) - : __locale_(name ? new __imp(name) : (__throw_runtime_error("locale constructed with null"), nullptr)) { +locale::locale(const char* name) { + std::fprintf(stderr, "Entering locale(char const*) constructor\n"); + if (name == nullptr) + std::__throw_runtime_error("locale constructed with null"); + + std::fprintf(stderr, "Running new __imp(name);\n"); + __locale_ = new __imp(name); + + std::fprintf(stderr, "Running locale_->acquire()\n"); __locale_->acquire(); } @@ -4054,6 +4093,7 @@ numpunct_byname::~numpunct_byname() {} void numpunct_byname::__init(const char* nm) { typedef numpunct base; if (strcmp(nm, "C") != 0) { + std::fprintf(stderr, "Creating __libcpp_unique_locale\n"); __libcpp_unique_locale loc(nm); if (!loc) __throw_runtime_error( @@ -4062,6 +4102,7 @@ void numpunct_byname::__init(const char* nm) { string(nm)) .c_str()); + std::fprintf(stderr, "Calling __libcpp_localeconv_l()\n"); lconv* lc = __libcpp_localeconv_l(loc.get()); if (!checked_string_to_char_convert(__decimal_point_, lc->decimal_point, loc.get())) __decimal_point_ = base::do_decimal_point(); diff --git a/libcxx/src/support/win32/locale_win32.cpp b/libcxx/src/support/win32/locale_win32.cpp index 2a08e97b8645b..0be7e24172342 100644 --- a/libcxx/src/support/win32/locale_win32.cpp +++ b/libcxx/src/support/win32/locale_win32.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include <__locale_dir/locale_guard.h> @@ -30,10 +31,17 @@ decltype(MB_CUR_MAX) MB_CUR_MAX_L(locale_t __l) { } lconv* localeconv_l(locale_t& loc) { + std::fprintf(stderr, "Entering localeconv_l in locale_win32.cpp\n"); + + std::fprintf(stderr, "Creating locale_guard in locale_win32.cpp\n"); std::__locale_guard __current(loc); + + std::fprintf(stderr, "Calling localeconv() in locale_win32.cpp\n"); lconv* lc = localeconv(); if (!lc) return lc; + + std::fprintf(stderr, "Calling __store_lconv in locale_win32.cpp\n"); return loc.__store_lconv(lc); } size_t mbrlen_l(const char* __restrict s, size_t n, mbstate_t* __restrict ps, locale_t loc) { diff --git a/libcxx/test/std/re/re.traits/getloc.pass.cpp b/libcxx/test/std/re/re.traits/getloc.pass.cpp index 55820cc0cc611..7ceb117fe4fd5 100644 --- a/libcxx/test/std/re/re.traits/getloc.pass.cpp +++ b/libcxx/test/std/re/re.traits/getloc.pass.cpp @@ -16,34 +16,17 @@ #include #include +#include #include "test_macros.h" #include "platform_support.h" // locale name macros -int main(int, char**) -{ - { - std::regex_traits t; - assert(t.getloc().name() == "C"); - } -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - { - std::regex_traits t; - assert(t.getloc().name() == "C"); - } -#endif - { - std::locale::global(std::locale(LOCALE_en_US_UTF_8)); - std::regex_traits t; - assert(t.getloc().name() == LOCALE_en_US_UTF_8); - } -#ifndef TEST_HAS_NO_WIDE_CHARACTERS - { - std::locale::global(std::locale(LOCALE_en_US_UTF_8)); - std::regex_traits t; - assert(t.getloc().name() == LOCALE_en_US_UTF_8); - } -#endif - - return 0; +int main(int, char**) { + std::fprintf(stderr, "Entering main()\n"); + { + std::fprintf(stderr, "Creating locale\n"); + std::locale loc("en_US.UTF-8"); + (void)loc; + } + return 1; } diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml index d1465721cf164..1c5c7cad33676 100644 --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -40,109 +40,8 @@ steps: - group: ARM steps: - label: AArch64 - command: libcxx/utils/ci/run-buildbot aarch64 + command: true agents: queue: libcxx-builders-linaro-arm arch: aarch64 <<: *common - - - label: AArch64 -fno-exceptions - command: libcxx/utils/ci/run-buildbot aarch64-no-exceptions - agents: - queue: libcxx-builders-linaro-arm - arch: aarch64 - <<: *common - - - label: Armv8 - command: libcxx/utils/ci/run-buildbot armv8 - agents: - queue: libcxx-builders-linaro-arm - arch: armv8l - <<: *common - - - label: Armv8 -fno-exceptions - command: libcxx/utils/ci/run-buildbot armv8-no-exceptions - agents: - queue: libcxx-builders-linaro-arm - arch: armv8l - <<: *common - - - label: Armv7 - command: libcxx/utils/ci/run-buildbot armv7 - agents: - queue: libcxx-builders-linaro-arm - arch: armv8l - <<: *common - - - label: Armv7 -fno-exceptions - command: libcxx/utils/ci/run-buildbot armv7-no-exceptions - agents: - queue: libcxx-builders-linaro-arm - arch: armv8l - <<: *common - - - label: Armv7-M picolibc - command: libcxx/utils/ci/run-buildbot armv7m-picolibc - agents: - queue: libcxx-builders-linaro-arm - arch: aarch64 - <<: *common - - - label: Armv7-M picolibc -fno-exceptions - command: libcxx/utils/ci/run-buildbot armv7m-picolibc-no-exceptions - agents: - queue: libcxx-builders-linaro-arm - arch: aarch64 - <<: *common - -- group: AIX - steps: - - label: AIX (32-bit) - command: libcxx/utils/ci/run-buildbot aix - env: - CC: clang - CXX: clang++ - OBJECT_MODE: '32' - agents: - queue: libcxx-builders - os: aix - <<: *common - - - label: AIX (64-bit) - command: libcxx/utils/ci/run-buildbot aix - env: - CC: clang - CXX: clang++ - OBJECT_MODE: '64' - agents: - queue: libcxx-builders - os: aix - <<: *common - -- group: ':freebsd: FreeBSD' - steps: - - label: FreeBSD 13 amd64 - command: libcxx/utils/ci/run-buildbot generic-cxx26 - env: - CC: clang17 - CXX: clang++17 - agents: - queue: libcxx-builders - os: freebsd - <<: *common - -- group: ':android: Android' - steps: - - label: Android 5.0, x86 NDK - command: libcxx/utils/ci/run-buildbot android-ndk-21-def-x86 - agents: - queue: libcxx-builders - os: android - <<: *common - - - label: Android 13, x86_64 NDK - command: libcxx/utils/ci/run-buildbot android-ndk-33-goog-x86_64 - agents: - queue: libcxx-builders - os: android - <<: *common diff --git a/libcxx/utils/libcxx/test/format.py b/libcxx/utils/libcxx/test/format.py index 7e5281c0b7406..47d04627e4396 100644 --- a/libcxx/utils/libcxx/test/format.py +++ b/libcxx/utils/libcxx/test/format.py @@ -287,6 +287,9 @@ def execute(self, test, litConfig): supportsVerify = "verify-support" in test.config.available_features filename = test.path_in_suite[-1] + if filename != 'getloc.pass.cpp': + return lit.Test.Result(lit.Test.UNSUPPORTED, "not the test we're looking for") + if re.search("[.]sh[.][^.]+$", filename): steps = [] # The steps are already in the script return self._executeShTest(test, litConfig, steps)