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

[orchagent] Arm 32-bit arch compilation warning Fixes #1488

Merged
merged 2 commits into from
Nov 10, 2020

Conversation

Sabareesh-Kumar-Anandan
Copy link
Contributor

Signed-off-by: Sabareesh Kumar Anandan [email protected]

What I did
Replaced %l variants with PRI format specifier to fix compilation warnings for arm 32-bit arch

Why I did it

How I verified it
Compiled and verified for arm 32-bit arch (marvell-armhf)

Details if related

@@ -748,7 +748,7 @@ bool MirrorOrch::setUnsetPortMirror(Port port,
if (set)
{
port_attr.value.objlist.count = 1;
port_attr.value.objlist.list = (long unsigned int *)calloc(port_attr.value.objlist.count, sizeof(sai_object_id_t));
port_attr.value.objlist.list = reinterpret_cast<sai_object_id_t *>((void *)calloc(port_attr.value.objlist.count, sizeof(sai_object_id_t)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calloc [](start = 83, length = 6)

calloc already returns a void *. Why you need to convert explicitly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reinterpret cast reports error if we don't explicitly type cast

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean why convert calloc to void *. It is already void *.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed explicit cast

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comment

Signed-off-by: Sabareesh Kumar Anandan <[email protected]>
@qiluo-msft qiluo-msft merged commit bed7970 into sonic-net:master Nov 10, 2020
daall pushed a commit to daall/sonic-swss that referenced this pull request Dec 7, 2020
**What I did**
Replaced %l variants with PRI format specifier to fix compilation warnings for arm 32-bit arch

**How I verified it**
Compiled and verified for arm 32-bit arch (marvell-armhf)

* [orchagent] Arm 32-bit arch compilation warning Fixes
* [orchagent] removed explicit type cast
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