Skip to content

Fix compiler error when compiling with -Wcast-qual and mocking const function arguments#504

Merged
mvandervoord merged 1 commit intoThrowTheSwitch:masterfrom
bal-stan:patch-1
Jul 9, 2025
Merged

Fix compiler error when compiling with -Wcast-qual and mocking const function arguments#504
mvandervoord merged 1 commit intoThrowTheSwitch:masterfrom
bal-stan:patch-1

Conversation

@bal-stan
Copy link
Contributor

@bal-stan bal-stan commented Apr 1, 2025

In summary:

  • void * casts can be removed because in the definition of UNITY_TEST_ASSERT_EQUAL_MEMORY and UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY the arguments are cast to UNITY_INTERNAL_PTR, which by default is const void *.
  • This also fixes compilation error if the arguments are already const pointers and building with strict const correctness flags.

@bal-stan
Copy link
Contributor Author

@mvandervoord would you mind approving this, please? 😅

@mvandervoord mvandervoord self-requested a review July 9, 2025 20:25
@mvandervoord mvandervoord merged commit 2671ad7 into ThrowTheSwitch:master Jul 9, 2025
4 checks passed
@bal-stan bal-stan deleted the patch-1 branch July 10, 2025 10:36
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.

2 participants