int: Turn on OIIO_NODISCARD_ERROR_ENABLE for internal builds#5145
Merged
lgritz merged 1 commit intoAcademySoftwareFoundation:mainfrom Apr 21, 2026
Merged
int: Turn on OIIO_NODISCARD_ERROR_ENABLE for internal builds#5145lgritz merged 1 commit intoAcademySoftwareFoundation:mainfrom
lgritz merged 1 commit intoAcademySoftwareFoundation:mainfrom
Conversation
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>
Collaborator
Author
|
@mvanhorn does this look right to you? |
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rearrange the automatic setting of
OIIO_NODISCARD_ERROR_ENABLEso 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.