Menu

Transition Arguments gives Warning

torkio
2014-10-23
2014-11-02
  • torkio

    torkio - 2014-10-23

    Hello

    I am trying to use a Transition Argument to be passed to an Action

    Exit
    {
     enter(path : std::string)
         Enter
         {
             actionEnter(path);
         }
     Default nil {}
    

    }

    In the generated SMC class is present a function with a not used path parameter

    void ExitControllerState::exit(ExitFSMContext& context, std::string path)
    {
            Default(context);
            return;
    }
    

    and during compilation C++ I get a warning message: warning: unused parameter

    do I make something wrong?
    is it possible to avoid this warning?

    Thanks
    Paolo

     
  • Charles Rapp

    Charles Rapp - 2014-11-02

    I regret to say this warning is due to SMC including the parameter name "path" in ExitControllerState.exit argument list because SMC cannot know that the method does not use path.

    You are doing nothing wrong.
    There is nothing you can do to avoid this warning.

    Getting rid of this warning would require SMC checking each transition parameter to see if it is used in any of the transition actions. There is the problem.

    SMC does not parse action arguments. The code between "actionEnter(" and ")" is copied directly to the generated C++ code. The reason this is done is because SMC supports many programming languages, with different ways of passing parameters.

    I am sorry for the compiler warnings but the effort it would take to remove it would require significant effort which would result in buggy code. It would also require SMC to have language-specific knowledge in order to parse the transition action parameters, an I do not wish to put such knowledge into SMC.

     

Log in to post a comment.