diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-29 15:01:07 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-29 15:01:07 +0000 |
commit | 36c50a5f93279217f56a13b7041d9aad491f7bbb (patch) | |
tree | 67995d94efa6bac7fb071d031a6cc2992a02874e /gcc/godump.c | |
parent | 6d58fd21b2f6af1843053e3f158114f7686e9278 (diff) | |
download | gcc-36c50a5f93279217f56a13b7041d9aad491f7bbb.tar.gz |
gcc/:
* godump.c (go_format_type): Represent "float _Complex" and
"double _Complex" as complex64 or complex128 in Go, as appropriate.
gcc/testsuite/:
* gcc.misc-tests/godump-1.c: Add tests for complex types.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216840 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/godump.c')
-rw-r--r-- | gcc/godump.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/godump.c b/gcc/godump.c index 7a0566485f6..fccd3eb5121 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -780,6 +780,40 @@ go_format_type (struct godump_container *container, tree type, } break; + case COMPLEX_TYPE: + { + const char *s; + char buf[100]; + tree real_type; + + real_type = TREE_TYPE (type); + if (TREE_CODE (real_type) == REAL_TYPE) + { + switch (TYPE_PRECISION (real_type)) + { + case 32: + s = "complex64"; + break; + case 64: + s = "complex128"; + break; + default: + snprintf (buf, sizeof buf, "INVALID-complex-%u", + 2 * TYPE_PRECISION (real_type)); + s = buf; + ret = false; + break; + } + } + else + { + s = "INVALID-complex-non-real"; + ret = false; + } + obstack_grow (ob, s, strlen (s)); + } + break; + case BOOLEAN_TYPE: obstack_grow (ob, "bool", 4); break; |