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

-Wignored-attributes error with old clang #1947

Closed
sezero opened this issue Jan 17, 2024 · 3 comments · Fixed by #1951
Closed

-Wignored-attributes error with old clang #1947

sezero opened this issue Jan 17, 2024 · 3 comments · Fixed by #1951
Assignees

Comments

@sezero
Copy link
Contributor

sezero commented Jan 17, 2024

With clang 3.4.2, I got the following error:

In file included from /tmp/libavif/src/alpha.c:4:
In file included from /tmp/libavif/include/avif/internal.h:7:
/tmp/libavif/include/avif/avif.h:157:14: error: 'warn_unused_result' attribute only applies to functions, methods, and classes [-Werror,-Wignored-attributes]
typedef enum AVIF_NODISCARD avifResult
             ^
/tmp/libavif/include/avif/avif.h:57:39: note: expanded from macro 'AVIF_NODISCARD'
#define AVIF_NODISCARD __attribute__((warn_unused_result))
                                      ^
1 error generated.

Seems to be after #1655

Removing AVIF_NODISCARD from avifResult enum makes the build to succeed.

@y-guyon
Copy link
Collaborator

y-guyon commented Jan 18, 2024

Thanks for the report.

Does setting -DAVIF_ENABLE_WERROR=OFF solve the issue?

@sezero
Copy link
Contributor Author

sezero commented Jan 18, 2024

Yes, it does for build of libavif itself. (The thing is though, the public header is the offender.)

@vrabaud
Copy link
Collaborator

vrabaud commented Jan 18, 2024

Using godbolt, I could figure out clang 3.9.0 was the first one to introduce the behavior for enums.

vrabaud added a commit to vrabaud/libavif that referenced this issue Jan 18, 2024
vrabaud added a commit to vrabaud/libavif that referenced this issue Jan 18, 2024
godbolt shows that's when it was also define for enums.
This fixes AOMediaCodec#1947
vrabaud added a commit that referenced this issue Jan 18, 2024
godbolt shows that's when it was also define for enums.
This fixes #1947
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 a pull request may close this issue.

3 participants