From 5686a6b7a67691dcbe5bd669f826f5ce09dd9fc2 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Tue, 15 Jan 2019 23:54:37 +0000 Subject: [PATCH] godump.c (go_output_typedef): When outputting a typedef... gcc/: * godump.c (go_output_typedef): When outputting a typedef, refer to the underlying type by its name and not its structure. gcc/testsuite: * gcc.misc-tests/godump-1.c: Add test case for typedef before struct. From-SVN: r267958 --- gcc/ChangeLog | 5 +++++ gcc/godump.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.misc-tests/godump-1.c | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e1ae217c03c..153a5ab0951 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-01-15 Nikhil Benesch + + * godump.c (go_output_typedef): When outputting a typedef, refer + to the underlying type by its name and not its structure. + 2019-01-15 David Malcolm PR c++/88795 diff --git a/gcc/godump.c b/gcc/godump.c index 17390b8be62..617a96486cd 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -1181,7 +1181,7 @@ go_output_typedef (struct godump_container *container, tree decl) return; *slot = CONST_CAST (void *, (const void *) type); - if (!go_format_type (container, TREE_TYPE (decl), false, false, NULL, + if (!go_format_type (container, TREE_TYPE (decl), true, false, NULL, false)) { fprintf (go_dump_file, "// "); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d226aa54af6..f032b48a37e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-15 Nikhil Benesch + + * gcc.misc-tests/godump-1.c: Add test case for typedef before + struct. + 2019-01-15 David Malcolm PR c++/88795 diff --git a/gcc/testsuite/gcc.misc-tests/godump-1.c b/gcc/testsuite/gcc.misc-tests/godump-1.c index ee984e5b574..f97bbecc9bc 100644 --- a/gcc/testsuite/gcc.misc-tests/godump-1.c +++ b/gcc/testsuite/gcc.misc-tests/godump-1.c @@ -468,6 +468,11 @@ struct { double d; uint8_t : 0; } sd_not_equiv; typedef struct s_undef_t s_undef_t2; +typedef struct s_fwd *s_fwd_p; +/* { dg-final { scan-file godump-1.out "(?n)^type _s_fwd_p \\*_s_fwd$" } } */ + +struct s_fwd { }; +/* { dg-final { scan-file godump-1.out "(?n)^type _s_fwd struct \{ \}$" } } */ /*** nested structs ***/ typedef struct { struct { uint8_t ca[3]; } s; uint32_t i; } tsn; -- 2.30.2