Search code examples
functiondeclarationautosar

Autosar function declaration


I am working on an Autosar project developing a SWC(Software Component) using C, I encountered a new function declaration that I don't understand as following :

FUNC(void, RTE_SWC_CODE) SWC_Task(uint8 Argument) 
{
   //Code goes here
}

I searched for this type of declaration on the internet and I didn't find anything explaining it right.

what I don't understand is the FUNC(Void, RTE_SWC_CODE)

Do Void refers to the type of return?

And RTE_SWC_CODE is referring to what for the function?

RTE_SWC_CODE is defined in another rte_file.h like this

#define RTE_SWC_CODE 

Solution

  • In AUTOSAR there is one specification related to compiler abstraction refer that specification.FUNC is a macro defined in Compiler.h header file.The definition of macro looks like below

    #define FUNC(type, memclass) type memclass 
    rettype     return type of the function   
    memclass    classification of the function itself
    

    In your case it would be like this

    void RTE_SWC_CODE SWC_Task(uint8 Argument) //After preprocssing