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 out variable in cmake sanitizer module #1134

Merged
merged 1 commit into from
Jul 15, 2024
Merged

Fix out variable in cmake sanitizer module #1134

merged 1 commit into from
Jul 15, 2024

Conversation

sfod
Copy link
Contributor

@sfod sfod commented Jul 13, 2024

Issue #, if available:

The aws_check_sanitizer cmake function incorrectly handles the out parameter. The issue is with if(NOT ${ARGN}) check.

When an extra parameter is passed to the function (e.g., aws_check_sanitizer("thread" CUSTOM_OUT_VAR)), if(NOT ${ARGN}) checks the value of this extra parameter. This means that ${CUSTOM_OUT_VAR} will be used as out variable only if it's undefined/false:

aws_check_sanitizer("thread" CUSTOM_OUT_VAR)  # sets ${CUSTOM_OUT_VAR} to 1
aws_check_sanitizer("thread" CUSTOM_OUT_VAR)  # the second call sets ${HAS_SANITIZER_thread} to 1

When no extra parameter is passed (e.g., aws_check_sanitizer("thread")), this check essentially transforms to if(NOT). Which looks kind of weird, but in practice works fine.

Description of changes:

Check for the number of passed parameter to determine which variable to use as out parameter.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sfod sfod merged commit 532820e into main Jul 15, 2024
52 checks passed
@sfod sfod deleted the fix-sanitizer-cmake branch July 15, 2024 16:59
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.

3 participants