【发布时间】:2014-11-04 16:26:37
【问题描述】:
我在弄清楚下一步该怎么做时遇到了问题。
我有以下代码:
test.cpp
#include <stdio.h>
void
function(void) {printf("Hellow ");}
int main(void) {
printf("World\n");
return 0;
}
我想把它改造成下一个:
#include <stdio.h>
void
function(void) {printf("Hellow ");}
int main(void) {
function();
printf("World\n");
return 0;
}
使用 gcc 插件。
在我的插件中不起作用的代码是这个:
...
tree function_fn;
tree function_fn_type;
function_fn_type=build_function_type_list(void_type_node, void_type_node, NULL_TREE);
function_fn = build_fn_decl ("function", function_fn_type);
gimple call = gimple_build_call (funcion_fn, 0);
gsi_insert_before (&gsi, call, GSI_NEW_STMT);
...
然后,当我使用插件编译 test.cpp 时,我收到下一条错误消息:
/tmp/cc2VRszt.o:在函数main':
test.cpp:(.text+0x60): Undefined reference tofunction'中
谁能帮帮我?
【问题讨论】:
标签: c++ gcc gcc-plugins gimple