Skip to content

Conversation

@AnthonyLatsis
Copy link
Collaborator

--extra-swift-cmake-options=-DCMAKE_CXX_FLAGS=<flags> overwrites the variable rather than appends to it.

@AnthonyLatsis AnthonyLatsis requested review from edymtt and etcwilde June 19, 2025 03:12
@AnthonyLatsis AnthonyLatsis requested a review from artemcm as a code owner June 19, 2025 03:12
@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test

@etcwilde
Copy link
Member

etcwilde commented Jun 19, 2025

I'm not sure how I feel about this. If you're overriding a variable, you should override it. If we want to change the behavior of how the flag works in build-script, it should stay in build-script. But then we will also need a separate mechanism for removing and replacing values as well.

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should move this to the buildbot_incremental_base preset? The smoketest preset only gets run if someone explicitly asks for a smoke test, but not if they only ask for PR testing.

Copy link
Member

Choose a reason for hiding this comment

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

Alternatively, it might be good to spell out the flags because at this point, I have no idea what the existing flags are, or where they're coming from. These preset files don't make it easy to track down where flags are coming from.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alternatively, it might be good to spell out the flags because at this point

Sorry, by spell out the flags you mean...?

Copy link
Collaborator Author

@AnthonyLatsis AnthonyLatsis Jun 19, 2025

Choose a reason for hiding this comment

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

I wonder if we should move this to the buildbot_incremental_base preset?

I would rather exclude the possibility of some recurrent no-asserts job accidentally picking this up. Ideally, this should affect only the presets that can be used to fulfill our PR status checks. So perhaps a better alternative is to stick it in a pr-testing preset and apply that to the nodes we use for that purpose.

@AnthonyLatsis
Copy link
Collaborator Author

AnthonyLatsis commented Jun 19, 2025

I'm not sure how I feel about this. If you're overriding a variable, you should override it. If we want to change the behavior of how the flag works in build-script, it should stay in build-script. But then we will also need a separate mechanism for removing and replacing values as well.

I don’t think special-casing option merging for CMAKE_CXX_FLAGS in build-script-impl is any better than this. You may want to override the variable as well as append to it.

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

CMake recommendations are that CMAKE_C_FLAGS, CMAKE_CXX_FLAGS, CMAKE_Swift_FLAGS are off limits for CMakeLists.txt. If we want to allow the user to specify additional flags, that should require a special option e.g. -D Swift_ADDITIONAL_C_FLAGS=-Werror=unused -D Swift_ADDITIONAL_CXX_FLAGS=-Werror-unused -D Swift_ADDITIONAL_Swift_FLAGS="-Xcc -Werror-unused".

@compnerd
Copy link
Member

To be clear, the options should be added via compile_options at the top level, not by changing the CMAKE_{C,CXX,Swift}_FLAGS.

@AnthonyLatsis
Copy link
Collaborator Author

To be clear, the options should be added via compile_options at the top level, not by changing the CMAKE_{C,CXX,Swift}_FLAGS.

Thank you!

@AnthonyLatsis AnthonyLatsis requested a review from etcwilde June 24, 2025 13:46
@AnthonyLatsis
Copy link
Collaborator Author

@etcwilde ping

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test

@AnthonyLatsis AnthonyLatsis enabled auto-merge July 29, 2025 21:04
@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test macOS

1 similar comment
@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test macOS

@AnthonyLatsis AnthonyLatsis merged commit b09b622 into swiftlang:main Jul 31, 2025
3 checks passed
@AnthonyLatsis AnthonyLatsis deleted the no-warnings-asserts branch July 31, 2025 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants