-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from luoliwoshang/gogensig/receiver
gogensig:fix unexpect receiver duplicate init
- Loading branch information
Showing
7 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "comment", | ||
"include": ["temp.h","use.h"], | ||
"cplusplus":false | ||
} |
12 changes: 12 additions & 0 deletions
12
cmd/gogensig/convert/_testdata/receiver/conf/llcppg.symb.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ | ||
{ | ||
"mangle": "ares_dns_pton", | ||
"c++": "ares_dns_pton(const char *, struct ares_addr *, int *)", | ||
"go": "AresDnsPton" | ||
}, | ||
{ | ||
"mangle": "ares_dns_addr_to_ptr", | ||
"c++": "ares_dns_addr_to_ptr(const struct ares_addr *)", | ||
"go": "(*aresAddr).AresDnsAddrToPtr" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
===== temp.go ===== | ||
package receiver | ||
|
||
import ( | ||
"github.com/goplus/llgo/c" | ||
_ "unsafe" | ||
) | ||
|
||
type InAddr1 struct { | ||
SAddr c.Uint | ||
} | ||
|
||
type AresIn6Addr struct { | ||
X_S6Un struct { | ||
X_S6U8 [16]int8 | ||
} | ||
} | ||
|
||
===== use.go ===== | ||
package receiver | ||
|
||
import "unsafe" | ||
|
||
type AresAddr struct { | ||
Family c.Int | ||
Addr struct { | ||
Addr6 AresIn6Addr | ||
} | ||
} | ||
//go:linkname AresDnsPton C.ares_dns_pton | ||
func AresDnsPton(ipaddr *int8, addr *AresAddr) unsafe.Pointer | ||
// llgo:link (*aresAddr).AresDnsAddrToPtr C.ares_dns_addr_to_ptr | ||
func (p *AresAddr) AresDnsAddrToPtr() *int8 { | ||
return nil | ||
} | ||
|
||
===== llcppg.pub ===== | ||
ares_addr AresAddr | ||
ares_in6_addr AresIn6Addr | ||
in_addr1 InAddr1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
struct in_addr1 { | ||
unsigned int s_addr; | ||
}; | ||
|
||
struct ares_in6_addr { | ||
union { | ||
unsigned char _S6_u8[16]; | ||
} _S6_un; | ||
}; | ||
|
||
struct ares_addr { | ||
int family; | ||
|
||
union { | ||
struct in_addr1 addr4; | ||
struct ares_in6_addr addr6; | ||
} addr; | ||
}; | ||
|
||
#include "use.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// todo(zzy): ares_addr need generate in the temp.go | ||
const void *ares_dns_pton(const char *ipaddr, struct ares_addr *addr); | ||
char *ares_dns_addr_to_ptr(const struct ares_addr *addr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters