Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix wcast align warnings on ARM #197

Merged
merged 2 commits into from
Jul 11, 2022

Conversation

PonomarevDA
Copy link
Contributor

During building the canard.c with arm compiler with Wcast-align flag, few warnings appear.
To reproduce these warnings, you may type the command below:

arm-none-eabi-gcc libcanard/canard.c -c -Wcast-align

It returns the following warnings:

libcanard/canard.c: In function 'txAVLPredicate':
libcanard/canard.c:327:45: warning: cast increases required alignment of target type [-Wcast-align]
  327 |     const CanardTxQueueItem* const other  = (const CanardTxQueueItem*) node;
      |                                             ^
libcanard/canard.c: In function 'rxSubscriptionPredicateOnPortID':
libcanard/canard.c:948:38: warning: cast increases required alignment of target type [-Wcast-align]
  948 |     const CanardPortID  other     = ((const CanardRxSubscription*) node)->port_id;
      |                                      ^
libcanard/canard.c: In function 'canardTxPeek':
libcanard/canard.c:1055:15: warning: cast increases required alignment of target type [-Wcast-align]
 1055 |         out = (const CanardTxQueueItem*) cavlFindExtremum(que->root, false);
      |               ^
libcanard/canard.c: In function 'canardRxAccept':
libcanard/canard.c:1099:21: warning: cast increases required alignment of target type [-Wcast-align]
 1099 |                     (CanardRxSubscription*) cavlSearch(&ins->rx_subscriptions[(size_t) model.transfer_kind],
      |                     ^
libcanard/canard.c: In function 'canardRxUnsubscribe':
libcanard/canard.c:1179:55: warning: cast increases required alignment of target type [-Wcast-align]
 1179 |         CanardRxSubscription* const sub             = (CanardRxSubscription*)
      |

This PR simply adds a new job with libcanard building for ARM to the github workflow that reproduces these warnings and an intermediate cast to (void*) to prevent these warnings.

@coderkalyan coderkalyan merged commit 106ceaf into OpenCyphal:master Jul 11, 2022
pavel-kirienko added a commit that referenced this pull request Jul 15, 2022
* Fix issues discovered by Sonar

* Update README.md
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants