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

Fix -Wextra-semi-stmt #2063

Merged
merged 1 commit into from
Mar 15, 2024
Merged

Fix -Wextra-semi-stmt #2063

merged 1 commit into from
Mar 15, 2024

Conversation

sezero
Copy link
Contributor

@sezero sezero commented Mar 15, 2024

empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]

We noticed this in our libsdl fork. Applies to v1.0.x branch as is, as well.

…sary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
sezero referenced this pull request in libsdl-org/libavif Mar 15, 2024
…sary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
@jzern
Copy link
Collaborator

jzern commented Mar 15, 2024

This option could be added to CMakeLists.txt as well.

@sezero
Copy link
Contributor Author

sezero commented Mar 15, 2024

This option could be added to CMakeLists.txt as well.

Like this?

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30644e8..ae1459b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -254,5 +254,5 @@ include(CheckCCompilerFlag)
 if(CMAKE_C_COMPILER_ID MATCHES "Clang")
     message(STATUS "libavif: Enabling warnings for Clang")
-    target_compile_options(avif_obj PUBLIC $<BUILD_INTERFACE:-Wall -Wextra -Wshorten-64-to-32>)
+    target_compile_options(avif_obj PUBLIC $<BUILD_INTERFACE:-Wall -Wextra -Wextra-semi-stmt -Wshorten-64-to-32>)
 elseif(CMAKE_C_COMPILER_ID MATCHES "GNU")
     message(STATUS "libavif: Enabling warnings for GCC")

It seems to be present in clang >= 8 and your cmake'ry doesn't seem to check versions.
Do you want me to add it nonetheless?

Copy link
Collaborator

@wantehchang wantehchang left a comment

Choose a reason for hiding this comment

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

We can merge this pull request first. Either way is fine. Thank you for your contribution.

@sezero
Copy link
Contributor Author

sezero commented Mar 15, 2024

OK, merge as is, then. Thanks.

@jzern
Copy link
Collaborator

jzern commented Mar 15, 2024

This option could be added to CMakeLists.txt as well.

Like this?

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30644e8..ae1459b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -254,5 +254,5 @@ include(CheckCCompilerFlag)
 if(CMAKE_C_COMPILER_ID MATCHES "Clang")
     message(STATUS "libavif: Enabling warnings for Clang")
-    target_compile_options(avif_obj PUBLIC $<BUILD_INTERFACE:-Wall -Wextra -Wshorten-64-to-32>)
+    target_compile_options(avif_obj PUBLIC $<BUILD_INTERFACE:-Wall -Wextra -Wextra-semi-stmt -Wshorten-64-to-32>)
 elseif(CMAKE_C_COMPILER_ID MATCHES "GNU")
     message(STATUS "libavif: Enabling warnings for GCC")

It seems to be present in clang >= 8 and your cmake'ry doesn't seem to check versions. Do you want me to add it nonetheless?

Sorry about that. I figured there would be some extra work to check versions. We'll follow up with something. Thanks for the patch.

@jzern jzern merged commit 4e1af42 into AOMediaCodec:main Mar 15, 2024
21 checks passed
@sezero sezero deleted the extra-semicolon branch March 15, 2024 19:56
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.

4 participants