From bdaf8be1b2e3514b8bbcdd1042136e7d91b3c3f3 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 22 Nov 2019 22:45:27 +0100 Subject: re PR c/90677 (gcc-9.1.0 fails to build __gcc_diag__ souce: error: 'cgraph_node' is not defined as a type) PR c/90677 * c-common.h (identifier_global_tag): Declare. * c-format.c (get_pointer_to_named_type): Renamed to ... (get_named_type): ... this. Use identifier_global_tag instead of identifier_global_value, handle the return value being a TYPE_P. (init_dynamic_diag_info): Adjust get_pointer_to_named_type callers to call get_named_type instead. Formatting fixes. c/ * c-decl.c (identifier_global_tag): Define. cp/ * cp-objcp-common.c (identifier_global_tag): Define. testsuite/ * c-c++-common/pr90677.c: New test. From-SVN: r278634 --- gcc/c/ChangeLog | 5 +++++ gcc/c/c-decl.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 7b37842..cb1ea09 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2019-11-22 Jakub Jelinek + + PR c/90677 + * c-decl.c (identifier_global_tag): Define. + 2019-11-20 Richard Biener PR c/92088 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index caa9c85..7fd3cc2 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -10168,6 +10168,20 @@ identifier_global_value (tree t) return NULL_TREE; } +/* Return the global value of tag T as a symbol. */ + +tree +identifier_global_tag (tree t) +{ + struct c_binding *b; + + for (b = I_TAG_BINDING (t); b; b = b->shadowed) + if (B_IN_FILE_SCOPE (b) || B_IN_EXTERNAL_SCOPE (b)) + return b->decl; + + return NULL_TREE; +} + /* Returns true if NAME refers to a built-in function or function-like operator. */ -- cgit v1.1