Skip to content

chore(swig): ignore C++ move constructors and assignment operators in .i files - #1580

Open
AustinBenoit wants to merge 1 commit into
mainfrom
cleanup/swig-ignore-move-ops
Open

AustinBenoit wants to merge 1 commit into
mainfrom
cleanup/swig-ignore-move-ops

Conversation

@AustinBenoit

Copy link
Copy Markdown
Contributor

Description

Companion PR for firebase/firebase-cpp-sdk#1995 (which removes the always-defined FIREBASE_USE_MOVE_OPERATORS and FIREBASE_USE_STD_FUNCTION macros from C++ headers).

Because SWIG does not follow #include "firebase/internal/common.h", those macros were previously undefined during Unity SWIG runs. Unwrapping them in firebase-cpp-sdk follows the modern convention of keeping C++ public headers free of #ifndef SWIG for move operations and handling ignores in Unity .i files instead:

  • database/src/swig/database.i: add %ignore firebase::database::MutableData::MutableData; so the move-only constructor does not emit a new public InternalMutableData(InternalMutableData rhs) C# constructor.
  • app/src/swig/future.i: add %ignore FutureBase::FutureBase(FutureBase&&); alongside %ignore FutureBase::operator=; to prevent a new SWIG Warning 516.
  • storage/src/swig/storage.i: generalize signature-qualified operator=(const T&) ignores on StorageReference, Metadata, and Controller to unqualified operator=, and add %ignore firebase::storage::StorageListResult::operator=;.

Safe to merge independently before or alongside firebase/firebase-cpp-sdk#1995.

Testing

  • Ran SWIG 4.4.1 differential checks across all 10 Unity .i modules for both:
    1. firebase-cpp-sdk origin/main + this Unity branch -> 0 functional C#/C++ diff vs baseline.
    2. firebase-cpp-sdk PR #1995 + this Unity branch -> 0 functional C# diff across all 10 modules (confirming InternalMutableData.cs is unchanged and app/storage emit zero new SWIG warnings).
  • Relying on GitHub Actions CI for full Unity builds and tests.

…files

Prepares Unity SWIG bindings for firebase/firebase-cpp-sdk#1995 removing the
always-defined FIREBASE_USE_MOVE_OPERATORS and FIREBASE_USE_STD_FUNCTION macros
from C++ headers:

- database/src/swig/database.i: ignore MutableData::MutableData so the move-only
  constructor does not leak into InternalMutableData.cs when unwrapped in C++.
- app/src/swig/future.i: ignore FutureBase::FutureBase(FutureBase&&) to match
  existing FutureBase::operator= ignore.
- storage/src/swig/storage.i: broaden copy-only operator=(const T&) ignores on
  StorageReference, Metadata, and Controller to unqualified operator=, and
  ignore StorageListResult::operator=.

@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 updates SWIG interface files for the Firebase C++ SDK to ignore move constructors, constructors, and assignment operators that are not supported or needed by C# proxies. Specifically, it ignores the FutureBase move constructor, the MutableData constructor, and several assignment operators across StorageReference, Metadata, Controller, and StorageListResult. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant