diff options
author | Dominik Vogt <vogt@linux.vnet.ibm.com> | 2014-10-29 15:01:07 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2014-10-29 15:01:07 +0000 |
commit | 7b310e901c5b7ad8ad54771b2d69459a496da472 (patch) | |
tree | 67995d94efa6bac7fb071d031a6cc2992a02874e /gcc/godump.c | |
parent | d4573ffe1ed9d14c1be3ecd4f2f18f18ea374660 (diff) | |
download | gcc-7b310e901c5b7ad8ad54771b2d69459a496da472.zip gcc-7b310e901c5b7ad8ad54771b2d69459a496da472.tar.gz gcc-7b310e901c5b7ad8ad54771b2d69459a496da472.tar.bz2 |
godump.c (go_format_type): Represent "float _Complex" and "double _Complex" as complex64 or complex128 in...
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.
From-SVN: r216840
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 7a05664..fccd3eb 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; |