diff options
author | Ayke van Laethem <[email protected]> | 2019-04-27 23:26:20 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2019-05-01 11:33:18 +0200 |
commit | b1ed8a46b735b472c01011a713b790bbce7b592a (patch) | |
tree | 3d78d09af9d67c95e3dbccef14a8ba17aef8aa7a /testdata | |
parent | 35af33ead794efd1f2e6e688cadf6ca54d68b5ac (diff) | |
download | tinygo-b1ed8a46b735b472c01011a713b790bbce7b592a.tar.gz tinygo-b1ed8a46b735b472c01011a713b790bbce7b592a.zip |
cgo: only include the symbols that are necessary (recursively)
Only try to convert the C symbols to their Go equivalents that are
actually referenced by the Go code with C.<somesymbol>. This avoids
having to support all possible C types, which is difficult because of
oddities like `typedef void` or `__builtin_va_list`. Especially
__builtin_va_list, which varies between targets.
Diffstat (limited to 'testdata')
-rw-r--r-- | testdata/cgo/main.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/testdata/cgo/main.h b/testdata/cgo/main.h index 117f907a2..0659ab0cc 100644 --- a/testdata/cgo/main.h +++ b/testdata/cgo/main.h @@ -2,12 +2,17 @@ #include <stdint.h> typedef short myint; +typedef short unusedTypedef; int add(int a, int b); +int unusedFunction(void); typedef int (*binop_t) (int, int); int doCallback(int a, int b, binop_t cb); typedef int * intPointer; void store(int value, int *ptr); +// this signature should not be included by CGo +void unusedFunction2(int x, __builtin_va_list args); + typedef struct collection { short s; long l; @@ -37,6 +42,7 @@ void unionSetData(short f0, short f1, short f2); // test globals and datatypes extern int global; +extern int unusedGlobal; extern bool globalBool; extern bool globalBool2; extern float globalFloat; |