diff options
author | Gabriel Dos Reis <gdr@integrable-solutions.net> | 2004-05-31 15:25:51 +0000 |
---|---|---|
committer | Gabriel Dos Reis <gdr@gcc.gnu.org> | 2004-05-31 15:25:51 +0000 |
commit | 41fd3bac90eeedbfcc63255a1139d16b733db5f2 (patch) | |
tree | 5e8925b20e37d3ca0e950c5715828aaa2272dc78 /gcc | |
parent | d3157fb66d158c3f7073988cd5135da88a48a2f1 (diff) | |
download | gcc-41fd3bac90eeedbfcc63255a1139d16b733db5f2.zip gcc-41fd3bac90eeedbfcc63255a1139d16b733db5f2.tar.gz gcc-41fd3bac90eeedbfcc63255a1139d16b733db5f2.tar.bz2 |
c-pretty-print.c (pp_c_left_bracket): Make a function.
* c-pretty-print.c (pp_c_left_bracket): Make a function.
(pp_c_right_bracket): Likewise.
(pp_c_star): Likewise.
(pp_c_ampersand): Define.
* c-pretty-print.h (pp_c_left_bracket): Declare.
(pp_c_right_bracket): Likewise.
(pp_c_star): Likewise.
(pp_c_ampersand): Likewise.
cp/
* cxx-pretty-print.c (pp_cxx_colon_colon): Expor.
(pp_cxx_begin_template_argument_list): Turn into a function.
(pp_cxx_end_template_argument_list): Likewise.
(pp_cxx_separate_with): Define.
(pp_cxx_unqualified_id): Tidy.
(pp_cxx_primary_expression): Likewise.
(pp_cxx_postfix_expression): Likewise.
(pp_cxx_expression): Likewise.
(pp_cxx_simple_type_specifier): Likewise.
(pp_cxx_type_specifier_seq): Likewise.
(pp_cxx_parameter_declaration_clause): Likewise.
(pp_cxx_exception_specification): Likewise.
(pp_cxx_direct_declarator): Likewise.
(pp_cxx_type_id): Likewise.
* cxx-pretty-print.h (pp_cxx_whitespace): Export from
cxx-pretty-print.c.
(pp_cxx_left_paren): Likewise.
(pp_cxx_right_paren): Likewise.
(pp_cxx_left_brace): Likewise.
(pp_cxx_right_brace): Likewise.
(pp_cxx_left_bracket): Likewise.
(pp_cxx_right_bracket): Likewise.
(pp_cxx_dot): Likewise.
(pp_cxx_identifier): Likewise.
(pp_cxx_tree_identifier): Likewise.
(pp_cxx_ampersand): New macro.
(pp_cxx_star): Likewise.
(pp_cxx_arrow): Likewise.
(pp_cxx_semicolon): Likewise.
(pp_cxx_complement): Likewise.
(pp_cxx_begin_template_argument_list): Declaree.
(pp_cxx_end_template_argument_list): Likewise.
(pp_cxx_colon_colon): likewise.
From-SVN: r82488
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/c-pretty-print.c | 53 | ||||
-rw-r--r-- | gcc/c-pretty-print.h | 7 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 36 | ||||
-rw-r--r-- | gcc/cp/cxx-pretty-print.c | 75 | ||||
-rw-r--r-- | gcc/cp/cxx-pretty-print.h | 22 |
6 files changed, 153 insertions, 51 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 48c342d..961c3bf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2004-05-31 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * c-pretty-print.c (pp_c_left_bracket): Make a function. + (pp_c_right_bracket): Likewise. + (pp_c_star): Likewise. + (pp_c_ampersand): Define. + * c-pretty-print.h (pp_c_left_bracket): Declare. + (pp_c_right_bracket): Likewise. + (pp_c_star): Likewise. + (pp_c_ampersand): Likewise. + 2004-05-31 Eric Botcazou <ebotcazou@libertysurf.fr> * config/sol2.h (__enable_execute_stack): ANSIfy function diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index e73ab1b..4b5dd51 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -42,24 +42,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA pp_c_whitespace (PP); \ } while (0) -#define pp_c_left_bracket(PP) \ - do { \ - pp_left_bracket (PP); \ - pp_base (PP)->padding = pp_none; \ - } while (0) - -#define pp_c_right_bracket(PP) \ - do { \ - pp_right_bracket (PP); \ - pp_base (PP)->padding = pp_none; \ - } while (0) - -#define pp_c_star(PP) \ - do { \ - pp_star (PP); \ - pp_base (PP)->padding = pp_none; \ - } while (0) - /* literal */ static void pp_c_char (c_pretty_printer *, int); @@ -120,6 +102,20 @@ pp_c_right_brace (c_pretty_printer *pp) } void +pp_c_left_bracket (c_pretty_printer *pp) +{ + pp_left_bracket (pp); + pp_base (pp)->padding = pp_none; +} + +void +pp_c_right_bracket (c_pretty_printer *pp) +{ + pp_right_bracket (pp); + pp_base (pp)->padding = pp_none; +} + +void pp_c_dot (c_pretty_printer *pp) { pp_dot (pp); @@ -134,6 +130,13 @@ pp_c_ampersand (c_pretty_printer *pp) } void +pp_c_star (c_pretty_printer *pp) +{ + pp_star (pp); + pp_base (pp)->padding = pp_none; +} + +void pp_c_arrow (c_pretty_printer *pp) { pp_arrow (pp); @@ -147,6 +150,20 @@ pp_c_semicolon (c_pretty_printer *pp) pp_base (pp)->padding = pp_none; } +void +pp_c_complement (c_pretty_printer *pp) +{ + pp_complement (pp); + pp_base (pp)->padding = pp_none; +} + +void +pp_c_exclamation (c_pretty_printer *pp) +{ + pp_exclamation (pp); + pp_base (pp)->padding = pp_none; +} + /* Print out the external representation of CV-QUALIFIER. */ static void diff --git a/gcc/c-pretty-print.h b/gcc/c-pretty-print.h index efffa23..f1ab608 100644 --- a/gcc/c-pretty-print.h +++ b/gcc/c-pretty-print.h @@ -1,5 +1,5 @@ /* Various declarations for the C and C++ pretty-printers. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net> This file is part of GCC. @@ -159,10 +159,15 @@ void pp_c_left_paren (c_pretty_printer *); void pp_c_right_paren (c_pretty_printer *); void pp_c_left_brace (c_pretty_printer *); void pp_c_right_brace (c_pretty_printer *); +void pp_c_left_bracket (c_pretty_printer *); +void pp_c_right_bracket (c_pretty_printer *); void pp_c_dot (c_pretty_printer *); void pp_c_ampersand (c_pretty_printer *); +void pp_c_star (c_pretty_printer *); void pp_c_arrow (c_pretty_printer *); void pp_c_semicolon (c_pretty_printer *); +void pp_c_complement (c_pretty_printer *); +void pp_c_exclamation (c_pretty_printer *); void pp_c_space_for_pointer_operator (c_pretty_printer *, tree); /* Declarations. */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d06d4d8..4ead672 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,39 @@ +2004-05-31 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * cxx-pretty-print.c (pp_cxx_colon_colon): Expor. + (pp_cxx_begin_template_argument_list): Turn into a function. + (pp_cxx_end_template_argument_list): Likewise. + (pp_cxx_separate_with): Define. + (pp_cxx_unqualified_id): Tidy. + (pp_cxx_primary_expression): Likewise. + (pp_cxx_postfix_expression): Likewise. + (pp_cxx_expression): Likewise. + (pp_cxx_simple_type_specifier): Likewise. + (pp_cxx_type_specifier_seq): Likewise. + (pp_cxx_parameter_declaration_clause): Likewise. + (pp_cxx_exception_specification): Likewise. + (pp_cxx_direct_declarator): Likewise. + (pp_cxx_type_id): Likewise. + * cxx-pretty-print.h (pp_cxx_whitespace): Export from + cxx-pretty-print.c. + (pp_cxx_left_paren): Likewise. + (pp_cxx_right_paren): Likewise. + (pp_cxx_left_brace): Likewise. + (pp_cxx_right_brace): Likewise. + (pp_cxx_left_bracket): Likewise. + (pp_cxx_right_bracket): Likewise. + (pp_cxx_dot): Likewise. + (pp_cxx_identifier): Likewise. + (pp_cxx_tree_identifier): Likewise. + (pp_cxx_ampersand): New macro. + (pp_cxx_star): Likewise. + (pp_cxx_arrow): Likewise. + (pp_cxx_semicolon): Likewise. + (pp_cxx_complement): Likewise. + (pp_cxx_begin_template_argument_list): Declaree. + (pp_cxx_end_template_argument_list): Likewise. + (pp_cxx_colon_colon): likewise. + 2004-05-31 Eric Botcazou <ebotcazou@libertysurf.fr> * parser.c (cp_parser_simple_type_specifier): Explicitly test diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index a07f009..c5e667d 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -43,14 +43,6 @@ static void pp_cxx_parameter_declaration_clause (cxx_pretty_printer *, tree); static void pp_cxx_abstract_declarator (cxx_pretty_printer *, tree); static void pp_cxx_template_parameter (cxx_pretty_printer *, tree); -#define pp_cxx_whitespace(PP) pp_c_whitespace (pp_c_base (PP)) -#define pp_cxx_left_paren(PP) pp_c_left_paren (pp_c_base (PP)) -#define pp_cxx_right_paren(PP) pp_c_right_paren (pp_c_base (PP)) -#define pp_cxx_left_brace(PP) pp_c_left_brace (pp_c_base (PP)) -#define pp_cxx_right_brace(PP) pp_c_right_brace (pp_c_base (PP)) -#define pp_cxx_dot(PP) pp_c_dot (pp_c_base (PP)) -#define pp_cxx_arrow(PP) pp_c_arrow (pp_c_base (PP)) -#define pp_cxx_semicolon(PP) pp_c_semicolon (pp_c_base (PP)) static inline void pp_cxx_nonconsecutive_character (cxx_pretty_printer *pp, int c) @@ -63,14 +55,6 @@ pp_cxx_nonconsecutive_character (cxx_pretty_printer *pp, int c) pp_base (pp)->padding = pp_none; } -#define pp_cxx_begin_template_argument_list(PP) \ - pp_cxx_nonconsecutive_character (PP, '<') -#define pp_cxx_end_template_argument_list(PP) \ - pp_cxx_nonconsecutive_character (PP, '>') - -#define pp_cxx_identifier(PP, ID) pp_c_identifier (pp_c_base (PP), ID) -#define pp_cxx_tree_identifier(PP, T) pp_c_tree_identifier (pp_c_base (PP), T) - #define pp_cxx_storage_class_specifier(PP, T) \ pp_c_storage_class_specifier (pp_c_base (PP), T) #define pp_cxx_expression_list(PP, T) \ @@ -82,13 +66,31 @@ pp_cxx_nonconsecutive_character (cxx_pretty_printer *pp, int c) #define pp_cxx_call_argument_list(PP, T) \ pp_c_call_argument_list (pp_c_base (PP), T) -static void +void pp_cxx_colon_colon (cxx_pretty_printer *pp) { pp_colon_colon (pp); pp_base (pp)->padding = pp_none; } +void +pp_cxx_begin_template_argument_list (cxx_pretty_printer *pp) +{ + pp_cxx_nonconsecutive_character (pp, '<'); +} + +void +pp_cxx_end_template_argument_list (cxx_pretty_printer *pp) +{ + pp_cxx_nonconsecutive_character (pp, '>'); +} + +void +pp_cxx_separate_with (cxx_pretty_printer *pp, int c) +{ + pp_separate_with (pp, c); + pp_base (pp)->padding = pp_none; +} /* Expressions. */ @@ -158,7 +160,7 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t) case IDENTIFIER_NODE: if (t == NULL) - pp_cxx_identifier (pp, "<anonymous>"); + pp_cxx_identifier (pp, "<unnamed>"); else if (IDENTIFIER_TYPENAME_P (t)) pp_cxx_conversion_function_id (pp, t); else @@ -185,7 +187,13 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t) break; case TEMPLATE_TYPE_PARM: - t = TEMPLATE_TYPE_PARM_INDEX (t); + case TEMPLATE_TEMPLATE_PARM: + if (TYPE_IDENTIFIER (t)) + pp_cxx_unqualified_id (pp, TYPE_IDENTIFIER (t)); + else + pp_cxx_canonical_template_parameter (pp, t); + break; + case TEMPLATE_PARM_INDEX: pp_cxx_unqualified_id (pp, TEMPLATE_PARM_DECL (t)); break; @@ -327,6 +335,7 @@ pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t) case RESULT_DECL: case TEMPLATE_TYPE_PARM: + case TEMPLATE_TEMPLATE_PARM: case TEMPLATE_PARM_INDEX: pp_cxx_unqualified_id (pp, t); break; @@ -413,7 +422,7 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t) } if (code == AGGR_INIT_EXPR && AGGR_INIT_VIA_CTOR_P (t)) { - pp_separate_with (pp, ','); + pp_cxx_separate_with (pp, ','); pp_cxx_postfix_expression (pp, TREE_OPERAND (t, 2)); } break; @@ -435,13 +444,13 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t) case REINTERPRET_CAST_EXPR: case CONST_CAST_EXPR: if (code == DYNAMIC_CAST_EXPR) - pp_identifier (pp, "dynamic_cast"); + pp_cxx_identifier (pp, "dynamic_cast"); else if (code == STATIC_CAST_EXPR) - pp_identifier (pp, "static_cast"); + pp_cxx_identifier (pp, "static_cast"); else if (code == REINTERPRET_CAST_EXPR) - pp_identifier (pp, "reinterpret_cast"); + pp_cxx_identifier (pp, "reinterpret_cast"); else - pp_identifier (pp, "const_cast"); + pp_cxx_identifier (pp, "const_cast"); pp_cxx_begin_template_argument_list (pp); pp_cxx_type_id (pp, TREE_TYPE (t)); pp_cxx_end_template_argument_list (pp); @@ -829,6 +838,7 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t) case TEMPLATE_DECL: case TEMPLATE_TYPE_PARM: case TEMPLATE_PARM_INDEX: + case TEMPLATE_TEMPLATE_PARM: pp_cxx_primary_expression (pp, t); break; @@ -1000,6 +1010,7 @@ pp_cxx_simple_type_specifier (cxx_pretty_printer *pp, tree t) break; case TEMPLATE_TYPE_PARM: + case TEMPLATE_TEMPLATE_PARM: case TEMPLATE_PARM_INDEX: pp_cxx_unqualified_id (pp, t); break; @@ -1033,9 +1044,10 @@ pp_cxx_type_specifier_seq (cxx_pretty_printer *pp, tree t) { case TEMPLATE_DECL: case TEMPLATE_TYPE_PARM: + case TEMPLATE_TEMPLATE_PARM: case TYPE_DECL: case BOUND_TEMPLATE_TEMPLATE_PARM: - pp_c_type_qualifier_list (pp_c_base (pp), t); + pp_cxx_cv_qualifier_seq (pp, t); pp_cxx_simple_type_specifier (pp, t); break; @@ -1149,7 +1161,7 @@ pp_cxx_parameter_declaration_clause (cxx_pretty_printer *pp, tree t) for (; args; args = TREE_CHAIN (args), types = TREE_CHAIN (types)) { if (!first) - pp_separate_with (pp, ','); + pp_cxx_separate_with (pp, ','); first = false; pp_cxx_parameter_declaration (pp, abstract ? TREE_VALUE (types) : args); if (!abstract && pp_c_base (pp)->flags & pp_cxx_flag_default_argument) @@ -1183,7 +1195,7 @@ pp_cxx_exception_specification (cxx_pretty_printer *pp, tree t) { pp_cxx_type_id (pp, TREE_VALUE (ex_spec)); if (TREE_CHAIN (ex_spec)) - pp_separate_with (pp, ','); + pp_cxx_separate_with (pp, ','); } pp_cxx_right_paren (pp); } @@ -1230,6 +1242,7 @@ pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t) case TEMPLATE_DECL: case TEMPLATE_TYPE_PARM: case TEMPLATE_PARM_INDEX: + case TEMPLATE_TEMPLATE_PARM: break; default: @@ -1274,7 +1287,7 @@ pp_cxx_ctor_initializer (cxx_pretty_printer *pp, tree t) pp_cxx_primary_expression (pp, TREE_PURPOSE (t)); pp_cxx_call_argument_list (pp, TREE_VALUE (t)); if (TREE_CHAIN (t)) - pp_separate_with (pp, ','); + pp_cxx_separate_with (pp, ','); } } @@ -1400,9 +1413,7 @@ pp_cxx_type_id (cxx_pretty_printer *pp, tree t) case TEMPLATE_DECL: case TYPEOF_TYPE: case TEMPLATE_ID_EXPR: - /* FIXME: Should be pp_cxx_type_specifier_seq. */ pp_cxx_type_specifier_seq (pp, t); - pp_cxx_declarator (pp, t); break; default: @@ -1432,7 +1443,7 @@ pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t) { tree arg = TREE_VEC_ELT (t, i); if (i != 0) - pp_separate_with (pp, ','); + pp_cxx_separate_with (pp, ','); if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL && TYPE_P (DECL_TEMPLATE_RESULT (arg)))) pp_cxx_type_id (pp, arg); @@ -1582,7 +1593,7 @@ pp_cxx_template_parameter_list (cxx_pretty_printer *pp, tree t) for (i = 0; i < n; ++i) { if (i) - pp_separate_with (pp, ','); + pp_cxx_separate_with (pp, ','); pp_cxx_template_parameter (pp, TREE_VEC_ELT (t, i)); } } diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h index 46a2969..a2ce6b0 100644 --- a/gcc/cp/cxx-pretty-print.h +++ b/gcc/cp/cxx-pretty-print.h @@ -44,7 +44,29 @@ typedef struct #define pp_cxx_cv_qualifier_seq(PP, T) \ pp_c_type_qualifier_list (pp_c_base (PP), T) +#define pp_cxx_whitespace(PP) pp_c_whitespace (pp_c_base (PP)) +#define pp_cxx_left_paren(PP) pp_c_left_paren (pp_c_base (PP)) +#define pp_cxx_right_paren(PP) pp_c_right_paren (pp_c_base (PP)) +#define pp_cxx_left_brace(PP) pp_c_left_brace (pp_c_base (PP)) +#define pp_cxx_right_brace(PP) pp_c_right_brace (pp_c_base (PP)) +#define pp_cxx_left_bracket(PP) pp_c_left_bracket (pp_c_base (PP)) +#define pp_cxx_right_bracket(PP) pp_c_right_bracket (pp_c_base (PP)) +#define pp_cxx_dot(PP) pp_c_dot (pp_c_base (PP)) +#define pp_cxx_ampersand(PP) pp_c_ampersand (pp_c_base (PP)) +#define pp_cxx_star(PP) pp_c_star (pp_c_base (PP)) +#define pp_cxx_arrow(PP) pp_c_arrow (pp_c_base (PP)) +#define pp_cxx_semicolon(PP) pp_c_semicolon (pp_c_base (PP)) +#define pp_cxx_complement(PP) pp_c_complement (pp_c_base (PP)) + +#define pp_cxx_identifier(PP, I) pp_c_identifier (pp_c_base (PP), I) +#define pp_cxx_tree_identifier(PP, T) \ + pp_c_tree_identifier (pp_c_base (PP), T) + void pp_cxx_pretty_printer_init (cxx_pretty_printer *); +void pp_cxx_begin_template_argument_list (cxx_pretty_printer *); +void pp_cxx_end_template_argument_list (cxx_pretty_printer *); +void pp_cxx_colon_colon (cxx_pretty_printer *); +void pp_cxx_separate_with (cxx_pretty_printer *, int); void pp_cxx_declaration (cxx_pretty_printer *, tree); void pp_cxx_function_definition (cxx_pretty_printer *, tree); |