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

Ensure that context instance id storage is aligned correctly #365

Merged
merged 3 commits into from
Jan 3, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion rcl/include/rcl/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ extern "C"
#include "rcl/types.h"
#include "rcl/visibility_control.h"

#ifdef _MSC_VER
#define ALIGNAS_(N) __declspec(align(N))
#else
#include <stdalign.h>
#define ALIGNAS_(N) alignas(N)
sgvandijk marked this conversation as resolved.
Show resolved Hide resolved
#endif

typedef uint64_t rcl_context_instance_id_t;

struct rcl_context_impl_t;
Expand Down Expand Up @@ -132,7 +139,7 @@ typedef struct rcl_context_t
* See this paper for an effort to make this possible in the future:
* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0943r1.html
*/
uint8_t instance_id_storage[RCL_CONTEXT_ATOMIC_INSTANCE_ID_STORAGE_SIZE];
ALIGNAS_(8) uint8_t instance_id_storage[RCL_CONTEXT_ATOMIC_INSTANCE_ID_STORAGE_SIZE];
sgvandijk marked this conversation as resolved.
Show resolved Hide resolved
} rcl_context_t;

/// Return a zero initialization context object.
Expand Down