Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow TypeDesc to be used directly in a C API by forcing it to be POD. #4162

Merged

Conversation

scott-wilson
Copy link
Contributor

Signed-off-by: Scott Wilson scott@propersquid.com

Description

This PR is for allowing the TypeDesc type to be used directly in a C API without indirection, and therefore also in a Rust API without indirection.

Tests

I added static asserts for the TypeDesc so it should validate if the struct is okay at compile time.

Checklist:

  • I have read the contribution guidelines.
  • I have updated the documentation, if applicable.
  • I have ensured that the change is tested somewhere in the testsuite
    (adding new test cases if necessary).
  • If I added or modified a C++ API call, I have also amended the
    corresponding Python bindings (and if altering ImageBufAlgo functions, also
    exposed the new functionality as oiiotool options).
  • My code follows the prevailing code style of this project. If I haven't
    already run clang-format before submitting, I definitely will look at the CI
    test that runs clang-format and fix anything that it highlights as being
    nonconforming.

Signed-off-by: Scott Wilson <scott@propersquid.com>
Copy link

linux-foundation-easycla bot commented Feb 20, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@lgritz
Copy link
Collaborator

lgritz commented Feb 20, 2024

I think there are a couple CI failures from compilers that don't accept static_assert in C++14 without the explanation string.

(Don't worry about the "bleeding edge" test, that is failing because something is broken in the openexr trunk, it's not your fault.)

@scott-wilson
Copy link
Contributor Author

No worries, will fix shortly.

Signed-off-by: Scott Wilson <scott@propersquid.com>
Copy link
Collaborator

@lgritz lgritz left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@lgritz lgritz merged commit 43fea76 into AcademySoftwareFoundation:master Feb 20, 2024
24 of 25 checks passed
@scott-wilson scott-wilson deleted the make_typedesc_pod branch February 20, 2024 15:53
lgritz pushed a commit to lgritz/OpenImageIO that referenced this pull request Mar 1, 2024
…wareFoundation#4162)

This PR is for allowing the TypeDesc type to be used directly in a C API
without indirection, and therefore also in a Rust API without
indirection.

---------

Signed-off-by: Scott Wilson <scott@propersquid.com>
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.

2 participants