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 | |
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')
-rw-r--r-- | gcc/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/c-pretty-print.c | 113 | ||||
-rw-r--r-- | gcc/diagnostic.c | 16 | ||||
-rw-r--r-- | gcc/diagnostic.def | 2 | ||||
-rw-r--r-- | gcc/diagnostic.h | 4 | ||||
-rw-r--r-- | gcc/pretty-print.h | 7 |
6 files changed, 145 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 28d0f9eb15d..f5c74673349 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2002-08-12 Gabriel Dos Reis <gdr@nerim.net> + + * 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. + 2002-08-12 David Edelsohn <edelsohn@gnu.org> * doc/trouble.texi (Disappointments): Add static constructor and 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; } } diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 040af9bcab5..5ca64e1e4bf 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -301,7 +301,7 @@ output_decimal (buffer, i) output_buffer *buffer; int i; { - output_formatted_integer (buffer, "%d", i); + output_formatted_scalar (buffer, "%d", i); } static void @@ -309,7 +309,7 @@ output_long_decimal (buffer, i) output_buffer *buffer; long int i; { - output_formatted_integer (buffer, "%ld", i); + output_formatted_scalar (buffer, "%ld", i); } static void @@ -317,7 +317,7 @@ output_unsigned_decimal (buffer, i) output_buffer *buffer; unsigned int i; { - output_formatted_integer (buffer, "%u", i); + output_formatted_scalar (buffer, "%u", i); } static void @@ -325,7 +325,7 @@ output_long_unsigned_decimal (buffer, i) output_buffer *buffer; long unsigned int i; { - output_formatted_integer (buffer, "%lu", i); + output_formatted_scalar (buffer, "%lu", i); } static void @@ -333,7 +333,7 @@ output_octal (buffer, i) output_buffer *buffer; unsigned int i; { - output_formatted_integer (buffer, "%o", i); + output_formatted_scalar (buffer, "%o", i); } static void @@ -341,7 +341,7 @@ output_long_octal (buffer, i) output_buffer *buffer; unsigned long int i; { - output_formatted_integer (buffer, "%lo", i); + output_formatted_scalar (buffer, "%lo", i); } static void @@ -349,7 +349,7 @@ output_hexadecimal (buffer, i) output_buffer *buffer; unsigned int i; { - output_formatted_integer (buffer, "%x", i); + output_formatted_scalar (buffer, "%x", i); } static void @@ -357,7 +357,7 @@ output_long_hexadecimal (buffer, i) output_buffer *buffer; unsigned long int i; { - output_formatted_integer (buffer, "%lx", i); + output_formatted_scalar (buffer, "%lx", i); } /* Append to BUFFER a string specified by its STARTING character diff --git a/gcc/diagnostic.def b/gcc/diagnostic.def index 5ac353d2636..83e5d9cae72 100644 --- a/gcc/diagnostic.def +++ b/gcc/diagnostic.def @@ -5,3 +5,5 @@ DEFINE_DIAGNOSTIC_KIND (DK_ERROR, "error: ") DEFINE_DIAGNOSTIC_KIND (DK_WARNING, "warning: ") DEFINE_DIAGNOSTIC_KIND (DK_ANACHRONISM, "anachronism: ") DEFINE_DIAGNOSTIC_KIND (DK_NOTE, "note: ") +DEFINE_DIAGNOSTIC_KIND (DK_DEBUG, "debug: ") + diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index c77f40a4cdb..4835a7a0e44 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -160,7 +160,7 @@ struct output_buffer /* True if BUFFER is in line-wrapping mode. */ #define output_is_line_wrapping(BUFFER) (output_line_cutoff (BUFFER) > 0) -#define output_formatted_integer(BUFFER, FORMAT, INTEGER) \ +#define output_formatted_scalar(BUFFER, FORMAT, INTEGER) \ do \ { \ sprintf ((BUFFER)->digit_buffer, FORMAT, INTEGER); \ @@ -325,6 +325,6 @@ extern void output_verbatim PARAMS ((output_buffer *, const char *, extern void verbatim PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1; extern char *file_name_as_prefix PARAMS ((const char *)); -extern void inform PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1; +extern void inform PARAMS ((const char *, ...)); #endif /* ! GCC_DIAGNOSTIC_H */ diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h index 958e1ee9e5c..5efb9e73078 100644 --- a/gcc/pretty-print.h +++ b/gcc/pretty-print.h @@ -84,10 +84,11 @@ struct pretty_print_info pp_character (PPI, C); \ pp_whitespace (PPI); \ } while (0) -#define pp_format_integer(PPI, F, I) \ - output_formatted_integer (pp_buffer (PPI), F, I) +#define pp_format_scalar(PPI, F, S) \ + output_formatted_scalar (pp_buffer (PPI), F, S) #define pp_wide_integer(PPI, I) \ - pp_format_integer (PPI, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I) + pp_format_scalar (PPI, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I) +#define pp_pointer(PPI, P) pp_format_scalar (PPI, "%p", p) #define pp_identifier(PPI, ID) output_add_string (pp_buffer (PPI), ID) #define pp_tree_identifier(PPI, T) pp_identifier(PPI, IDENTIFIER_POINTER (T)) |