fix: Recognize AppleClang to enable recommended compiler flags on macOS#547
Draft
azeey wants to merge 2 commits intogazebosim:mainfrom
Draft
fix: Recognize AppleClang to enable recommended compiler flags on macOS#547azeey wants to merge 2 commits intogazebosim:mainfrom
azeey wants to merge 2 commits intogazebosim:mainfrom
Conversation
The compiler ID for Apple's Clang is 'AppleClang', which was not recognized by the scripts. This change ensures that AppleClang is treated similarly to standard Clang, applying the recommended warning flags. Generated-By: Gemini 3.0 Pro Signed-off-by: Addisu Z. Taddese <addisuzt@intrinsic.ai>
This suppresses the warning about variadic macro arguments in gtest, which is triggered by -pedantic on macOS with Clang. This is needed for tests in gz-physics. Generated-By: Gemini 3.0 Pro Signed-off-by: Addisu Z. Taddese <addisuzt@intrinsic.ai>
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.
🦟 Bug fix
Summary
While working on gazebosim/gz-physics#946, I noticed that I wasn't getting any compiler warnings locally (on macOS), but they showed up on CI. It turns out the flags used for gcc on Linux and the ones used for clang on macOS are very different. Examples from
build.ninja:macOS
But on Linux
Other than the macOS specific flags like
-stdliband-arch, the flags should have been equivalent where possible. The issue was that the compiler ID for Apple's Clang is 'AppleClang', which was not recognized by the scripts. This change ensures that AppleClang is treated similarly to standard Clang, applying the recommended warning flags.With the new flags, gz-physics emitts additional warnings related to
TYPED_TEST_SUITEfor the code like the following tests intest/common:and the error message is
dd5ab89 suppresses this warning to match gcc on Linux.
Edit: I've marked this as draft because this causes several warnings in other Gazebo libraries. Once those are all addressed, I'll mark this ready for review.
Checklist
codecheckpassed (See contributing)Generated-by: Gemini 3.0 Pro
Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-byandGenerated-bymessages.Backports: If this is a backport, please use Rebase and Merge instead.