Commit 5050afdf by Kai Tietz Committed by Kai Tietz

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.

From-SVN: r171210
parent 62d784f7
2011-03-17 Kai Tietz 2011-03-17 Kai Tietz
PR target/12171 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.
* c-common.c (c_common_attribute_table): * c-common.c (c_common_attribute_table):
Add new element. Add new element.
(c_common_format_attribute_table): Likewise. (c_common_format_attribute_table): Likewise.
......
...@@ -460,6 +460,7 @@ pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t) ...@@ -460,6 +460,7 @@ pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t)
{ {
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_c_left_paren (pp); pp_c_left_paren (pp);
pp_c_attributes_display (pp, TYPE_ATTRIBUTES (pointee));
} }
else if (!c_dialect_cxx ()) else if (!c_dialect_cxx ())
pp_c_whitespace (pp); pp_c_whitespace (pp);
...@@ -790,6 +791,47 @@ pp_c_attributes (c_pretty_printer *pp, tree attributes) ...@@ -790,6 +791,47 @@ pp_c_attributes (c_pretty_printer *pp, tree attributes)
pp_c_right_paren (pp); 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: /* function-definition:
declaration-specifiers declarator compound-statement */ declaration-specifiers declarator compound-statement */
......
...@@ -177,6 +177,7 @@ void pp_c_space_for_pointer_operator (c_pretty_printer *, tree); ...@@ -177,6 +177,7 @@ void pp_c_space_for_pointer_operator (c_pretty_printer *, tree);
void pp_c_tree_decl_identifier (c_pretty_printer *, tree); void pp_c_tree_decl_identifier (c_pretty_printer *, tree);
void pp_c_function_definition (c_pretty_printer *, tree); void pp_c_function_definition (c_pretty_printer *, tree);
void pp_c_attributes (c_pretty_printer *, tree); void pp_c_attributes (c_pretty_printer *, tree);
void pp_c_attributes_display (c_pretty_printer *, tree);
void pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type); void pp_c_cv_qualifiers (c_pretty_printer *pp, int qualifiers, bool func_type);
void pp_c_type_qualifier_list (c_pretty_printer *, tree); void pp_c_type_qualifier_list (c_pretty_printer *, tree);
void pp_c_parameter_type_list (c_pretty_printer *, tree); void pp_c_parameter_type_list (c_pretty_printer *, tree);
......
2011-03-21 Kai Tietz <ktietz@redhat.com> 2011-03-21 Kai Tietz <ktietz@redhat.com>
PR target/12171 PR target/12171
* cxx-pretty-print.c (pp_cxx_ptr_operator):
Display allowed attributes for function pointer types.
* error.c (dump_type_prefix): Likewise.
* tree.c (cxx_attribute_table): Adjust table. * tree.c (cxx_attribute_table): Adjust table.
2011-03-18 Jason Merrill <jason@redhat.com> 2011-03-18 Jason Merrill <jason@redhat.com>
......
...@@ -1323,6 +1323,8 @@ pp_cxx_ptr_operator (cxx_pretty_printer *pp, tree t) ...@@ -1323,6 +1323,8 @@ pp_cxx_ptr_operator (cxx_pretty_printer *pp, tree t)
if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE
|| TYPE_PTR_TO_MEMBER_P (TREE_TYPE (t))) || TYPE_PTR_TO_MEMBER_P (TREE_TYPE (t)))
pp_cxx_ptr_operator (pp, TREE_TYPE (t)); pp_cxx_ptr_operator (pp, TREE_TYPE (t));
pp_c_attributes_display (pp_c_base (pp),
TYPE_ATTRIBUTES (TREE_TYPE (t)));
if (TREE_CODE (t) == POINTER_TYPE) if (TREE_CODE (t) == POINTER_TYPE)
{ {
pp_star (pp); pp_star (pp);
......
...@@ -661,6 +661,8 @@ dump_type_prefix (tree t, int flags) ...@@ -661,6 +661,8 @@ dump_type_prefix (tree t, int flags)
{ {
pp_cxx_whitespace (cxx_pp); pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp); pp_cxx_left_paren (cxx_pp);
pp_c_attributes_display (pp_c_base (cxx_pp),
TYPE_ATTRIBUTES (sub));
} }
if (TREE_CODE (t) == POINTER_TYPE) if (TREE_CODE (t) == POINTER_TYPE)
pp_character(cxx_pp, '*'); pp_character(cxx_pp, '*');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment