Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

命令为带符号,应该如何导出? #170

Open
shuaniaun opened this issue Nov 1, 2023 · 3 comments
Open

命令为带符号,应该如何导出? #170

shuaniaun opened this issue Nov 1, 2023 · 3 comments

Comments

@shuaniaun
Copy link

shuaniaun commented Nov 1, 2023

void func(void)
{
;
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC), ASK?, func, func info);

此时因为有符号?,无法编译,但是我的命令确实要带符号,该怎么操作呢?

@NevermindZZT
Copy link
Owner

可以试试用 asii 转义 ASK\x3f

@shuaniaun
Copy link
Author

展开宏定义看了下,应该是不行的,变量名不能有特殊符号吧。
#define SHELL_EXPORT_CMD(_attr, _name, _func, _desc, ...)
const char shellCmd##_name[] = #_name;
const char shellDesc##_name[] = #_desc;
SHELL_USED const ShellCommand
shellCommand##_name SHELL_SECTION("shellCommand") =
{
.attr.value = _attr,
.data.cmd.name = shellCmd##_name,
.data.cmd.function = (int (*)())_func,
.data.cmd.desc = shellDesc##_name,
##VA_ARGS
}

@NevermindZZT
Copy link
Owner

那只能不用宏,直接把这个宏展开定义了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants