diagnostic.h (output_formatted_scalar): Rename from output_formatted_integer.
* 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. From-SVN: r56236
This commit is contained in:
parent
48c1db3d6f
commit
9b32718c73
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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: ")
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user