Skip to content

fix!: int pixel to int64_t in deepdata#5252

Open
luna-y-kim wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
luna-y-kim:fix-deepdata-abi-break
Open

fix!: int pixel to int64_t in deepdata#5252
luna-y-kim wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
luna-y-kim:fix-deepdata-abi-break

Conversation

@luna-y-kim

Copy link
Copy Markdown
Contributor

Description

Widen the srcpixel param of DeepData::merge_deep_pixels from int to int64_t. This breaks ABI, hence the ! mark.
Follow-up to #2363
Fixes #5242

Tests

N/A

Checklist:

  • I have read the guidelines on contributions and code review procedures.
  • I have read the Policy on AI Coding Assistants
    and if I used AI coding assistants, I have an Assisted-by: TOOL / MODEL
    line in the pull request description above.
  • (N/A) I have updated the documentation if my PR adds features or changes
    behavior.
  • (N/A) I am sure that this PR's changes are tested in the testsuite.
  • I have run and passed the testsuite in CI before submitting the
    PR, by pushing the changes to my fork and seeing that the automated CI
    passed there. (Exceptions: If most tests pass and you can't figure out why
    the remaining ones fail, it's ok to submit the PR and ask for help. Or if
    any failures seem entirely unrelated to your change; sometimes things break
    on the GitHub runners.)
  • My code follows the prevailing code style of this project and I
    fixed any problems reported by the clang-format CI test.
  • (N/A) If I added or modified a public C++ API call, I have also amended the
    corresponding Python bindings. If altering ImageBufAlgo functions, I also
    exposed the new functionality as oiiotool options.

Widen the srcpixel param of DeepData::merge_deep_pixels from int to int64_t.
This breaks ABI, hence the `!` mark.
Follow-up to AcademySoftwareFoundation#2363
Fixes AcademySoftwareFoundation#5242

Signed-off-by: Luna Kim <177369799+luna-y-kim@users.noreply.github.com>
Comment on lines +191 to +192
void merge_deep_pixels(int64_t pixel, const DeepData& src,
int64_t srcpixel);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you avoid the ABI break by just not removing the old one at all? Just add the new one, and change the implementation of the old one to call the new one. Leave a comment on the old one indicating that we intend to deprecate it. So the idiom is like this:

    /// full comments
    void func(int64_t);

    // DEPRECATED(3.2): use the version with int64_t
    void func(int);

does that work? Or do you just get warnings everywhere about ambiguous arguments?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Wait, I think this is even better:

    /// full comments
    void func(int64_t);

#ifdef OIIO_INTERNAL
    // DEPRECATED(3.2): use the version with int64_t
    void func(int);
#endif

This hides the declaration from external/downstream clients of OIIO when they recompile. They will only see the int64_t version, which if they pass an int32, will just transparently accept it. So starting from their next recompile, they will start using the new function, without having to do anything.

Meanwhile, internally we still declare and implement the old function. Which means that ABI is preserved, the library exports all the same symbols it used to, and an existing program that calls the old function will continue to link properly against a new copy of libOpenImageIO.

When we eventually have OIIO 4.0, we'll chase down all those "DEPRECATED" comments and finally remove the functions entirely (because we don't guarantee any compatibility at first-digit version changes).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

(I should point out that it's only because the change is specifically int -> int64_t, which is a widening that is implicitly accepted by the compiler without warning, that we are able to do this trick and something like func(my_int) will just work and know to call func(int64_t). If we were changing int to uint64_t, or doing some other change that wouldn't just implicitly cast, we'd be in a more complex situation.)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: srcpixel param of DeepData::merge_deep_pixels should be int64_t (breaks ABI)

2 participants