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

In libavif v1.1.0, only the source files in the avif_obj and avif_apps_obj OBJECT libraries are compiled with warnings enabled #2340

Closed
wantehchang opened this issue Jul 29, 2024 · 1 comment

Comments

@wantehchang
Copy link
Collaborator

In libavif v1.1.0, only the source files in the avif_obj and avif_apps_obj OBJECT libraries are compiled with warnings enabled.

The source files in the examples, apps, and tests are NOT compiled with warnings enabled.

wantehchang added a commit that referenced this issue Jul 30, 2024
It collects all warning-related compiler options and macro definitions.
Re-enable warnings on the apps (avifdec, avifenc, and avifgainmaputil).

Warnings on the tests will be re-enabled separately.

A partial fix for #2340.

Note: We cannot use add_compile_options() to enable warnings, because
add_compile_options() affects not only our own targets but also the
external dependencies we bring in by FetchContent.
wantehchang added a commit to wantehchang/libavif that referenced this issue Jul 30, 2024
Note that the fuzztest targets are not compiled with warnings enabled
because the FuzzTest and Abseil headers have compiler warnings.

Part 2 of the fix for
AOMediaCodec#2340.
wantehchang added a commit that referenced this issue Jul 31, 2024
Note that the fuzztest targets are not compiled with warnings enabled
because the FuzzTest and Abseil headers have compiler warnings.

Part 2 of the fix for
#2340.
wantehchang added a commit to wantehchang/libavif that referenced this issue Jul 31, 2024
"gtest/gtest.h" is included by avifincrtest_helpers.cc but not by the
header avifincrtest_helpers.h, so move GTest::GTest to the PRIVATE
scope. Also move avif_enable_warnings to the PRIVATE scope.

Part 3 of the fix for
AOMediaCodec#2340.
wantehchang added a commit that referenced this issue Jul 31, 2024
"gtest/gtest.h" is included by avifincrtest_helpers.cc but not by the
header avifincrtest_helpers.h, so move GTest::GTest to the PRIVATE
scope. Also move avif_enable_warnings to the PRIVATE scope.

Part 3 of the fix for
#2340.
@wantehchang
Copy link
Collaborator Author

I verified with a local build on Linux that this bug has been fixed except the fuzztest targets in tests/CMakeLists.txt.

I agree that the new method is tedious and it is easy to miss when we add a new library or executable target. But no solution for this issue is perfect. I probably would prefer add_compile_options() if we could prevent it from affecting the external dependencies that we incoporate using add_subdirectory().

We can adjust the new method, such as changing the avif_enable_warnings interface library to a function or macro that we call on each target, or adding back the $<BUILD_INTERFACE> generator expressions.

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

No branches or pull requests

1 participant