[wip] gogensig: typedef havent defined type cause panic #88
+633
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#61
gnutls/gnutls.h
gnutls/compat.h
经过调查,发现是因为在gnutls/gnutls.h的底部,才引入<gnutls/compat.h>,而目前的处理逻辑是,对于一个头文件,先处理其include列表,处理结束后,才会处理本来的头文件,这就导致了gogensig 先处理gnutls/compat.h 的时候,gnutls_cipher_algorithm_t这个类型还没定义
可能的解决方案
llcppsigfetch 中能正确获得gnutls/compat.h中underlying type的原因是其遵守了C编译顺序,即先完成了类型的定义,再执行了include引入,所以这个引用顺序是没有错误的,能正确描述类型定义。而gogensig的头文件依赖关系的处理为无论这个include节点的位置在某个头文件的何处,都会先访问被include的文件。
目前存在两种解决方案
将gogensig的处理头文件的顺序,修改处理为与C语言的一致,即将include节点视为一个一般的声明节点,存在顺序,碰到include节点,就先处理对应include的文件转换,这个能保证更能正确的描述C语言的结构。
不修改整体处理逻辑,但补充处理到某个类型时,查看其对应节点的定义位置的头文件,是否已经被处理,如果没有被处理,那就优先访问转换。