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

gogensig:fix unexpect receiver duplicate init #95

Merged
merged 2 commits into from
Dec 26, 2024

Conversation

luoliwoshang
Copy link
Contributor

@luoliwoshang luoliwoshang commented Dec 25, 2024

fix #67

  • 对于处理为receiver的函数,阻止不预期的对receiver的重复获取
  • 对于重复的隐式前向声明,进行复用,而不是重新创建导致重复声明

对于issue中的libcares 的redefine问题已经可以解决

{
	"name": "libcares",
	"cflags": "$(pkg-config --cflags libcares)",
	"libs": "$(pkg-config --libs libcares)",
	"include": [
		"ares.h",
		"ares_dns_record.h"
	],
	"deps": null,
	"trimPrefixes": [],
	"cplusplus": false
}

仅保留预期的 /c/unix/net 没有引用的错误

2024/12/25 19:18:06 NewFuncDecl ares_dns_rr_set_u8 Fail: ares_dns_rr_set_u8 symbol not found
2024/12/25 19:18:06 NewFuncDecl: &{ares_dns_rr_set_u16}
2024/12/25 19:18:06 NewFuncDecl ares_dns_rr_set_u16 Fail: ares_dns_rr_set_u16 symbol not found
2024/12/25 19:18:06 NewFuncDecl: &{ares_dns_rr_set_u32}
2024/12/25 19:18:06 NewFuncDecl ares_dns_rr_set_u32 Fail: ares_dns_rr_set_u32 symbol not found
2024/12/25 19:18:06 NewFuncDecl: &{ares_dns_rr_set_bin}
2024/12/25 19:18:06 NewFuncDecl ares_dns_rr_set_bin Fail: ares_dns_rr_set_bin symbol not found
2024/12/25 19:18:06 NewFuncDecl: &{ares_dns_rr_add_abin}
2024/12/25 19:18:06 NewFuncDecl ares_dns_rr_add_abin Fail: ares_dns_rr_add_abin symbol not found
2024/12/25 19:18:06 NewFuncDecl: &{ares_dns_rr_del_abin}
2024/12/25 19:18:06 NewFuncDecl ares_dns_rr_del_abin Fail: ares_dns_rr_del_abin symbol not found
2024/12/25 19:18:06 NewFuncDecl: &{ares_dns_rr_set_opt}
2024/12/25 19:18:06 NewFuncDecl ares_dns_rr_set_opt Fail: ares_dns_rr_set_opt symbol not found
2024/12/25 19:18:06 NewFuncDecl: &{ares_dns_rr_del_opt_byid}
2024/12/25 19:18:06 NewFuncDecl ares_dns_rr_del_opt_byid Fail: ares_dns_rr_del_opt_byid symbol not found
2024/12/25 19:18:06 NewFuncDecl: &{ares_dns_rr_get_addr}
panic: no required module provides package github.com/goplus/llgo/c/unix/net; to add it:
        go get github.com/goplus/llgo/c/unix/net

复现

{
	"name": "libcares",
	"cflags": "$(pkg-config --cflags libcares)",
	"libs": "$(pkg-config --libs libcares)",
	"include": [
		"ares.h",
		"ares_dns_record.h"
	],
	"deps": null,
	"trimPrefixes": [],
	"cplusplus": false
}

ares.h

#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
struct ares_in6_addr {
    union {
        unsigned char _S6_u8[16];
    } _S6_un;
};

struct ares_addr {
    int family;

    union {
        struct in_addr addr4;
        struct ares_in6_addr addr6;
    } addr;
};

#include "ares_dns_record.h"

ares_dns_record.h

char *ares_dns_addr_to_ptr(const struct ares_addr *addr);

llcppg.symb.json

[
  {
    "mangle": "ares_dns_addr_to_ptr",
    "c++": "ares_dns_addr_to_ptr(const struct ares_addr *)",
    "go": "(*Struct aresAddr).AresDnsAddrToPtr"
  }
]

问题出现在将这个const struct ares_addr *addr 作为receiver初始化后,仍然将整个paramlist进行初始化了

@luoliwoshang luoliwoshang changed the title gogensig:fix unexpect receiver reinit https://github.com/goplus/llcpp… gogensig:fix unexpect receiver re init Dec 25, 2024
@luoliwoshang luoliwoshang changed the title gogensig:fix unexpect receiver re init gogensig:fix unexpect receiver duplicate init Dec 25, 2024
Copy link

codecov bot commented Dec 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.48%. Comparing base (5771942) to head (fd8a0a3).
Report is 14 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #95   +/-   ##
=======================================
  Coverage   97.47%   97.48%           
=======================================
  Files          15       15           
  Lines        1819     1826    +7     
=======================================
+ Hits         1773     1780    +7     
  Misses         32       32           
  Partials       14       14           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@luoliwoshang luoliwoshang changed the title gogensig:fix unexpect receiver duplicate init [wip] gogensig:fix unexpect receiver duplicate init Dec 25, 2024
@luoliwoshang luoliwoshang changed the title [wip] gogensig:fix unexpect receiver duplicate init gogensig:fix unexpect receiver duplicate init Dec 25, 2024
@luoliwoshang luoliwoshang requested a review from tsingbx December 26, 2024 02:39
@tsingbx tsingbx merged commit f62be6d into goplus:main Dec 26, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

panic: -: PyUCS1 redeclared in this block
2 participants