Open Kamilcuk opened 3 years ago
The following innocent looking cmake file:
ctest_memcheck(a)
Yes, just one line, causes:
/work # cmake-lint ./cmake/k/dashboard_lib.cmake ERROR parsed an empty subtree at Token(type=WORD, content='a', line=2, col=15): └─ StandardArgTree: 0:0 pspec: (0, False, [], ['APPEND', 'QUIET'], True, None, None) Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/cmakelang/lint/__main__.py", line 185, in main return inner_main() File "/usr/lib/python3.9/site-packages/cmakelang/lint/__main__.py", line 168, in inner_main process_file(cfg, local_ctx, intext) File "/usr/lib/python3.9/site-packages/cmakelang/lint/__main__.py", line 45, in process_file parse_tree = parse.parse(tokens, ctx) File "/usr/lib/python3.9/site-packages/cmakelang/parse/__init__.py", line 68, in parse return BodyNode.consume(ctx, tokens) File "/usr/lib/python3.9/site-packages/cmakelang/parse/body_nodes.py", line 67, in consume subtree = StatementNode.consume(ctx, tokens) File "/usr/lib/python3.9/site-packages/cmakelang/parse/statement_node.py", line 89, in consume node.argtree = subtree = parse_fun(ctx, tokens, breakstack) File "/usr/lib/python3.9/site-packages/cmakelang/parse/funs/random.py", line 142, in parse_ctest_memcheck return StandardArgTree.parse(ctx, tokens, 0, kwargs, flags, breakstack) File "/usr/lib/python3.9/site-packages/cmakelang/parse/argument_nodes.py", line 224, in parse return cls.parse2( File "/usr/lib/python3.9/site-packages/cmakelang/parse/argument_nodes.py", line 192, in parse2 raise InternalError( cmakelang.common.InternalError
To reproduce:
docker run --rm alpine sh -xc ' apk add cmake py-pip ; echo "ctest_memcheck(a)" > ./file.cmake ; pip install cmake-format ; cmake-lint ./file.cmake '
Source is here: https://github.com/cheshirekow/cmake_format/blob/904c42da298f7fda932d9ac774517c20e2667fb8/cmakelang/parse/funs/random.py#L142 - should it be parse(..., 0, ...) ? What does the 0 mean? It's the only difference I see between the other parse calls.
parse(..., 0, ...)
0
The real code actually is valid and passes needed arguments like:
macro(my_wrapper_ctest_memcheck) ctest_memcheck(${ARGV}) endmacro()
However, because of the internal error, I can't disable the check.
The following innocent looking cmake file:
Yes, just one line, causes:
To reproduce:
Source is here: https://github.com/cheshirekow/cmake_format/blob/904c42da298f7fda932d9ac774517c20e2667fb8/cmakelang/parse/funs/random.py#L142 - should it be
parse(..., 0, ...)
? What does the0
mean? It's the only difference I see between the other parse calls.The real code actually is valid and passes needed arguments like:
However, because of the internal error, I can't disable the check.