Repository navigation
Compile Flag Fixes - #276
jpsamper2009 wants to merge 1 commit into
Conversation
|
I don't know why GitHub says I added the "in review" label, I don't recall doing that. Could it be something waffle did by itself? Anyway, I've removed the label from here and the other two pull requests. |
|
Yes it looks like waffle picks your account sometimes to set labels. All 3rd party contributions come Thanks for monitoring though ! |
| RCL_CHECK_ARGUMENT_FOR_NULL(parameter_files, RCL_RET_INVALID_ARGUMENT, allocator); | ||
| *(parameter_files) = allocator.allocate( | ||
| sizeof(char *) * arguments->impl->num_param_files_args, allocator.state); | ||
| sizeof(char *) * (size_t)arguments->impl->num_param_files_args, allocator.state); |
There was a problem hiding this comment.
Hm, it looks like num_params_files_args (https://github.com/ros2/rcl/blob/master/rcl/src/rcl/arguments_impl.h#L38) is always used as an unsigned number (which makes sense, since it is the "number" of things). Thus, I'd suggest that we actually change the type in the structure, rather than casting it here (in a quick test I did here, that seems to be OK).
| if (args_impl->num_remap_rules > 0) { | ||
| args_impl->remap_rules = rcutils_reallocf( | ||
| args_impl->remap_rules, sizeof(rcl_remap_t) * args_impl->num_remap_rules, &allocator); | ||
| args_impl->remap_rules, sizeof(rcl_remap_t) * (size_t)args_impl->num_remap_rules, &allocator); |
There was a problem hiding this comment.
Similarly, it looks like num_remap_rules could probably be a size_t in the structure, rather than doing this cast.
| if (args->impl->num_unparsed_args) { | ||
| *output_unparsed_indices = allocator.allocate( | ||
| sizeof(int) * args->impl->num_unparsed_args, allocator.state); | ||
| sizeof(int) * (size_t)args->impl->num_unparsed_args, allocator.state); |
There was a problem hiding this comment.
And the same for num_unparsed_args.
| return rcl_get_system_time(data, current_time); | ||
| } | ||
| *current_time = rcl_atomic_load_uint64_t(&(t->current_time)); | ||
| *current_time = (rcl_time_point_value_t)rcl_atomic_load_uint64_t(&(t->current_time)); |
There was a problem hiding this comment.
Hmpf, I can't say I love this. If we look carefully at the types, t->current_time is of type atomic_uint_least64_t (https://github.com/ros2/rcl/blob/master/rcl/src/rcl/time.c#L30). rcl_atomic_load_uint64_t expects a uint64 argument expects an atomic_uint_least64_t pointer as the input argument, so we are good so far. Then rcl_atomic_load_uint64_t returns a uint64_t (https://github.com/ros2/rcl/blob/master/rcl/src/rcl/stdatomic_helper.h#L72), and here we get into trouble. The next thing we are going to do is to store this into *current_time which is rcl_time_point_value_t -> rcutils_time_point_value_t -> int64_t. So now we are storing an unsigned into a signed, potentially changing the interpretation. I'm not sure how much it matters in this case since it is a 64-bit load, but this doesn't seem quite right. @tfoote , any thoughts on this?
| clock->pre_update(); | ||
| } | ||
| rcl_atomic_store(&(storage->current_time), time_value); | ||
| rcl_atomic_store(&(storage->current_time), (uint64_t)time_value); |
There was a problem hiding this comment.
And this is the same int64/uint64 mismatch.
| atomic_init(&impl.period, period); | ||
| atomic_init(&impl.last_call_time, now); | ||
| atomic_init(&impl.period, (unint64_t)(period)); | ||
| atomic_init(&impl.last_call_time, (unit64_t)(now)); |
There was a problem hiding this comment.
And again, these casts are needed because this is a type mismatch. There may more down below, but I'm going to stop there. In general I think it is a better idea to look at and think about why the cast is needed, and try to fix the root cause. I know it is not always possible because some of the types are pre-defined for us, but for the types we do have control of it is better to use consistent types.
|
@jpsamper2009 Friendly ping. Do you think you'll have time to pick this and ros2/rcutils#114 back up? Thanks. |
|
@clalancette This PR was a for a much older version of the code -- and it was done by me on behalf of someone else. I'll close it and readdress with a newer version (if the issues still exist). Sorry for the long wait. |
Description
connects to ros2/rcutils#114