Skip to content

fmtscan cannot pass the static analysis #255

Closed
@lumynou5

Description

@lumynou5

fmtscan introduced in #254 cannot pass the static analysis.

tools/fmtscan.c:659:29: style: The scope of the variable 'nextch2' can be reduced. [variableScope]
        get_char_t nextch1, nextch2;
                            ^
tools/fmtscan.c:362:11: style: Variable 'ptr' can be declared as pointer to const [constVariablePointer]
    char *ptr, *dict;
          ^
tools/fmtscan.c:1071:55: style: Parameter 'p' can be declared as pointer to const. However it seems that 'parse_eof' is a callback function, if 'p' is declared with const you might also need to cast function pointer(s). [constParameterCallback]
static inline get_char_t parse_eof(parser_t *restrict p UNUSED,
                                                      ^
tools/fmtscan.c:1190:20: note: You might need to cast the function pointer here
    [PARSER_EOF] = parse_eof,
                   ^
tools/fmtscan.c:1071:55: note: Parameter 'p' can be declared as pointer to const
static inline get_char_t parse_eof(parser_t *restrict p UNUSED,
                                                      ^
tools/fmtscan.c:1072:54: style: Parameter 't' can be declared as pointer to const. However it seems that 'parse_eof' is a callback function, if 't' is declared with const you might also need to cast function pointer(s). [constParameterCallback]
                                   token_t *restrict t UNUSED,
                                                     ^
tools/fmtscan.c:1190:20: note: You might need to cast the function pointer here
    [PARSER_EOF] = parse_eof,
                   ^
tools/fmtscan.c:1072:54: note: Parameter 't' can be declared as pointer to const
                                   token_t *restrict t UNUSED,
                                                     ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions