diff options
author | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-12 18:34:51 +0000 |
---|---|---|
committer | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-08-12 18:34:51 +0000 |
commit | 8e10b18fdb80b976dace5d092f60e02741bb974f (patch) | |
tree | b1a38ce7e84fb408f819801ff4a4661e61e604cb /gcc/c-pretty-print.c | |
parent | 9c348f2df163c8711eb9f23af92dc98e3d00c284 (diff) | |
download | gcc-8e10b18fdb80b976dace5d092f60e02741bb974f.tar.gz |
* diagnostic.h (output_formatted_scalar): Rename from
output_formatted_integer.
* diagnostic.def: Add DK_DEBUG.
* diagnostic.c (output_decimal): Adjust.
(output_long_decimal): Likewise.
(output_unsigned_decimal): Likewise.
(output_octal): Likewise.
(output_long_octal): Likewise.
(output_hexadecimal): Likewise.
(output_long_hexadecimal): Likewise.
* c-pretty-print.c (pp_c_type_specifier): New function.
(pp_c_specifier_qualifier_list): Likewise.
(pp_c_abstract_declarator): Likewise.
(pp_c_char): Replace pp_format_integer with pp_format_scalar.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56236 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-pretty-print.c')
-rw-r--r-- | gcc/c-pretty-print.c | 113 |
1 files changed, 112 insertions, 1 deletions
diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index c861d1727d3..18e22f0af6b 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -53,6 +53,13 @@ static void pp_c_inclusive_or_expression PARAMS ((c_pretty_print_info *, static void pp_c_logical_and_expression PARAMS ((c_pretty_print_info *, tree)); static void pp_c_conditional_expression PARAMS ((c_pretty_print_info *, tree)); static void pp_c_assignment_expression PARAMS ((c_pretty_print_info *, tree)); + +/* declarations. */ +static void pp_c_specifier_qualifier_list PARAMS ((c_pretty_print_info *, tree)); +static void pp_c_type_specifier PARAMS ((c_pretty_print_info *, tree)); +static void pp_c_abstract_declarator PARAMS ((c_pretty_print_info *, tree)); +static void pp_c_type_id PARAMS ((c_pretty_print_info *, tree)); + /* Declarations. */ @@ -70,6 +77,110 @@ pp_c_cv_qualifier (ppi, cv) pp_c_identifier (ppi, flag_isoc99 ? "restrict" : "__restrict__"); } +static void +pp_c_type_specifier (ppi, t) + c_pretty_print_info *ppi; + tree t; +{ + const enum tree_code code = TREE_CODE (t); + switch (code) + { + case ERROR_MARK: + pp_c_identifier (ppi, "<erroneous-type>"); + break; + +#if 0 + case UNKNOWN_TYPE: + pp_c_identifier (ppi, "<unkown-type>"); + break; +#endif + + case IDENTIFIER_NODE: + pp_c_tree_identifier (ppi, t); + break; + +#if 0 + case INTEGER_TYPE: + if (TREE_UNSIGNED (t)) + pp_c_identifier (ppi, "unsigned"); + /* fall through. */ + case VOID_TYPE: + case BOOLEAN_TYPE: + case REAL_TYPE: + if (TYPE_NAME (t) && TYPE_IDENTIFIER (t)) + pp_c_tree_identifier (t, TYPE_IDENTIFIER (t)); + else + pp_c_identifier (ppi, "<anonymous-type>"); + break; +#endif + + case COMPLEX_TYPE: + case VECTOR_TYPE: + pp_c_type_specifier (ppi, TREE_TYPE (t)); + if (code == COMPLEX_TYPE) + pp_c_identifier (ppi, flag_isoc99 ? "_Complex" : "__complex__"); + else if (code == VECTOR_TYPE) + pp_c_identifier (ppi, "__vector__"); + break; + + case TYPE_DECL: + pp_c_tree_identifier (ppi, DECL_NAME (t)); + break; + + case UNION_TYPE: + case RECORD_TYPE: + case ENUMERAL_TYPE: + if (code == UNION_TYPE) + pp_c_identifier (ppi, "union"); + else if (code == RECORD_TYPE) + pp_c_identifier (ppi, "struct"); + else if (code == ENUMERAL_TYPE) + pp_c_identifier (ppi, "enum"); + + if (TYPE_NAME (t)) + pp_c_tree_identifier (ppi, TYPE_NAME (t)); + else + pp_c_identifier (ppi, "<anonymous>"); + break; + + case POINTER_TYPE: + case ARRAY_TYPE: + { + } + break; + + default: + pp_unsupported_tree (ppi, t); + } +} + +static inline void +pp_c_specifier_qualifier_list (ppi, t) + c_pretty_print_info *ppi; + tree t; +{ + pp_c_type_specifier (ppi, t); + pp_c_cv_qualifier (ppi, TYPE_QUALS (t)); +} + +static void +pp_c_abstract_declarator (ppi, t) + c_pretty_print_info *ppi; + tree t; +{ + pp_unsupported_tree (ppi, t); +} + + +static inline void +pp_c_type_id (ppi, t) + c_pretty_print_info *ppi; + tree t; +{ + pp_c_specifier_qualifier_list (ppi, t); + pp_c_abstract_declarator (ppi, t); +} + /* Expressions. */ @@ -115,7 +226,7 @@ pp_c_char (ppi, c) if (ISPRINT (c)) pp_character (ppi, c); else - pp_format_integer (ppi, "\\%03o", (unsigned) c); + pp_format_scalar (ppi, "\\%03o", (unsigned) c); break; } } |