Skip to content

Commit

Permalink
Fix useless-cast warning
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Feb 12, 2024
1 parent 7f55a9c commit 807c368
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/aws/common/array_list.inl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ AWS_STATIC_IMPL
void aws_array_list_clean_up_secure(struct aws_array_list *AWS_RESTRICT list) {
AWS_PRECONDITION(AWS_IS_ZEROED(*list) || aws_array_list_is_valid(list));
if (list->alloc && list->data) {
aws_secure_zero((void *)list->data, list->current_size);
aws_secure_zero(list->data, list->current_size);
aws_mem_release(list->alloc, list->data);
}

Expand Down
18 changes: 18 additions & 0 deletions include/aws/common/math.inl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ AWS_STATIC_IMPL size_t aws_mul_size_saturating(size_t a, size_t b) {
#if SIZE_BITS == 32
return (size_t)aws_mul_u32_saturating(a, b);
#elif SIZE_BITS == 64
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuseless-cast"
return (size_t)aws_mul_u64_saturating(a, b);
# pragma GCC diagnostic pop
#else
# error "Target not supported"
#endif
Expand All @@ -100,7 +103,10 @@ AWS_STATIC_IMPL int aws_mul_size_checked(size_t a, size_t b, size_t *r) {
#if SIZE_BITS == 32
return aws_mul_u32_checked(a, b, (uint32_t *)r);
#elif SIZE_BITS == 64
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuseless-cast"
return aws_mul_u64_checked(a, b, (uint64_t *)r);
# pragma GCC diagnostic pop
#else
# error "Target not supported"
#endif
Expand All @@ -113,7 +119,10 @@ AWS_STATIC_IMPL size_t aws_add_size_saturating(size_t a, size_t b) {
#if SIZE_BITS == 32
return (size_t)aws_add_u32_saturating(a, b);
#elif SIZE_BITS == 64
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuseless-cast"
return (size_t)aws_add_u64_saturating(a, b);
# pragma GCC diagnostic pop
#else
# error "Target not supported"
#endif
Expand All @@ -127,7 +136,10 @@ AWS_STATIC_IMPL int aws_add_size_checked(size_t a, size_t b, size_t *r) {
#if SIZE_BITS == 32
return aws_add_u32_checked(a, b, (uint32_t *)r);
#elif SIZE_BITS == 64
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuseless-cast"
return aws_add_u64_checked(a, b, (uint64_t *)r);
# pragma GCC diagnostic pop
#else
# error "Target not supported"
#endif
Expand All @@ -137,7 +149,10 @@ AWS_STATIC_IMPL size_t aws_sub_size_saturating(size_t a, size_t b) {
#if SIZE_BITS == 32
return (size_t)aws_sub_u32_saturating(a, b);
#elif SIZE_BITS == 64
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuseless-cast"
return (size_t)aws_sub_u64_saturating(a, b);
# pragma GCC diagnostic pop
#else
# error "Target not supported"
#endif
Expand All @@ -147,7 +162,10 @@ AWS_STATIC_IMPL int aws_sub_size_checked(size_t a, size_t b, size_t *r) {
#if SIZE_BITS == 32
return aws_sub_u32_checked(a, b, (uint32_t *)r);
#elif SIZE_BITS == 64
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wuseless-cast"
return aws_sub_u64_checked(a, b, (uint64_t *)r);
# pragma GCC diagnostic pop
#else
# error "Target not supported"
#endif
Expand Down

0 comments on commit 807c368

Please sign in to comment.