diff --git "a/LLVM Parallel Universe Project/\351\227\256\351\242\230\345\256\232\344\275\215\346\200\273\347\273\223/call to undeclared function\351\227\256\351\242\230.md" "b/LLVM Parallel Universe Project/\351\227\256\351\242\230\345\256\232\344\275\215\346\200\273\347\273\223/call to undeclared function\351\227\256\351\242\230.md" new file mode 100644 index 0000000000000000000000000000000000000000..81ddb7fb178ff85abff52507e55786c80b84faa9 --- /dev/null +++ "b/LLVM Parallel Universe Project/\351\227\256\351\242\230\345\256\232\344\275\215\346\200\273\347\273\223/call to undeclared function\351\227\256\351\242\230.md" @@ -0,0 +1,25 @@ +# 1、问题现象 + +`[ 705s] test/regress.c:3689:12: error: call to undeclared function 'event_base_start_iocp_'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]` + +`[ 705s] test/regress.c:3691:2: error: call to undeclared function 'event_base_stop_iocp_'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]` + +# 2、问题定位 + +## 2.1、问题定位分析 + +[add-testcases-for-event.c-apis.patch](https://gitee.com/src-openeuler/libevent/blob/6fd712438bafd9eafdb3cf3b3e9d66913378b2a3/add-testcases-for-event.c-apis.patch)是对regress.c的patch,该patch中调用了函数`event_base_start_iocp_`与`event_base_stop_iocp_`但忘记了#include其所在的头文件"iocp-internal.h" + +## 2.2 gcc与clang对于调用未声明函数的差异处理 + +对于调用未声明的函数,clang对于语法要求更加严格,会直接报错,而gcc则较为宽松,仅仅对其进行警告,并询问是否是要调用已包含的其他名称相近的函数 + +![gcc遇到未声明函数时的表现](https://foruda.gitee.com/images/1725034630272359183/577103f3_13034847.png "屏幕截图") + +## 2.3、问题总结及根因确认 + +[add-testcases-for-event.c-apis.patch](https://gitee.com/src-openeuler/libevent/blob/6fd712438bafd9eafdb3cf3b3e9d66913378b2a3/add-testcases-for-event.c-apis.patch)是对regress.c的patch,该patch中调用了函数`event_base_start_iocp_`与`event_base_stop_iocp_`但忘记了#include其所在的头文件"iocp-internal.h",gcc对于调用未声明函数会进行模糊处理,仅仅warning,而clang会报error + +# 3、修改建议 + +补充打一个patch,在regress.c中#include "iocp-internal.h",参考:[Fix function undeclared,incompatible pointer and parameter lack in 'add-testcases-for-event.c-apis.patch',support clang build · Pull Request !74 · src-openEuler/libevent - Gitee.com](https://gitee.com/src-openeuler/libevent/pulls/74) \ No newline at end of file