testbed踩坑:因为被测函数设置导致的重定义报错

[复制链接]
188|4
手机看帖
扫描二维码
随时随地手机跟帖
keer_zu|  楼主 | 2023-1-19 16:51 | 显示全部楼层
解决的思路还是:宏替换
下面给出一种方法。

使用特权

评论回复
keer_zu|  楼主 | 2023-1-19 16:52 | 显示全部楼层
下面是这种方法的具体描述:

9641963c904ce2e918.png

使用特权

评论回复
keer_zu|  楼主 | 2023-1-19 17:05 | 显示全部楼层
pre-include:

/*
* Pre-include code will be placed here
* this code is located at global scope and should consist of
* declarations, preprocessor directives (e.g. #include) or procedures
*/
static int loopValue=0;

int stub(void)
{
        if(loopValue)==0) {
                loopValue=1;
        } else {
                loopValue=0;
        }

        return loopValue;
}

#define while(expression) while(stub())

使用特权

评论回复
keer_zu|  楼主 | 2023-1-19 17:06 | 显示全部楼层
post-inclue code:

/*
* Post-include code will be placed here
* this code is located at global scope and should consist of
* declarations, preprocessor directives (e.g. #include) or procedures
*/
#undef while(expression)

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:qq群:49734243 Email:zukeqiang@gmail.com

1304

主题

12233

帖子

53

粉丝