Skip to content

chore: remove legacy STLPort and obsolete pre-C++11/VS2013 shims - #1958

Merged
AustinBenoit merged 4 commits into
mainfrom
cleanup/remove-legacy-stlport
Nov 10, 2026
Merged

AustinBenoit merged 4 commits into
mainfrom
cleanup/remove-legacy-stlport

Conversation

@AustinBenoit

@AustinBenoit AustinBenoit commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Removes dead STLPort (_STLPORT_VERSION / STLPORT) and obsolete pre-C++11 / pre-VS2015 (_MSC_VER <= 1800) compatibility shims left over after STLPort support was dropped in Firebase C++ SDK v8.0.0 (#407, #510), Android gnustl was dropped in v9.0.0 (#889), and the build baseline moved to C++17 (CMAKE_CXX_STANDARD 17).

Summary of Changes

  • Threading (app/src/thread*, app/CMakeLists.txt, app/tests/CMakeLists.txt):
    • Deleted dead STLPort-only app/src/thread_pthread.cc and the duplicate firebase_app_pthread_thread_test target.
    • Simplified firebase::Thread to wrap std::thread unconditionally, marked Thread(Thread&&) and Thread::operator=(Thread&&) as noexcept, and cleaned up stale pthread-specific comments.
  • Core Internal Shims (common.h, type_traits.h, optional.h, callback.h, variant.cc):
    • Removed _STLPORT_VERSION and _MSC_VER <= 1800 preprocessor branches in app/src/include/firebase/internal/common.h, while keeping FIREBASE_USE_MOVE_OPERATORS and FIREBASE_USE_STD_FUNCTION unconditionally defined for source/SWIG compatibility with public headers checking #if defined(...).
    • Replaced custom pre-C++11 trait reimplementations and std::tr1 namespace switching in app/src/include/firebase/internal/type_traits.h with std:: aliases; inherited firebase::is_char and firebase::is_integer from integral_constant, made both cv-qualifier invariant (std::remove_cv), guarded char8_t on __cpp_char8_t, and added unit test coverage in app/tests/type_traits_test.cc.
    • Replaced FIREBASE_ALIGNED_STORAGE / std::aligned_storage (deprecated in C++23) in app/src/optional.h with alignas(T) unsigned char buffer_[sizeof(T)] and std::launder accessors.
    • Removed the dead non-variadic CallbackVariadic fallback in app/src/callback.h and legacy _snprintf / INT64FORMAT workarounds in app/src/variant.cc and auth/src/auth.cc in favor of std::snprintf and <cinttypes> (PRId64).
  • Module, Test & Script Cleanups (auth/, database/, firestore/, messaging/, remote_config/, storage/, testing/, build_scripts/):
    • Removed the unreachable #if !defined(FIREBASE_USE_STD_FUNCTION) || defined(DOXYGEN) DatabaseReference::RunTransaction(DoTransaction, bool) overload and stale STLPort Doxygen @notes in database_reference.h, database_reference.cc, transaction.h, and future.h (note: this overload was never compiled into libfirebase_database on any non-STLPort build; typedef ... DoTransaction is retained so plain function pointers continue binding to RunTransaction(DoTransactionFunction, bool) and SWIG bindings are unchanged).
    • Removed dead non-move #else branches, STLPort test skip macros (SKIP_TEST_IF_USING_STLPORT), CreateMapCopy STLPort workaround, unused AUTH_STATIC_ASSERT, and unused vs2013 / stl=c++ cases in build_scripts/desktop/get_variant.sh.

Testing

Tested Locally (Linux x64 Workstation)

  • Desktop CMake Build & Unit Tests: Configured and built all desktop targets + unit tests (-DFIREBASE_CPP_BUILD_TESTS=ON -DFIREBASE_USE_LINUX_CXX11_ABI=ON) and ran ctest serially — 104/104 test targets passed (including the new firebase_app_type_traits_test, firebase_app_optional_test, firebase_app_cpp11_thread_test, firebase_app_variant_test, firebase_app_future_test, firebase_auth_desktop_test, firebase_rtdb_common_database_reference_test, and firebase_storage_desktop_utils_test).
  • Compiler Standards & Sanitizers: Verified clean compilation (0 warnings/errors) of modified headers and sources under g++ 15.2 and clang++-19 across -std=c++17, -std=c++20, -std=c++20 -fno-char8_t, and -std=c++23 with -Wall -Wextra -Wpedantic -Wdeprecated-declarations -Werror, plus -O2 -fsanitize=address,undefined harnesses for Optional<T>, Thread, Variant, CallbackStdFunction, and type_traits.h.
  • Android NDK Cross-Compile (Syntax/Object Check): Cross-compiled modified Android JNI and common translation units and standalone headers with aarch64-linux-android24-clang++ (NDK r23b and NDK r28b, -fno-exceptions) with zero errors.
  • Downstream Unity SDK SWIG Differential Check: Ran swig -c++ -csharp (SWIG 4.4.1) across all 10 firebase-unity-sdk .i modules comparing origin/main vs this branch — 0 byte differences in generated .cs and _wrap.cxx outputs.
  • Formatting, Docs & Copyright: python3 scripts/format_code.py -git_diff --noformat_file -verbose (0 files needing formatting), Doxygen 1.15.0 against docs/Doxyfile (0 warnings in touched headers), and bash scripts/gha/check_copyright.sh -g (passed).

Not Tested Locally (Covered by GitHub Actions CI)

  • Full native builds on Windows (MSVC), macOS, iOS/tvOS (Xcode), full Gradle Android AAR packaging, and live Integration tests against Firebase backends were not run locally on Linux; triggered GitHub Actions build workflows and tests-requested: full integration tests on this PR to validate all platforms end-to-end.

Type of Change

Place an x the applicable box:

  • Bug fix. Add the issue # below if applicable.
  • New feature. A non-breaking change which adds functionality.
  • Other, such as a build process or documentation change.

Notes

  • Bug fixes and feature changes require an update to the Release Notes section of release_build_files/readme.md.
  • Read the contribution guidelines CONTRIBUTING.md.
  • Changes to the public API require an internal API review. If you'd like to help us make Firebase APIs better, please propose your change in a feature request so that we can discuss it together.

@AustinBenoit AustinBenoit added skip-release-notes Skip release notes check tests-requested: full Trigger a FULL set of integration tests (uses expanded test matrix). labels Nov 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes support for STLPort and legacy C++03 workarounds across the codebase, simplifying type traits, threading, and optional implementations to use modern C++ standard library features directly. Feedback on these changes highlights a potential self-move-assignment bug in Optional::operator= that could cause self-destruction, and a buffer size in Variant::AsString that is too small to safely format large double values without truncation.

Comment thread app/src/optional.h Resolved
Comment thread app/src/variant.cc Resolved
@github-actions github-actions Bot added tests: in-progress This PR's integration tests are in progress. and removed tests-requested: full Trigger a FULL set of integration tests (uses expanded test matrix). labels Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Integration test with FLAKINESS (succeeded after retry)

Requested by @AustinBenoit on commit 54f23e2
Last updated: Tue Nov 10 12:30 PST 2026
View integration test log & download artifacts

Failures Configs
app_check [TEST] [FLAKINESS] [Android] [1/3 os: windows] [1/2 android_device: emulator_ftl_target]
(1 failed tests)  FirebaseAppCheckTest.TestDebugProviderValidToken
firestore [TEST] [FLAKINESS] [Android] [1/3 os: ubuntu] [1/2 android_device: android_target]
(1 failed tests)  CRASH/TIMEOUT

Add flaky tests to go/fpl-cpp-flake-tracker

@github-actions github-actions Bot added the tests: failed This PR's integration tests failed. label Nov 3, 2026
@firebase-workflow-trigger firebase-workflow-trigger Bot removed the tests: in-progress This PR's integration tests are in progress. label Nov 3, 2026
- Delete dead STLPort-only app/src/thread_pthread.cc and duplicate
  firebase_app_pthread_thread_test target; mark Thread move operations
  noexcept.
- Simplify common.h, type_traits.h, optional.h, variant.cc, and callback.h
  by removing _STLPORT_VERSION / STLPORT / _MSC_VER <= 1800 fallbacks while
  keeping FIREBASE_USE_MOVE_OPERATORS and FIREBASE_USE_STD_FUNCTION defined
  for public header compatibility.
- Use alignas(T) unsigned char buffer in Optional<T> to avoid C++23
  std::aligned_storage deprecation warnings, and inherit is_char / is_integer
  from integral_constant with unit test coverage in type_traits_test.cc.
- Remove unreachable non-std::function RunTransaction(DoTransaction) overload,
  dead non-move #else branches, unused AUTH_STATIC_ASSERT / vs2013 script case,
  and obsolete STLPort Doxygen @note blocks.
@AustinBenoit
AustinBenoit force-pushed the cleanup/remove-legacy-stlport branch from 111b4d8 to 737248e Compare November 4, 2026 02:03
@AustinBenoit AustinBenoit added tests-requested: full Trigger a FULL set of integration tests (uses expanded test matrix). and removed tests: failed This PR's integration tests failed. labels Nov 4, 2026
@github-actions github-actions Bot added tests: in-progress This PR's integration tests are in progress. and removed tests-requested: full Trigger a FULL set of integration tests (uses expanded test matrix). labels Nov 4, 2026
@github-actions github-actions Bot added the tests: failed This PR's integration tests failed. label Nov 4, 2026
@firebase-workflow-trigger firebase-workflow-trigger Bot removed the tests: in-progress This PR's integration tests are in progress. label Nov 4, 2026
// reporting __cplusplus to be 199711L, so explicitly check for that.
// Also, stlport doesn't implement std::move().
#if (__cplusplus >= 201103L || _MSC_VER >= 1600) && !defined(_STLPORT_VERSION)
#define FIREBASE_USE_MOVE_OPERATORS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we need these anymore, since they are always being defined now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — we don't need them anymore, and every remaining check (~73 files across app, auth, database, functions, and storage) is a positive #if/#ifdef. Added a TODO(b/582384770) note here in c8ed6e6 and filed b/582384770 to unwrap and remove them in a dedicated follow-up PR so this diff stays focused.

@AustinBenoit AustinBenoit added tests: succeeded This PR's integration tests succeeded. and removed tests: failed This PR's integration tests failed. labels Nov 9, 2026
@AustinBenoit
AustinBenoit merged commit 54f23e2 into main Nov 10, 2026
39 checks passed
@github-actions github-actions Bot added tests: in-progress This PR's integration tests are in progress. tests: succeeded This PR's integration tests succeeded. and removed tests: succeeded This PR's integration tests succeeded. labels Nov 10, 2026
@firebase-workflow-trigger firebase-workflow-trigger Bot removed the tests: in-progress This PR's integration tests are in progress. label Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-release-notes Skip release notes check tests: succeeded This PR's integration tests succeeded.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants