Menu

#303 QM generates code with trailing whitespace

QM
closed
nobody
1
2022-09-02
2022-02-18
Dan
No

I have the latest bundle version 6.9.3 installed. I generated the C++ code with QM version 5.1.1.

I created a very simple active object with a state machine. If the state name or embedded state name is long enough, the code generated inserts comments. And if the state name is just long enough, the comment inserts a trailing white space character at the end of the line. This triggers a dirty file using the qclean.exe tool.

I attached the model file that shows the trailing white space at the end of the comment line in the generated code.

Here is the output from the qclean tool:

C:\Perforce\sandbox\QM_trail_whitespace_bug>qclean . -r
QClean 6.9.2 Copyright (c) 2005-2020 Quantum Leaps
Documentation: https://www.state-machine.com/qtools/qclean.html
Usage: qclean [root-dir] [options]
       root-dir root directory for recursive cleanup (default is .)
       options  control the cleanup, -h prints the help
root-directory: .
-r check also read-only files
.
C:\Perforce\sandbox\QM_trail_whitespace_bug\ExampleActor.cpp FOUND(Read-only,Trail-WS,)

-------------------------------------------------------------------------------
Files processed:1 read-only:1(checked), cleaned:0, still-dirty:1

Here is a code snippet of the generated code:

//.${Actors::ExampleActor::SM::OuterState::MiddleState::InnerState_123456789} 
QP::QMState const ExampleActor::InnerState_123456789_s = {
    &ExampleActor::MiddleState_s, // superstate
    &ExampleActor::InnerState_123456789,
    Q_ACTION_NULL, // no entry action
    Q_ACTION_NULL, // no exit action
    Q_ACTION_NULL  // no initial tran.
};

The first line of the code snippet above has the trailing white space.

1 Attachments

Discussion

  • Dan

    Dan - 2022-02-18

    Normally, the comment that is generated adds the '.' character at the end of the comment line. For example:

    //.${Actors::ExampleActor::SM::OuterState::MiddleState::InnerState_12345678} .
    QP::QMState const ExampleActor::InnerState_12345678_s = {
        &ExampleActor::MiddleState_s, // superstate
        &ExampleActor::InnerState_12345678,
        Q_ACTION_NULL, // no entry action
        Q_ACTION_NULL, // no exit action
        Q_ACTION_NULL  // no initial tran.
    };
    

    As you can see, the first line has a period at the end of the comment line. I assume the QM tool doesn't handle the use case of the state name being long enough to not include the period characters and includes the white space at the end of the comment line.

     
  • Quantum Leaps

    Quantum Leaps - 2022-09-02
    • status: open --> closed
     
  • Quantum Leaps

    Quantum Leaps - 2022-09-02

    Fixed in QM 5.1.4.

     

Anonymous
Anonymous

Add attachments
Cancel