Lines Matching refs:Fprintf
44 fmt.Fprintf(fflg, "_CGO_%s=%s\n", k, strings.Join(v, " "))
47 fmt.Fprintf(fgo2, "//go:cgo_ldflag %q\n", arg)
54 fmt.Fprintf(fm, "int main() { return 0; }\n")
56 fmt.Fprintf(fm, "void crosscall2(void(*fn)(void*, int, __SIZE_TYPE__), void *a, int c, __SIZE_TYPE__ ctxt) { }\n")
57 fmt.Fprintf(fm, "__SIZE_TYPE__ _cgo_wait_runtime_init_done() { return 0; }\n")
58 fmt.Fprintf(fm, "void _cgo_release_context(__SIZE_TYPE__ ctxt) { }\n")
59 fmt.Fprintf(fm, "char* _cgo_topofstack(void) { return (char*)0; }\n")
63 fmt.Fprintf(fm, "void crosscall2(void(*fn)(void*, int, __SIZE_TYPE__), void *a, int c, __SIZE_TYPE__ ctxt);\n")
64 fmt.Fprintf(fm, "__SIZE_TYPE__ _cgo_wait_runtime_init_done();\n")
65 fmt.Fprintf(fm, "void _cgo_release_context(__SIZE_TYPE__);\n")
67 fmt.Fprintf(fm, "void _cgo_allocate(void *a, int c) { }\n")
68 fmt.Fprintf(fm, "void _cgo_panic(void *a, int c) { }\n")
69 fmt.Fprintf(fm, "void _cgo_reginit(void) { }\n")
74 fmt.Fprintf(fgo2, "// Created by cgo - DO NOT EDIT\n\n")
75 fmt.Fprintf(fgo2, "package %s\n\n", p.PackageName)
76 fmt.Fprintf(fgo2, "import \"unsafe\"\n\n")
78 fmt.Fprintf(fgo2, "import _ \"runtime/cgo\"\n\n")
81 fmt.Fprintf(fgo2, "import \"syscall\"\n\n")
82 fmt.Fprintf(fgo2, "var _ syscall.Errno\n")
84 fmt.Fprintf(fgo2, "func _Cgo_ptr(ptr unsafe.Pointer) unsafe.Pointer { return ptr }\n\n")
87 fmt.Fprintf(fgo2, "//go:linkname _Cgo_always_false runtime.cgoAlwaysFalse\n")
88 fmt.Fprintf(fgo2, "var _Cgo_always_false bool\n")
89 fmt.Fprintf(fgo2, "//go:linkname _Cgo_use runtime.cgoUse\n")
90 fmt.Fprintf(fgo2, "func _Cgo_use(interface{})\n")
100 fmt.Fprintf(fgo2, "type %s ", name)
114 fmt.Fprintf(fgo2, "\n\n")
117 fmt.Fprintf(fgo2, "type _Ctype_void byte\n")
119 fmt.Fprintf(fgo2, "type _Ctype_void [0]byte\n")
130 fmt.Fprintf(fc, "#line 1 \"cgo-generated-wrappers\"\n")
133 fmt.Fprintf(fm, "#line 1 \"cgo-generated-wrappers\"\n")
147 fmt.Fprintf(fc, "extern byte *%s;\n", n.C)
149 fmt.Fprintf(fm, "extern char %s[];\n", n.C)
150 fmt.Fprintf(fm, "void *_cgohack_%s = %s;\n\n", n.C, n.C)
151 fmt.Fprintf(fgo2, "//go:linkname __cgo_%s %s\n", n.C, n.C)
152 fmt.Fprintf(fgo2, "//go:cgo_import_static %s\n", n.C)
153 fmt.Fprintf(fgo2, "var __cgo_%s byte\n", n.C)
167 fmt.Fprintf(fc, `extern void *%s __asm__("%s.%s");`, n.Mangle, gccgoSymbolPrefix, n.Mangle)
168 fmt.Fprintf(&gccgoInit, "\t%s = &%s;\n", n.Mangle, n.C)
169 fmt.Fprintf(fc, "\n")
172 fmt.Fprintf(fgo2, "var %s ", n.Mangle)
175 fmt.Fprintf(fgo2, " = (")
177 fmt.Fprintf(fgo2, ")(unsafe.Pointer(&__cgo_%s))", n.C)
179 fmt.Fprintf(fgo2, "\n")
182 fmt.Fprintf(fc, "\n")
188 fmt.Fprintf(fgo2, "const _Cconst_%s = %s\n", n.Go, n.Const)
191 fmt.Fprintf(fgo2, "\n")
255 fmt.Fprintf(stdout, "package %s\n", *dynpackage)
263 fmt.Fprintf(stdout, "//go:cgo_dynamic_linker %q\n", string(data[:len(data)-1]))
276 fmt.Fprintf(stdout, "//go:cgo_import_dynamic %s %s %q\n", s.Name, targ, s.Library)
283 fmt.Fprintf(stdout, "//go:cgo_import_dynamic _ _ %q\n", l)
297 fmt.Fprintf(stdout, "//go:cgo_import_dynamic %s %s %q\n", s, s, "")
304 fmt.Fprintf(stdout, "//go:cgo_import_dynamic _ _ %q\n", l)
317 fmt.Fprintf(stdout, "//go:cgo_import_dynamic %s %s %q\n", name, ss[0], strings.ToLower(ss[1]))
337 fmt.Fprintf(&buf, "\t\tchar __pad%d[%d];\n", off, pad)
344 fmt.Fprintf(&buf, "\t\t%s p%d;\n", c, i)
349 fmt.Fprintf(&buf, "\t\tchar __pad%d[%d];\n", off, pad)
355 fmt.Fprintf(&buf, "\t\tchar __pad%d[%d];\n", off, pad)
358 fmt.Fprintf(&buf, "\t\t%s r;\n", t.C)
363 fmt.Fprintf(&buf, "\t\tchar __pad%d[%d];\n", off, pad)
367 fmt.Fprintf(&buf, "\t\tchar unused;\n") // avoid empty struct
369 fmt.Fprintf(&buf, "\t}")
425 fmt.Fprintf(fgo2, "%s(%s)\n", cname, strings.Join(paramnames, ", "))
448 fmt.Fprintf(fgo2, "//extern %s\n", cname)
469 fmt.Fprintf(fgo2, "//go:cgo_import_static %s\n", cname)
470 fmt.Fprintf(fgo2, "//go:linkname __cgofn_%s %s\n", cname, cname)
471 fmt.Fprintf(fgo2, "var __cgofn_%s byte\n", cname)
472 fmt.Fprintf(fgo2, "var %s = unsafe.Pointer(&__cgofn_%s)\n", cname, cname)
500 fmt.Fprintf(fgo2, "\t%s_cgo_runtime_cgocall(%s, %s)\n", prefix, cname, arg)
502 fmt.Fprintf(fgo2, "\tif errno != 0 { r2 = syscall.Errno(errno) }\n")
504 fmt.Fprintf(fgo2, "\tif _Cgo_always_false {\n")
506 fmt.Fprintf(fgo2, "\t\t_Cgo_use(p%d)\n", i)
508 fmt.Fprintf(fgo2, "\t}\n")
509 fmt.Fprintf(fgo2, "\treturn\n")
510 fmt.Fprintf(fgo2, "}\n")
527 fmt.Fprintf(fgo1, "// Created by cgo - DO NOT EDIT\n\n")
532 fmt.Fprintf(fgcc, "%s\n", f.Preamble)
533 fmt.Fprintf(fgcc, "%s\n", gccProlog)
534 fmt.Fprintf(fgcc, "%s\n", tsanProlog)
584 fmt.Fprintf(fgcc, "CGO_NO_SANITIZE_THREAD\n")
586 fmt.Fprintf(fgcc, "int\n")
588 fmt.Fprintf(fgcc, "void\n")
590 fmt.Fprintf(fgcc, "_cgo%s%s(void *v)\n", cPrefix, n.Mangle)
591 fmt.Fprintf(fgcc, "{\n")
593 fmt.Fprintf(fgcc, "\tint _cgo_errno;\n")
598 fmt.Fprintf(fgcc, "\t%s %v *a = v;\n", ctype, p.packedAttribute())
601 fmt.Fprintf
605 fmt.Fprintf(fgcc, "\t__typeof__(a->r) r;\n")
607 fmt.Fprintf(fgcc, "\t_cgo_tsan_acquire();\n")
609 fmt.Fprintf(fgcc, "\terrno = 0;\n")
611 fmt.Fprintf(fgcc, "\t")
613 fmt.Fprintf(fgcc, "r = ")
618 fmt.Fprintf(fgcc, "%s(", n.C)
621 fmt.Fprintf(fgcc, ", ")
623 fmt.Fprintf(fgcc, "a->p%d", i)
625 fmt.Fprintf(fgcc, ");\n")
627 fmt.Fprintf(fgcc, "\t_cgo_errno = errno;\n")
629 fmt.Fprintf(fgcc, "\t_cgo_tsan_release();\n")
633 fmt.Fprintf(fgcc, "\ta = (void*)((char*)a + (_cgo_topofstack() - stktop));\n")
635 fmt.Fprintf(fgcc, "\ta->r = r;\n")
638 fmt.Fprintf(fgcc, "\treturn _cgo_errno;\n")
640 fmt.Fprintf(fgcc, "}\n")
641 fmt.Fprintf(fgcc, "\n")
650 fmt.Fprintf(fgcc, "CGO_NO_SANITIZE_THREAD\n")
652 fmt.Fprintf(fgcc, "%s\n", t.C.String())
654 fmt.Fprintf(fgcc, "void\n")
656 fmt.Fprintf(fgcc, "_cgo%s%s(", cPrefix, n.Mangle)
659 fmt.Fprintf(fgcc, ", ")
665 fmt.Fprintf(fgcc, "%s p%d", c, i)
667 fmt.Fprintf(fgcc, ")\n")
668 fmt.Fprintf(fgcc, "{\n")
670 fmt.Fprintf(fgcc, "\t%s r;\n", t.C.String())
672 fmt.Fprintf(fgcc, "\t_cgo_tsan_acquire();\n")
673 fmt.Fprintf(fgcc, "\t")
675 fmt.Fprintf(fgcc, "r = ")
678 fmt.Fprintf(fgcc, "(void*)")
681 fmt.Fprintf(fgcc, "%s(", n.C)
684 fmt.Fprintf(fgcc, ", ")
686 fmt.Fprintf(fgcc, "p%d", i)
688 fmt.Fprintf(fgcc, ");\n")
689 fmt.Fprintf(fgcc, "\t_cgo_tsan_release();\n")
691 fmt.Fprintf(fgcc, "\treturn ")
695 fmt.Fprintf(fgcc, "(void*)")
697 fmt.Fprintf(fgcc, "r;\n")
699 fmt.Fprintf(fgcc, "}\n")
700 fmt.Fprintf(fgcc, "\n")
721 fmt.Fprintf(fgcc, "/* Created by cgo - DO NOT EDIT. */\n")
722 fmt.Fprintf(fgcc, "#include <stdlib.h>\n")
723 fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n\n")
725 fmt.Fprintf(fgcc, "extern void crosscall2(void (*fn)(void *, int, __SIZE_TYPE__), void *, int, __SIZE_TYPE__);\n")
726 fmt.Fprintf(fgcc, "extern __SIZE_TYPE__ _cgo_wait_runtime_init_done();\n")
727 fmt.Fprintf(fgcc, "extern void _cgo_release_context(__SIZE_TYPE__);\n\n")
728 fmt.Fprintf(fgcc, "extern char* _cgo_topofstack(void);")
729 fmt.Fprintf(fgcc, "%s\n", tsanProlog)
796 fmt.Fprintf(fgcch, "\n/* Return type for %s */\n", exp.ExpName)
797 fmt.Fprintf(fgcch, "struct %s_return {\n", exp.ExpName)
800 fmt.Fprintf(fgcch, "\t%s r%d;", p.cgoType(atype).C, i)
802 fmt.Fprintf(fgcch, " /* %s */", aname)
806 fmt.Fprintf(fgcch, "};\n")
826 fmt.Fprintf(fgcch, "\n%s", exp.Doc)
828 fmt.Fprintf(fgcch, "\nextern %s;\n", s)
830 fmt.Fprintf(fgcc, "extern void _cgoexp%s_%s(void *, int, __SIZE_TYPE__);\n", cPrefix, exp.ExpName)
831 fmt.Fprintf(fgcc, "\nCGO_NO_SANITIZE_THREAD")
832 fmt.Fprintf(fgcc, "\n%s\n", s)
833 fmt.Fprintf(fgcc, "{\n")
834 fmt.Fprintf(fgcc, "\t__SIZE_TYPE__ _cgo_ctxt = _cgo_wait_runtime_init_done();\n")
835 fmt.Fprintf(fgcc, "\t%s %v a;\n", ctype, p.packedAttribute())
837 fmt.Fprintf(fgcc, "\t%s r;\n", gccResult)
840 fmt.Fprintf(fgcc, "\ta.recv = recv;\n")
844 fmt.Fprintf(fgcc, "\ta.p%d = p%d;\n", i, i)
846 fmt.Fprintf(fgcc, "\t_cgo_tsan_release();\n")
847 fmt.Fprintf(fgcc, "\tcrosscall2(_cgoexp%s_%s, &a, %d, _cgo_ctxt);\n", cPrefix, exp.ExpName, off)
848 fmt.Fprintf(fgcc, "\t_cgo_tsan_acquire();\n")
849 fmt.Fprintf(fgcc, "\t_cgo_release_context(_cgo_ctxt);\n")
852 fmt.Fprintf(fgcc, "\treturn a.r0;\n")
856 fmt.Fprintf(fgcc, "\tr.r%d = a.r%d;\n", i, i)
858 fmt.Fprintf(fgcc, "\treturn r;\n")
861 fmt.Fprintf(fgcc, "}\n")
869 fmt.Fprintf(fgo2, "//go:cgo_export_dynamic %s\n", exp.ExpName)
870 fmt.Fprintf(fgo2, "//go:linkname _cgoexp%s_%s _cgoexp%s_%s\n", cPrefix, exp.ExpName, cPrefix, exp.ExpName)
871 fmt.Fprintf(fgo2, "//go:cgo_export_static _cgoexp%s_%s\n", cPrefix, exp.ExpName)
872 fmt.Fprintf(fgo2, "//go:nosplit\n") // no split stack, so no use of m or g
873 fmt.Fprintf(fgo2, "//go:norace\n") // must not have race detector calls inserted
874 fmt.Fprintf(fgo2, "func _cgoexp%s_%s(a unsafe.Pointer, n int32, ctxt uintptr) {\n", cPrefix, exp.ExpName)
875 fmt.Fprintf(fgo2, "\tfn := %s\n", goname)
877 fmt.Fprintf(fgo2, "\t_cgo_runtime_cgocallback(**(**unsafe.Pointer)(unsafe.Pointer(&fn)), a, uintptr(n), ctxt);\n")
878 fmt.Fprintf(fgo2, "}\n")
880 fmt.Fprintf(fm, "int _cgoexp%s_%s;\n", cPrefix, exp.ExpName)
885 fmt.Fprintf(fgo2, "\n")
886 fmt.Fprintf(fgo2, "func %s(", goname)
889 fmt.Fprintf(fgo2, "recv ")
896 fmt.Fprintf(fgo2, ", ")
898 fmt.Fprintf(fgo2, "p%d ", i)
902 fmt.Fprintf(fgo2, ")")
910 fmt.Fprintf(fgo2, "r%d ", i)
931 fmt.Fprintf(fgo2, "\t\t_cgoCheckResult(r%d)\n", i)
939 fmt.Fprintf(fgo2, "recv.")
941 fmt.Fprintf(fgo2, "%s(", exp.Func.Name)
947 fmt.Fprintf(fgo2, "p%d", i)
953 fmt.Fprintf(fgcch, "%s", gccExportHeaderEpilog)
962 fmt.Fprintf(fgcc, "/* Created by cgo - DO NOT EDIT. */\n")
963 fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n")
965 fmt.Fprintf(fgcc, "%s\n", gccgoExportFileProlog)
966 fmt.Fprintf(fgcc, "%s\n", tsanProlog)
978 fmt.Fprintf(cdeclBuf, "void")
983 fmt.Fprintf(cdeclBuf, "%s", t.C)
987 fmt.Fprintf(fgcch, "\n/* Return type for %s */\n", exp.ExpName)
988 fmt.Fprintf(fgcch, "struct %s_result {\n", exp.ExpName)
992 fmt.Fprintf(fgcch, "\t%s r%d;", t.C, i)
994 fmt.Fprintf(fgcch, " /* %s */", aname)
998 fmt.Fprintf(fgcch, "};\n")
999 fmt.Fprintf(cdeclBuf, "struct %s_result", exp.ExpName)
1005 fmt.Fprintf(cdeclBuf, "(")
1007 fmt.Fprintf(cdeclBuf, "%s recv", p.cgoType(fn.Recv.List[0].Type).C.String())
1013 fmt.Fprintf(cdeclBuf, ", ")
1016 fmt.Fprintf(cdeclBuf, "%s p%d", t.C, i)
1018 fmt.Fprintf(cdeclBuf, ")")
1022 fmt.Fprintf(fgcch, "\n%s", exp.Doc)
1025 fmt.Fprintf(fgcch, "extern %s %s %s;\n", cRet, exp.ExpName, cParams)
1032 fmt.Fprintf(fgcc, `extern %s %s %s __asm__("%s.%s");`, cRet, goName, cParams, gccgoSymbolPrefix, goName)
1036 fmt.Fprintf(fgcc, "%s %s %s {\n", cRet, exp.ExpName, cParams)
1038 fmt.Fprintf(fgcc, "\t%s r;\n", cRet)
1040 fmt.Fprintf(fgcc, "\tif(_cgo_wait_runtime_init_done)\n")
1041 fmt.Fprintf(fgcc, "\t\t_cgo_wait_runtime_init_done();\n")
1042 fmt.Fprintf(fgcc, "\t_cgo_tsan_release();\n")
1047 fmt.Fprintf(fgcc, "%s(", goName)
1054 fmt.Fprintf(fgcc, ", ")
1056 fmt.Fprintf(fgcc, "p%d", i)
1059 fmt.Fprintf(fgcc, "\t_cgo_tsan_acquire();\n")
1066 fmt.Fprintf(fm, `char %s[1] __asm__("%s.%s");`, goName, gccgoSymbolPrefix, goName)
1076 fmt.Fprintf(fgo2, "func %s(", goName)
1084 fmt.Fprintf(fgo2, ", ")
1086 fmt.Fprintf(fgo2, "p%d ", i)
1089 fmt.Fprintf(fgo2, ")")
1091 fmt.Fprintf(fgo2, " (")
1111 fmt.Fprintf(fgo2, "%s(", exp.Func.Name)
1117 fmt.Fprintf(fgo2, "p%d", i)
1123 fmt.Fprintf(fgcch, "%s", gccExportHeaderEpilog)
1128 fmt.Fprintf(fgcch, "/* Created by \"go tool cgo\" - DO NOT EDIT. */\n\n")
1133 fmt.Fprintf(fgcch, "/* package %s */\n\n", pkg)
1135 fmt.Fprintf
1136 fmt.Fprintf(fgcch, "%s\n", p.Preamble)
1137 fmt.Fprintf(fgcch, "\n/* End of preamble from import \"C\" comments. */\n\n")
1139 fmt.Fprintf(fgcch, "%s\n", p.gccExportHeaderProlog())