github.com/notti/go-dynamic@v0.0.0-20190619201224-fc443047424c/steps/2_go/test/_obj/main.cgo2.c (about) 1 2 #line 1 "cgo-builtin-prolog" 3 #include <stddef.h> /* for ptrdiff_t and size_t below */ 4 5 /* Define intgo when compiling with GCC. */ 6 typedef ptrdiff_t intgo; 7 8 typedef struct { const char *p; intgo n; } _GoString_; 9 typedef struct { char *p; intgo n; intgo c; } _GoBytes_; 10 _GoString_ GoString(char *p); 11 _GoString_ GoStringN(char *p, int l); 12 _GoBytes_ GoBytes(void *p, int n); 13 char *CString(_GoString_); 14 void *CBytes(_GoBytes_); 15 void *_CMalloc(size_t); 16 17 __attribute__ ((unused)) 18 static size_t _GoStringLen(_GoString_ s) { return s.n; } 19 20 __attribute__ ((unused)) 21 static const char *_GoStringPtr(_GoString_ s) { return s.p; } 22 23 #line 3 "/home/notti/go/src/github.com/notti/go-dynamic/steps/2_go/test/main.go" 24 #include <stdio.h> 25 #include <stdlib.h> 26 #include <string.h> 27 28 #line 1 "cgo-generated-wrapper" 29 30 31 #line 1 "cgo-gcc-prolog" 32 /* 33 If x and y are not equal, the type will be invalid 34 (have a negative array count) and an inscrutable error will come 35 out of the compiler and hopefully mention "name". 36 */ 37 #define __cgo_compile_assert_eq(x, y, name) typedef char name[(x-y)*(x-y)*-2+1]; 38 39 /* Check at compile time that the sizes we use match our expectations. */ 40 #define __cgo_size_assert(t, n) __cgo_compile_assert_eq(sizeof(t), n, _cgo_sizeof_##t##_is_not_##n) 41 42 __cgo_size_assert(char, 1) 43 __cgo_size_assert(short, 2) 44 __cgo_size_assert(int, 4) 45 typedef long long __cgo_long_long; 46 __cgo_size_assert(__cgo_long_long, 8) 47 __cgo_size_assert(float, 4) 48 __cgo_size_assert(double, 8) 49 50 extern char* _cgo_topofstack(void); 51 52 #include <errno.h> 53 #include <string.h> 54 55 56 #define CGO_NO_SANITIZE_THREAD 57 #define _cgo_tsan_acquire() 58 #define _cgo_tsan_release() 59 60 61 #define _cgo_msan_write(addr, sz) 62 63 CGO_NO_SANITIZE_THREAD 64 void 65 _cgo_194c66e4342c_Cfunc_fputs(void *v) 66 { 67 struct { 68 char const* p0; 69 FILE* p1; 70 int r; 71 char __pad20[4]; 72 } __attribute__((__packed__, __gcc_struct__)) *_cgo_a = v; 73 char *_cgo_stktop = _cgo_topofstack(); 74 __typeof__(_cgo_a->r) _cgo_r; 75 _cgo_tsan_acquire(); 76 _cgo_r = fputs(_cgo_a->p0, _cgo_a->p1); 77 _cgo_tsan_release(); 78 _cgo_a = (void*)((char*)_cgo_a + (_cgo_topofstack() - _cgo_stktop)); 79 _cgo_a->r = _cgo_r; 80 _cgo_msan_write(&_cgo_a->r, sizeof(_cgo_a->r)); 81 } 82 83 CGO_NO_SANITIZE_THREAD 84 void 85 _cgo_194c66e4342c_Cfunc_putc(void *v) 86 { 87 struct { 88 int p0; 89 char __pad4[4]; 90 FILE* p1; 91 int r; 92 char __pad20[4]; 93 } __attribute__((__packed__, __gcc_struct__)) *_cgo_a = v; 94 char *_cgo_stktop = _cgo_topofstack(); 95 __typeof__(_cgo_a->r) _cgo_r; 96 _cgo_tsan_acquire(); 97 _cgo_r = putc(_cgo_a->p0, _cgo_a->p1); 98 _cgo_tsan_release(); 99 _cgo_a = (void*)((char*)_cgo_a + (_cgo_topofstack() - _cgo_stktop)); 100 _cgo_a->r = _cgo_r; 101 _cgo_msan_write(&_cgo_a->r, sizeof(_cgo_a->r)); 102 } 103 104 CGO_NO_SANITIZE_THREAD 105 void 106 _cgo_194c66e4342c_Cfunc_puts(void *v) 107 { 108 struct { 109 char const* p0; 110 int r; 111 char __pad12[4]; 112 } __attribute__((__packed__, __gcc_struct__)) *_cgo_a = v; 113 char *_cgo_stktop = _cgo_topofstack(); 114 __typeof__(_cgo_a->r) _cgo_r; 115 _cgo_tsan_acquire(); 116 _cgo_r = puts(_cgo_a->p0); 117 _cgo_tsan_release(); 118 _cgo_a = (void*)((char*)_cgo_a + (_cgo_topofstack() - _cgo_stktop)); 119 _cgo_a->r = _cgo_r; 120 _cgo_msan_write(&_cgo_a->r, sizeof(_cgo_a->r)); 121 } 122 123 CGO_NO_SANITIZE_THREAD 124 void 125 _cgo_194c66e4342c_Cmacro_stdout(void *v) 126 { 127 struct { 128 FILE* r; 129 } __attribute__((__packed__, __gcc_struct__)) *_cgo_a = v; 130 char *_cgo_stktop = _cgo_topofstack(); 131 __typeof__(_cgo_a->r) _cgo_r; 132 _cgo_tsan_acquire(); 133 _cgo_r = (__typeof__(_cgo_a->r)) stdout; 134 _cgo_tsan_release(); 135 _cgo_a = (void*)((char*)_cgo_a + (_cgo_topofstack() - _cgo_stktop)); 136 _cgo_a->r = _cgo_r; 137 _cgo_msan_write(&_cgo_a->r, sizeof(_cgo_a->r)); 138 } 139 140 CGO_NO_SANITIZE_THREAD 141 void 142 _cgo_194c66e4342c_Cfunc_strcat(void *v) 143 { 144 struct { 145 char* p0; 146 char const* p1; 147 char* r; 148 } __attribute__((__packed__, __gcc_struct__)) *_cgo_a = v; 149 char *_cgo_stktop = _cgo_topofstack(); 150 __typeof__(_cgo_a->r) _cgo_r; 151 _cgo_tsan_acquire(); 152 _cgo_r = (__typeof__(_cgo_a->r)) strcat(_cgo_a->p0, _cgo_a->p1); 153 _cgo_tsan_release(); 154 _cgo_a = (void*)((char*)_cgo_a + (_cgo_topofstack() - _cgo_stktop)); 155 _cgo_a->r = _cgo_r; 156 _cgo_msan_write(&_cgo_a->r, sizeof(_cgo_a->r)); 157 } 158