Skip to content

add tests for stdatomic_helper.h and fix bugs - #150

Merged
sloretz merged 4 commits into
masterfrom
sloretz/win32_double_pointer_atomic
Apr 11, 2019
Merged

sloretz merged 4 commits into
masterfrom
sloretz/win32_double_pointer_atomic

Conversation

@sloretz

@sloretz sloretz commented Apr 10, 2019

Copy link
Copy Markdown
Contributor

This adds a test for stdatomic_helper.h and fixes a couple bugs:

  • Adds <stddef.h> for the ptrdiff_t type
  • Ignores C4047 and C4024 which occur when creating atomic pointers on windows
    • C4024
      • When using int * the compiler complains that the value to exchange passed to InterlockedExchange...() functions has a different type than the function expects. This doesn't matter because all we care about is the size.
    • C4047
      • When using int * the compiler complains that int * has more levels of indirection than the expected type of the parameter of all the InterlockedExchange...() functions. This also doesn't matter because all we care about is the size.
Warnings without ignoring C4047 and C4024
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4047: '=': 'int *' differs in levels of indirection from 'LONG64' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4047: '=': 'int *' differs in levels of indirection from 'LONG' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4047: '=': 'int *' differs in levels of indirection from 'short' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4047: '=': 'int *' differs in levels of indirection from 'char' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4047: 'function': 'LONG64' differs in levels of indirection from 'int *' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4024: '_InterlockedExchange64': different types for formal and actual parameter 2 [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4047: 'function': 'LONG' differs in levels of indirection from 'int *' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4024: '_InterlockedExchange': different types for formal and actual parameter 2 [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4047: 'function': 'SHORT' differs in levels of indirection from 'int *' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4024: '_InterlockedExchange16': different types for formal and actual parameter 2 [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4047: '=': 'int *' differs in levels of indirection from 'SHORT' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4047: 'function': 'CHAR' differs in levels of indirection from 'int *' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4024: '_InterlockedExchange8': different types for formal and actual parameter 2 [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(82): warning C4047: '=': 'int *' differs in levels of indirection from 'CHAR' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4047: '=': 'int **' differs in levels of indirection from 'LONG64' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4047: '=': 'int **' differs in levels of indirection from 'LONG' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4047: '=': 'int **' differs in levels of indirection from 'short' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4047: '=': 'int **' differs in levels of indirection from 'char' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4047: 'function': 'LONG64' differs in levels of indirection from 'int **' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4024: '_InterlockedExchange64': different types for formal and actual parameter 2 [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4047: 'function': 'LONG' differs in levels of indirection from 'int **' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4024: '_InterlockedExchange': different types for formal and actual parameter 2 [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4047: 'function': 'SHORT' differs in levels of indirection from 'int **' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4024: '_InterlockedExchange16': different types for formal and actual parameter 2 [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4047: '=': 'int **' differs in levels of indirection from 'SHORT' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4047: 'function': 'CHAR' differs in levels of indirection from 'int **' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4024: '_InterlockedExchange8': different types for formal and actual parameter 2 [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
C:\Users\osrf\Desktop\sloretz_ws\ws\src\ros2\rcutils\test\test_atomics.c(83): warning C4047: '=': 'int **' differs in levels of indirection from 'CHAR' [C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\test_atomics_executable.vcxproj]
  test_atomics_executable.vcxproj -> C:\Users\osrf\Desktop\sloretz_ws\ws\build\rcutils\Release\test_atomics_executable.exe

sloretz added 3 commits April 10, 2019 16:03
C4047 and C4024 trigger when creating an atomic pointer
These don't matter because the switch statement is just picking a
function with the right sized atomic. The types used don't matter.

Signed-off-by: Shane Loretz <[email protected]>
Signed-off-by: Shane Loretz <[email protected]>
@sloretz sloretz added the in review Waiting for review (Kanban column) label Apr 10, 2019
@sloretz sloretz self-assigned this Apr 10, 2019
@sloretz

sloretz commented Apr 10, 2019

Copy link
Copy Markdown
Contributor Author

CI (testing rcutils)

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Signed-off-by: Shane Loretz <[email protected]>
@sloretz

sloretz commented Apr 11, 2019

Copy link
Copy Markdown
Contributor Author

CI after fixing cpplint warnings testing just rcutils

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@sloretz
sloretz merged commit 822a4b9 into master Apr 11, 2019
@sloretz
sloretz deleted the sloretz/win32_double_pointer_atomic branch April 11, 2019 22:49
@sloretz sloretz removed the in review Waiting for review (Kanban column) label Apr 11, 2019
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