diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-11-13 11:58:46 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-11-13 11:58:46 +0000 |
commit | 2dbad62da9a2b1734aa74b2b0fcf6fb3ff52a4ac (patch) | |
tree | a738d8dfc1981fad6e056fff988c1f14f57a55b9 | |
parent | 46927ade0f5933c4eb22b049996fa15080b7f652 (diff) | |
download | gcc-2dbad62da9a2b1734aa74b2b0fcf6fb3ff52a4ac.zip gcc-2dbad62da9a2b1734aa74b2b0fcf6fb3ff52a4ac.tar.gz gcc-2dbad62da9a2b1734aa74b2b0fcf6fb3ff52a4ac.tar.bz2 |
c-ada-spec.c (get_underlying_decl): Do not look through typedefs.
* c-ada-spec.c (get_underlying_decl): Do not look through typedefs.
(dump_forward_type): Do not generate a declaration for function types.
(dump_nested_type) <ARRAY_TYPE>: Do not generate a nested declaration
of the component type if it is declared in another file.
From-SVN: r278129
-rw-r--r-- | gcc/c-family/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-family/c-ada-spec.c | 12 |
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a174ff9..c7813a1 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2019-11-13 Eric Botcazou <ebotcazou@adacore.com> + + * c-ada-spec.c (get_underlying_decl): Do not look through typedefs. + (dump_forward_type): Do not generate a declaration for function types. + (dump_nested_type) <ARRAY_TYPE>: Do not generate a nested declaration + of the component type if it is declared in another file. + 2019-11-12 Martin Liska <mliska@suse.cz> * c-opts.c (c_common_post_options): diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index 38d65a6..5a142ce 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -1025,7 +1025,9 @@ get_underlying_decl (tree type) if (TYPE_P (type)) { - type = TYPE_MAIN_VARIANT (type); + /* Strip qualifiers but do not look through typedefs. */ + if (TYPE_QUALS_NO_ADDR_SPACE (type)) + type = TYPE_MAIN_VARIANT (type); /* type is a typedef. */ if (TYPE_NAME (type) && DECL_P (TYPE_NAME (type))) @@ -2454,6 +2456,9 @@ dump_forward_type (pretty_printer *buffer, tree type, tree t, int spc) if (DECL_SOURCE_FILE (decl) != DECL_SOURCE_FILE (t)) return; + if (TREE_CODE (type) == FUNCTION_TYPE) + return; + /* Generate an incomplete type declaration. */ pp_string (buffer, "type "); dump_ada_node (buffer, decl, NULL_TREE, spc, false, true); @@ -2522,7 +2527,10 @@ dump_nested_type (pretty_printer *buffer, tree field, tree t, tree parent, while (TREE_CODE (tmp) == ARRAY_TYPE) tmp = TREE_TYPE (tmp); decl = get_underlying_decl (tmp); - if (decl && !DECL_NAME (decl) && !TREE_VISITED (decl)) + if (decl + && !DECL_NAME (decl) + && DECL_SOURCE_FILE (decl) == DECL_SOURCE_FILE (t) + && !TREE_VISITED (decl)) { /* Generate full declaration. */ dump_nested_type (buffer, decl, t, parent, spc); |