Skip to content

int: Turn on OIIO_NODISCARD_ERROR_ENABLE for internal builds#5145

Merged
lgritz merged 1 commit intoAcademySoftwareFoundation:mainfrom
lgritz:lg-nodiscard
Apr 21, 2026
Merged

int: Turn on OIIO_NODISCARD_ERROR_ENABLE for internal builds#5145
lgritz merged 1 commit intoAcademySoftwareFoundation:mainfrom
lgritz:lg-nodiscard

Conversation

@lgritz
Copy link
Copy Markdown
Collaborator

@lgritz lgritz commented Apr 15, 2026

Rearrange the automatic setting of OIIO_NODISCARD_ERROR_ENABLE so that for external (not OIIO itself) builds, we default to enabling for OIIO >= 3.3, and disabling for older and current versions. But now, when building OIIO itself, it is ENABLED regardless of version.

So this means that as we add OIIO_NODISCARD_ERROR annotations to functions, we MUST fix any calls to those functions where we ourselves don't check their return values, and can't accidentally add new breaking code.

Also, had to fix a bunch of spots that were missed in the original PR, places where we didn't patch up our sloppy uses of what was annotated in that patch. I'm not sure I understand how these could have been missed in that last PR, since that PR did fix other uses of the annotated functions.

Rearrange the automatic setting of `OIIO_NODISCARD_ERROR_ENABLE`
so that for external (not OIIO itself) builds, we default to
enabling for OIIO >= 3.3, but now for building OIIO itself, it
is ENABLED starting now.

So this means that as we add OIIO_NODISCARD_ERROR annotations to
functions, we MUST fix any calls we have ourselves that don't check
their return values, and can't accidentally add new breaking code.

Also, had to fix a bunch of spots that were missed in the original
PR, places where we didn't patch up our sloppy uses of what was
annotated in that patch. I'm not sure I understand how these could
have been missed, since that PR did fix other usages.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz
Copy link
Copy Markdown
Collaborator Author

lgritz commented Apr 20, 2026

@mvanhorn does this look right to you?

@mvanhorn
Copy link
Copy Markdown
Contributor

Looks right. Flipping the OIIO_INTERNAL-gated default to always-enable is the right call. It means NODISCARD_ERROR annotations land with their own call-site fixes in the same PR instead of sneaking past our own build.

The test-fix pattern reads clean: OIIO_ASSERT(ok) where correctness matters, (void) in imagespeed_test.cpp so the timing harness doesn't assert inside the hot loop.

@lgritz lgritz merged commit 6e1b493 into AcademySoftwareFoundation:main Apr 21, 2026
31 checks passed
@lgritz lgritz deleted the lg-nodiscard branch April 21, 2026 05:18
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