summaryrefslogtreecommitdiff
path: root/gcc/c-family/c-pretty-print.c
diff options
context:
space:
mode:
authorktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-21 08:32:50 +0000
committerktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-21 08:32:50 +0000
commitee21242512a5e851dd184d242441173fb9d4944d (patch)
tree5ed13e5b3cc506456eb82dc8e01503a616f1804b /gcc/c-family/c-pretty-print.c
parentac86af5d47802aeddf81599395564a033c115516 (diff)
downloadgcc-ee21242512a5e851dd184d242441173fb9d4944d.tar.gz
ChangeLog gcc/c-family
2011-03-21 Kai Tietz <ktietz@redhat.com> PR target/12171 * c-pretty-print.c (pp_c_specifier_qualifier_list): Display allowed attributes for function pointer types. (pp_c_attributes_display): New function to display attributes having affects_type_identity flag set to true. * c-pretty-print.h (pp_c_attributes_display): New prototype. ChangeLog gcc/cp 2011-03-21 Kai Tietz <ktietz@redhat.com> PR target/12171 * cxx-pretty-print.c (pp_cxx_ptr_operator): Display allowed attributes for function pointer types. * error.c (dump_type_prefix): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171210 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family/c-pretty-print.c')
-rw-r--r--gcc/c-family/c-pretty-print.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index 843e7a4224e..e41890370a1 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -460,6 +460,7 @@ pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t)
{
pp_c_whitespace (pp);
pp_c_left_paren (pp);
+ pp_c_attributes_display (pp, TYPE_ATTRIBUTES (pointee));
}
else if (!c_dialect_cxx ())
pp_c_whitespace (pp);
@@ -790,6 +791,47 @@ pp_c_attributes (c_pretty_printer *pp, tree attributes)
pp_c_right_paren (pp);
}
+/* Pretty-print ATTRIBUTES using GNU C extension syntax for attributes
+ marked to be displayed on disgnostic. */
+
+void
+pp_c_attributes_display (c_pretty_printer *pp, tree a)
+{
+ bool is_first = true;
+
+ if (a == NULL_TREE)
+ return;
+
+ for (; a != NULL_TREE; a = TREE_CHAIN (a))
+ {
+ const struct attribute_spec *as;
+ as = lookup_attribute_spec (TREE_PURPOSE (a));
+ if (!as || as->affects_type_identity == false)
+ continue;
+ if (is_first)
+ {
+ pp_c_ws_string (pp, "__attribute__");
+ pp_c_left_paren (pp);
+ pp_c_left_paren (pp);
+ is_first = false;
+ }
+ else
+ {
+ pp_separate_with (pp, ',');
+ }
+ pp_tree_identifier (pp, TREE_PURPOSE (a));
+ if (TREE_VALUE (a))
+ pp_c_call_argument_list (pp, TREE_VALUE (a));
+ }
+
+ if (!is_first)
+ {
+ pp_c_right_paren (pp);
+ pp_c_right_paren (pp);
+ pp_c_whitespace (pp);
+ }
+}
+
/* function-definition:
declaration-specifiers declarator compound-statement */