cmake: fix undefined function name in parse args error messages
Some checks are pending
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions

nuttx_parse_function_args declares FUNC as its one-value keyword, so
the parsed variable is IN_FUNC, but both FATAL_ERROR messages
referenced a never-defined IN_NAME, printing an empty function name
for every argument-misuse diagnostic of every wrapper that uses this
parser. Reference IN_FUNC instead.

Before:
```
CMake Error ...: : unparsed WRONG;x
```

After:
```
CMake Error ...: myfunc: unparsed WRONG;x
```

Assisted-by: Claude Code (glm-5.3) <claude@anthropic.com>
Signed-off-by: Junbo Zheng <zhengjunbo1@xiaomi.com>
This commit is contained in:
Junbo Zheng 2026-09-11 10:14:51 +08:00 committed by Xiang Xiao
parent 87859194dd
commit 1ed0db7af4

View file

@ -73,14 +73,14 @@ function(nuttx_parse_function_args)
"${IN_MULTI_VALUE}" "${IN_ARGN}")
if(OUT_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "${IN_NAME}: unparsed ${OUT_UNPARSED_ARGUMENTS}")
message(FATAL_ERROR "${IN_FUNC}: unparsed ${OUT_UNPARSED_ARGUMENTS}")
endif()
foreach(arg ${IN_REQUIRED})
if(NOT OUT_${arg})
if(NOT "${OUT_${arg}}" STREQUAL "0")
message(
FATAL_ERROR "${IN_NAME} requires argument ${arg}\nARGN: ${IN_ARGN}")
FATAL_ERROR "${IN_FUNC} requires argument ${arg}\nARGN: ${IN_ARGN}")
endif()
endif()
endforeach()