Skip to content

Commit 1b83d43

Browse files
aykevldeadprogram
authored andcommitted
cgo: fix build warnings on Windows ARM
Fix the warning, and also remove tinygo_clang_enum_visitor which was unused. See: golang/go#49721
1 parent 7847f4e commit 1b83d43

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cgo/libclang.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,22 @@ unsigned tinygo_clang_Cursor_isAnonymous(GoCXCursor c);
6565
unsigned tinygo_clang_Cursor_isBitField(GoCXCursor c);
6666
unsigned tinygo_clang_Cursor_isMacroFunctionLike(GoCXCursor c);
6767
68+
// Fix some warnings on Windows ARM. Without the __declspec(dllexport), it gives warnings like this:
69+
// In file included from _cgo_export.c:4:
70+
// cgo-gcc-export-header-prolog:49:34: warning: redeclaration of 'tinygo_clang_globals_visitor' should not add 'dllexport' attribute [-Wdll-attribute-on-redeclaration]
71+
// libclang.go:68:5: note: previous declaration is here
72+
// See: https://github.com/golang/go/issues/49721
73+
#if defined(_WIN32)
74+
#define CGO_DECL // __declspec(dllexport)
75+
#else
76+
#define CGO_DECL
77+
#endif
78+
79+
CGO_DECL
6880
int tinygo_clang_globals_visitor(GoCXCursor c, GoCXCursor parent, CXClientData client_data);
81+
CGO_DECL
6982
int tinygo_clang_struct_visitor(GoCXCursor c, GoCXCursor parent, CXClientData client_data);
70-
int tinygo_clang_enum_visitor(GoCXCursor c, GoCXCursor parent, CXClientData client_data);
83+
CGO_DECL
7184
void tinygo_clang_inclusion_visitor(CXFile included_file, CXSourceLocation *inclusion_stack, unsigned include_len, CXClientData client_data);
7285
*/
7386
import "C"

0 commit comments

Comments
 (0)