Anonymous enums and structs not followed by a single space

Issue #67 new
t b created an issue

Anonymous enumerations and structures will not be followed by a single space. I do not believe there is any way around this. To solve the problem I added an else if statement to handle the special cases. Basically it will not report and error if enum or struct is followed by a new line character. I will include the code if you would like to include it or write the same thing in a different way.

if {$tokenName == "space" && $tokenValue == " "} {
        set state "space"
} elseif {$tokenName == "newline" && $tokenValue == "\n" && 
        (${keywordValue} == "enum" || ${keywordValue} == "struct")} {
        set state "space"
} else {
       report $f $lineNumber "keyword \'${keywordValue}\' not followed by a single space"
                set state "other"
}

here is an example of the enumeration that I am talking about.

enum
{
    GPU_COLUMN_NAME,        
    GPU_COLUMN_TEMP_SPEED,
    GPU_COLUMN_UTILIZATION,
    GPU_COLUMN_CUDA_LOCK
};

Rule T003. Keyword 'enum' not followed by a single space

Comments (2)

  1. Log in to comment