What is the method of defining the Function Prototype

Questions and discussions about MISRA C not fitting under migration or rules forums

Moderators: misra-c, david ward

prem_annam
Posts: 3
Joined: Wed Aug 01, 2018 1:52 pm
Company: General

What is the method of defining the Function Prototype

Postby prem_annam » Thu Aug 23, 2018 5:21 am

Hi,

I am facing the MISRA.VAR.HIDDEN error.

When i defined the function prototype with parameters and using the same parameters name while calling the function.

Can any one give me suggestion how can it will be modified to avoid the error.

Thanks in advance.

dg1980
Posts: 108
Joined: Wed Apr 27, 2016 2:33 pm
Company: Elektrobit Automotive GmbH

Re: What is the method of defining the Function Prototype

Postby dg1980 » Thu Aug 23, 2018 10:10 am

Can you provide a code snippet demonstrating the problem?
Also, which rule is reported as being violated (i assume MISRA.VAR.HIDDEN is some kind of incomplete static analyis tool output)?

phaedsys
Posts: 50
Joined: Fri Sep 17, 2004 10:53 pm
Company: Phaedrus Systems
Location: Phaedrus Systems Tamworth, UK
Contact:

Re: What is the method of defining the Function Prototype

Postby phaedsys » Thu Aug 23, 2018 10:43 am

Hi

This looks to be a tool specific question. They support team for the tool should be abler to help. They can tell you what the actual violation the tool is picking up. Then you can fix that. If you still have a question on MISRA implementation then ask again.
This post is made in a personal capacity
Member of MISRA-C-WG since 2002

phaedsys
Posts: 50
Joined: Fri Sep 17, 2004 10:53 pm
Company: Phaedrus Systems
Location: Phaedrus Systems Tamworth, UK
Contact:

Re: What is the method of defining the Function Prototype

Postby phaedsys » Thu Aug 23, 2018 10:44 am

delete miss post
This post is made in a personal capacity
Member of MISRA-C-WG since 2002

prem_annam
Posts: 3
Joined: Wed Aug 01, 2018 1:52 pm
Company: General

Re: What is the method of defining the Function Prototype

Postby prem_annam » Thu Aug 23, 2018 12:42 pm

dg1980 wrote:Can you provide a code snippet demonstrating the problem?
Also, which rule is reported as being violated (i assume MISRA.VAR.HIDDEN is some kind of incomplete static analyis tool output)?



Hi,
This is thefunction prototype : int wc_ed25519_init(ed25519_key* key);
and the function call is ret = wc_ed25519_init(keyPair);

ERROR:Identifier 'key' hides identifier in an outer scope which is reported from KlocWork tool analysis.

dg1980
Posts: 108
Joined: Wed Apr 27, 2016 2:33 pm
Company: Elektrobit Automotive GmbH

Re: What is the method of defining the Function Prototype

Postby dg1980 » Thu Aug 23, 2018 5:01 pm

Looks like there might be a global variable named key somewhere.
The message should disappear if you rename either of them.

misra-c
Posts: 547
Joined: Thu Jan 05, 2006 1:11 pm

Re: What is the method of defining the Function Prototype

Postby misra-c » Thu Oct 04, 2018 11:13 am

The MISRA C working group can not make comments about particular tools, but the post by dg1980 would appear relevent.
---
Posted by and on behalf of
the MISRA C Working Group


Return to “General Questions”

Who is online

Users browsing this forum: No registered users and 1 guest