This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH to cp/error.c et al (1/n)


This patch removes redundant code from cp/error.c.
Bootstrapped and regtested on i686-pc-linux-gnu.
Applied to mainline.

-- Gaby

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.3245
diff -p -r2.3245 ChangeLog
*** ChangeLog	21 Mar 2004 20:03:04 -0000	2.3245
--- ChangeLog	21 Mar 2004 23:52:30 -0000
***************
*** 1,3 ****
--- 1,9 ----
+ 2004-03-21  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+ 
+ 	* pretty-print.c (pp_base_maybe_space): New function.
+ 	* pretty-print.h (pp_base_maybe_space): Declare.
+ 	(pp_maybe_space): New macro.
+ 
  2004-03-21  Ulrich Weigand  <uweigand@de.ibm.com>
  
  	* config/s390/s390.md ("addti3", "subti3"): New insns and splitters.
Index: pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/pretty-print.c,v
retrieving revision 2.8
diff -p -r2.8 pretty-print.c
*** pretty-print.c	20 Dec 2003 06:32:31 -0000	2.8
--- pretty-print.c	21 Mar 2004 23:52:31 -0000
*************** pp_base_string (pretty_printer *pp, cons
*** 545,548 ****
--- 545,558 ----
    pp_maybe_wrap_text (pp, str, str + (str ? strlen (str) : 0));
  }
  
+ /* Maybe print out a whitespace if needed.   */
  
+ void
+ pp_base_maybe_space (pretty_printer *pp)
+ {
+   if (pp_base (pp)->padding != pp_none)
+     {
+       pp_space (pp);
+       pp_base (pp)->padding = pp_none;
+     }
+ }
Index: pretty-print.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/pretty-print.h,v
retrieving revision 1.11
diff -p -r1.11 pretty-print.h
*** pretty-print.h	21 Nov 2003 06:52:23 -0000	1.11
--- pretty-print.h	21 Mar 2004 23:52:31 -0000
*************** struct pretty_print_info
*** 205,210 ****
--- 205,211 ----
    } while (0)
  #define pp_maybe_newline_and_indent(PP, N) \
    if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N)
+ #define pp_maybe_space(PP)   pp_base_maybe_space (pp_base (PP))
  #define pp_separate_with(PP, C)     \
     do {                             \
       pp_character (PP, C);          \
*************** extern void pp_base_indent (pretty_print
*** 257,261 ****
--- 258,263 ----
  extern void pp_base_newline (pretty_printer *);
  extern void pp_base_character (pretty_printer *, int);
  extern void pp_base_string (pretty_printer *, const char *);
+ extern void pp_base_maybe_space (pretty_printer *);
  
  #endif /* GCC_PRETTY_PRINT_H */
Index: cp/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.4007
diff -p -r1.4007 ChangeLog
*** cp/ChangeLog	21 Mar 2004 17:48:36 -0000	1.4007
--- cp/ChangeLog	21 Mar 2004 23:52:33 -0000
***************
*** 1,3 ****
--- 1,21 ----
+ 2004-03-21  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+ 
+ 	* error.c (enum pad): Remove.
+ 	(dump_qualifiers): Likewise.
+ 	(dump_type): Replace dump_qualifiers with pp_cxx_cv_qualifier_seq.
+ 	(dump_aggr_type): Likewise.
+ 	(dump_type_suffix): Likewise.
+ 	(dump_simple_decl): Likewise.
+ 	(dump_function_decl): Likewise.
+ 	(cv_to_string): Likewise.
+ 	(dump_type_prefix): Likewise.  Adjust return void.  
+ 	* cxx-pretty-print.c (pp_cxx_cv_qualifier_seq): Move to
+ 	cxx_pretty_print.h.
+ 	(pp_cxx_template_keyword_if_needed): Document.
+ 	(pp_cxx_qualified_id): Document case FUNCTION_DECL.  Tidy.
+ 	(pp_cxx_expression): Handle NON_DEPENDENT_EXPR and
+ 	MUST_NOT_THROW_EXPR.  
+ 
  2004-03-21  Mark Mitchell  <mark@codesourcery.com>
  
  	PR c++/14616
Index: cp/cxx-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cxx-pretty-print.c,v
retrieving revision 1.14
diff -p -r1.14 cxx-pretty-print.c
*** cp/cxx-pretty-print.c	19 Mar 2004 14:18:27 -0000	1.14
--- cp/cxx-pretty-print.c	21 Mar 2004 23:52:34 -0000
*************** pp_cxx_nonconsecutive_character (cxx_pre
*** 70,77 ****
  #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_cv_qualifier_seq(PP, T)   \
-    pp_c_type_qualifier_list (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)    \
--- 70,75 ----
*************** is_destructor_name (tree name)
*** 109,114 ****
--- 107,113 ----
  
     conversion-declarator:
        ptr-operator conversion-declarator(opt)  */
+ 
  static inline void
  pp_cxx_conversion_function_id (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_template_id (cxx_pretty_printer *
*** 131,136 ****
--- 130,136 ----
       conversion-function-id
       ~ class-name
       template-id  */
+ 
  static void
  pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_unqualified_id (cxx_pretty_printe
*** 195,200 ****
--- 195,205 ----
      }
  }
  
+ /* Pretty-print out the token sequence ":: template" in template codes
+    where it is needed to "inline declare" the (following) member as
+    a template.  This situtation arises when SCOPE of T is dependent
+    on template parameters.  */
+ 
  static inline void
  pp_cxx_template_keyword_if_needed (cxx_pretty_printer *pp, tree scope, tree t)
  {
*************** pp_cxx_template_keyword_if_needed (cxx_p
*** 206,211 ****
--- 211,217 ----
  /* nested-name-specifier:
        class-or-namespace-name :: nested-name-specifier(opt)
        class-or-namespace-name :: template nested-name-specifier   */
+ 
  static void
  pp_cxx_nested_name_specifier (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_nested_name_specifier (cxx_pretty
*** 221,236 ****
--- 227,252 ----
  
  /* qualified-id:
        nested-name-specifier template(opt) unqualified-id  */
+ 
  static void
  pp_cxx_qualified_id (cxx_pretty_printer *pp, tree t)
  {
    switch (TREE_CODE (t))
      {
+       /* A pointer-to-member is always qualified.  */
      case PTRMEM_CST:
        pp_cxx_nested_name_specifier (pp, PTRMEM_CST_CLASS (t));
        pp_cxx_unqualified_id (pp, PTRMEM_CST_MEMBER (t));
        break;
  
+       /* In Standard C++, functions cannot possibly be used as
+          nested-name-specifiers.  However, there are situations where
+          is "makes sense" to output the surrouding function name for the
+          purpose of emphasizing on the scope kind.  Just printing the
+          function name might not be sufficient as it may be overloaded; so,
+          we decorate the function with its signature too.
+          FIXME:  This is probably the wrong pretty-printing for conversion
+          functions and some function templates.  */
      case OVERLOAD:
        t = OVL_CURRENT (t);
      case FUNCTION_DECL:
*************** pp_cxx_qualified_id (cxx_pretty_printer 
*** 238,243 ****
--- 254,260 ----
          pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
        pp_cxx_unqualified_id
          (pp, DECL_CONSTRUCTOR_P (t) ? DECL_CONTEXT (t) : t);
+       pp_cxx_parameter_declaration_clause (pp, TREE_TYPE (t));
        break;
  
      case OFFSET_REF:
*************** pp_cxx_qualified_id (cxx_pretty_printer 
*** 263,268 ****
--- 280,286 ----
  /* id-expression:
        unqualified-id
        qualified-id   */
+ 
  static inline void
  pp_cxx_id_expression (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_id_expression (cxx_pretty_printer
*** 282,287 ****
--- 300,306 ----
       :: qualifier-id
       ( expression )
       id-expression   */
+ 
  static void
  pp_cxx_primary_expression (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_postfix_expression (cxx_pretty_pr
*** 482,487 ****
--- 501,507 ----
  
     new-initializer:
        ( expression-list(opt) )  */
+ 
  static void
  pp_cxx_new_expression (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_new_expression (cxx_pretty_printe
*** 522,527 ****
--- 542,548 ----
  /* delete-expression:
        ::(opt) delete cast-expression
        ::(opt) delete [ ] cast-expression   */
+ 
  static void
  pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_delete_expression (cxx_pretty_pri
*** 562,567 ****
--- 583,589 ----
     GNU extensions:
        __alignof__ unary-expression
        __alignof__ ( type-id )  */
+ 
  static void
  pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_unary_expression (cxx_pretty_prin
*** 587,592 ****
--- 609,615 ----
  /* cast-expression:
        unary-expression
        ( type-id ) cast-expression  */
+ 
  static void
  pp_cxx_cast_expression (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_cast_expression (cxx_pretty_print
*** 607,612 ****
--- 630,636 ----
        cast-expression
        pm-expression .* cast-expression
        pm-expression ->* cast-expression  */
+ 
  static void
  pp_cxx_pm_expression (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_pm_expression (cxx_pretty_printer
*** 640,645 ****
--- 664,670 ----
        multiplicative-expression * pm-expression
        multiplicative-expression / pm-expression
        multiplicative-expression % pm-expression  */
+ 
  static void
  pp_cxx_multiplicative_expression (cxx_pretty_printer *pp, tree e)
  {
*************** pp_cxx_multiplicative_expression (cxx_pr
*** 670,675 ****
--- 695,701 ----
  /* conditional-expression:
        logical-or-expression
        logical-or-expression ?  expression  : assignment-expression  */
+ 
  static void
  pp_cxx_conditional_expression (cxx_pretty_printer *pp, tree e)
  {
*************** pp_cxx_conditional_expression (cxx_prett
*** 687,692 ****
--- 713,720 ----
      pp_c_logical_or_expression (pp_c_base (pp), e);
  }
  
+ /* Pretty-print a compound assignment operator token as indicated by T.  */
+ 
  static void
  pp_cxx_assignment_operator (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_assignment_operator (cxx_pretty_p
*** 733,738 ****
--- 761,767 ----
  
     assignment-operator: one of
        =    *=    /=    %=    +=    -=    >>=    <<=    &=    ^=    |=  */
+ 
  static void
  pp_cxx_assignment_expression (cxx_pretty_printer *pp, tree e)
  {
*************** pp_cxx_expression (cxx_pretty_printer *p
*** 854,859 ****
--- 883,893 ----
        pp_cxx_assignment_expression (pp, t);
        break;
  
+     case NON_DEPENDENT_EXPR:
+     case MUST_NOT_THROW_EXPR:
+       pp_cxx_expression (pp, t);
+       break;
+ 
      default:
        pp_c_expression (pp_c_base (pp), t);
        break;      
*************** pp_cxx_expression (cxx_pretty_printer *p
*** 867,872 ****
--- 901,907 ----
        inline
        virtual
        explicit   */
+ 
  static void
  pp_cxx_function_specifier (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_function_specifier (cxx_pretty_pr
*** 894,899 ****
--- 929,935 ----
        function-specifier
        friend
        typedef  */
+ 
  static void
  pp_cxx_decl_specifier_seq (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_decl_specifier_seq (cxx_pretty_pr
*** 950,955 ****
--- 986,992 ----
        float
        double
        void  */
+ 
  static void
  pp_cxx_simple_type_specifier (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_implicit_parameter_type (tree mf)
*** 1075,1080 ****
--- 1112,1118 ----
        decl-specifier-seq declarator = assignment-expression
        decl-specifier-seq abstract-declarator(opt)
        decl-specifier-seq abstract-declarator(opt) assignment-expression  */
+ 
  static inline void
  pp_cxx_parameter_declaration (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_parameter_declaration (cxx_pretty
*** 1092,1097 ****
--- 1130,1136 ----
     parameter-declaration-list:
        parameter-declaration
        parameter-declaration-list , parameter-declaration  */
+ 
  static void
  pp_cxx_parameter_declaration_clause (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_parameter_declaration_clause (cxx
*** 1129,1134 ****
--- 1168,1174 ----
     type-id-list
        type-id
        type-id-list , type-id   */
+ 
  static void
  pp_cxx_exception_specification (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_exception_specification (cxx_pret
*** 1153,1158 ****
--- 1193,1199 ----
                                              exception-specification(opt)
        direct-declaration [ constant-expression(opt) ]
        ( declarator )  */
+ 
  static void
  pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_direct_declarator (cxx_pretty_pri
*** 1199,1204 ****
--- 1240,1246 ----
  /* declarator:
     direct-declarator
     ptr-operator declarator  */
+ 
  static void
  pp_cxx_declarator (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_declarator (cxx_pretty_printer *p
*** 1218,1223 ****
--- 1260,1266 ----
     mem-initializer-id:
        ::(opt) nested-name-specifier(opt) class-name
        identifier   */
+ 
  static void
  pp_cxx_ctor_initializer (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_function_definition (cxx_pretty_p
*** 1270,1275 ****
--- 1313,1319 ----
  /* abstract-declarator:
        ptr-operator abstract-declarator(opt)
        direct-abstract-declarator  */
+ 
  static void
  pp_cxx_abstract_declarator (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_abstract_declarator (cxx_pretty_p
*** 1290,1295 ****
--- 1334,1340 ----
                             cv-qualifier-seq(opt) exception-specification(opt)
        direct-abstract-declarator(opt) [ constant-expression(opt) ]
        ( abstract-declarator )  */
+ 
  static void
  pp_cxx_direct_abstract_declarator (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_direct_abstract_declarator (cxx_p
*** 1332,1337 ****
--- 1377,1383 ----
  
  /* type-id:
       type-specifier-seq abstract-declarator(opt) */
+ 
  static void
  pp_cxx_type_id (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_type_id (cxx_pretty_printer *pp, 
*** 1374,1379 ****
--- 1420,1426 ----
        assignment-expression
        type-id
        template-name   */
+ 
  static void
  pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_namespace_alias_definition (cxx_p
*** 1511,1516 ****
--- 1558,1564 ----
  
  /* simple-declaration:
        decl-specifier-seq(opt) init-declarator-list(opt)  */
+ 
  static void
  pp_cxx_simple_declaration (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_template_parameter_list (cxx_pret
*** 1550,1555 ****
--- 1598,1604 ----
       template < template-parameter-list > class identifier(opt)
       template < template-parameter-list > class identifier(opt) = template-name
  */
+ 
  static void
  pp_cxx_template_parameter (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_canonical_template_parameter (cxx
*** 1600,1605 ****
--- 1649,1655 ----
  /*
    template-declaration:
       export(opt) template < template-parameter-list > declaration   */
+ 
  static void
  pp_cxx_template_declaration (cxx_pretty_printer *pp, tree t)
  {
*************** pp_cxx_declaration (cxx_pretty_printer *
*** 1703,1708 ****
--- 1753,1760 ----
  
  
  typedef c_pretty_print_fn pp_fun;
+ 
+ /* Initialization of a C++ pretty-printer object.  */
  
  void
  pp_cxx_pretty_printer_init (cxx_pretty_printer *pp)
Index: cp/cxx-pretty-print.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cxx-pretty-print.h,v
retrieving revision 1.5
diff -p -r1.5 cxx-pretty-print.h
*** cp/cxx-pretty-print.h	7 Oct 2003 07:07:02 -0000	1.5
--- cp/cxx-pretty-print.h	21 Mar 2004 23:52:34 -0000
*************** typedef struct
*** 41,46 ****
--- 41,49 ----
    tree enclosing_scope;
  } cxx_pretty_printer;
  
+ #define pp_cxx_cv_qualifier_seq(PP, T)   \
+    pp_c_type_qualifier_list (pp_c_base (PP), T)
+ 
  void pp_cxx_pretty_printer_init (cxx_pretty_printer *);
  
  void pp_cxx_declaration (cxx_pretty_printer *, tree);
Index: cp/error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/error.c,v
retrieving revision 1.247
diff -p -r1.247 error.c
*** cp/error.c	18 Mar 2004 20:58:44 -0000	1.247
--- cp/error.c	21 Mar 2004 23:52:35 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 32,39 ****
  #include "langhooks-def.h"
  #include "cxx-pretty-print.h"
  
- enum pad { none, before, after };
- 
  #define pp_template_argument_list_start(PP) \
     pp_non_consecutive_character (PP, '<')
  #define pp_template_argument_list_end(PP)  \
--- 32,37 ----
*************** static void dump_expr (tree, int);
*** 72,83 ****
  static void dump_unary_op (const char *, tree, int);
  static void dump_binary_op (const char *, tree, int);
  static void dump_aggr_type (tree, int);
! static enum pad dump_type_prefix (tree, int);
  static void dump_type_suffix (tree, int);
  static void dump_function_name (tree, int);
  static void dump_expr_list (tree, int);
  static void dump_global_iord (tree);
- static enum pad dump_qualifiers (tree, enum pad);
  static void dump_parameters (tree, int);
  static void dump_exception_spec (tree, int);
  static const char *class_key_or_enum (tree);
--- 70,80 ----
  static void dump_unary_op (const char *, tree, int);
  static void dump_binary_op (const char *, tree, int);
  static void dump_aggr_type (tree, int);
! static void dump_type_prefix (tree, int);
  static void dump_type_suffix (tree, int);
  static void dump_function_name (tree, int);
  static void dump_expr_list (tree, int);
  static void dump_global_iord (tree);
  static void dump_parameters (tree, int);
  static void dump_exception_spec (tree, int);
  static const char *class_key_or_enum (tree);
*************** dump_scope (tree scope, int flags)
*** 143,180 ****
      }
  }
  
- /* Dump type qualifiers, providing padding as requested. Return an
-    indication of whether we dumped something.  */
- 
- static enum pad
- dump_qualifiers (tree t, enum pad p)
- {
-   static const int masks[] =
-     {TYPE_QUAL_CONST, TYPE_QUAL_VOLATILE, TYPE_QUAL_RESTRICT};
-   static const char *const names[] =
-     {"const", "volatile", "__restrict"};
-   int ix;
-   int quals = TYPE_QUALS (t);
-   int do_after = p == after;
- 
-   if (quals)
-     {
-       for (ix = 0; ix != 3; ix++)
-         if (masks[ix] & quals)
-           {
-             if (p == before)
-               pp_space (cxx_pp);
-             p = before;
-             pp_identifier (cxx_pp, names[ix]);
-           }
-       if (do_after)
-         pp_space (cxx_pp);
-     }
-   else
-     p = none;
-   return p;
- }
- 
  /* Dump the template ARGument under control of FLAGS.  */
  
  static void
--- 140,145 ----
*************** dump_type (tree t, int flags)
*** 367,373 ****
        break;
  
      case TEMPLATE_TYPE_PARM:
!       dump_qualifiers (t, after);
        if (TYPE_IDENTIFIER (t))
  	pp_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
        else
--- 332,338 ----
        break;
  
      case TEMPLATE_TYPE_PARM:
!       pp_cxx_cv_qualifier_seq (cxx_pp, t);
        if (TYPE_IDENTIFIER (t))
  	pp_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
        else
*************** dump_type (tree t, int flags)
*** 390,396 ****
        break;
      }
      case TYPENAME_TYPE:
!       dump_qualifiers (t, after);
        pp_string (cxx_pp, "typename ");
        dump_typename (t, flags);
        break;
--- 355,361 ----
        break;
      }
      case TYPENAME_TYPE:
!       pp_cxx_cv_qualifier_seq (cxx_pp, t);
        pp_string (cxx_pp, "typename ");
        dump_typename (t, flags);
        break;
*************** dump_aggr_type (tree t, int flags)
*** 460,466 ****
    int typdef = 0;
    int tmplate = 0;
  
!   dump_qualifiers (t, after);
  
    if (flags & TFF_CLASS_KEY_OR_ENUM)
      {
--- 425,431 ----
    int typdef = 0;
    int tmplate = 0;
  
!   pp_cxx_cv_qualifier_seq (cxx_pp, t);
  
    if (flags & TFF_CLASS_KEY_OR_ENUM)
      {
*************** dump_aggr_type (tree t, int flags)
*** 520,534 ****
     deal with prefix and suffix.
  
     Arrays must also do this for DECL nodes, like int a[], and for things like
!    int *[]&.
! 
!    Return indicates how you should pad an object name after this. I.e. you
!    want to pad non-*, non-& cores, but not pad * or & types.  */
  
! static enum pad
  dump_type_prefix (tree t, int flags)
  {
!   enum pad padding = before;
  
    if (TYPE_PTRMEMFUNC_P (t))
      {
--- 485,496 ----
     deal with prefix and suffix.
  
     Arrays must also do this for DECL nodes, like int a[], and for things like
!    int *[]&.  */
  
! static void 
  dump_type_prefix (tree t, int flags)
  {
!   pp_base (cxx_pp)->padding = pp_none;
  
    if (TYPE_PTRMEMFUNC_P (t))
      {
*************** dump_type_prefix (tree t, int flags)
*** 543,595 ****
        {
  	tree sub = TREE_TYPE (t);
  
! 	padding = dump_type_prefix (sub, flags);
  	if (TREE_CODE (sub) == ARRAY_TYPE)
  	  {
  	    pp_space (cxx_pp);
  	    pp_left_paren (cxx_pp);
  	  }
  	pp_character (cxx_pp, "&*"[TREE_CODE (t) == POINTER_TYPE]);
! 	padding = dump_qualifiers (t, before);
        }
        break;
  
      case OFFSET_TYPE:
      offset_type:
!       padding = dump_type_prefix (TREE_TYPE (t), flags);
        if (TREE_CODE (t) == OFFSET_TYPE)	/* pmfs deal with this in d_t_p */
  	{
! 	  if (padding != none)
! 	    pp_space (cxx_pp);
  	  dump_type (TYPE_OFFSET_BASETYPE (t), flags);
  	  pp_colon_colon (cxx_pp);
  	}
        pp_star (cxx_pp);
!       padding = dump_qualifiers (t, none);
        break;
  
        /* Can only be reached through function pointer -- this would not be
           correct if FUNCTION_DECLs used it.  */
      case FUNCTION_TYPE:
!       padding = dump_type_prefix (TREE_TYPE (t), flags);
!       if (padding != none)
!         pp_space (cxx_pp);
        pp_left_paren (cxx_pp);
-       padding = none;
        break;
  
      case METHOD_TYPE:
!       padding = dump_type_prefix (TREE_TYPE (t), flags);
!       if (padding != none)
!         pp_space (cxx_pp);
        pp_left_paren (cxx_pp);
-       padding = none;
        dump_aggr_type (TYPE_METHOD_BASETYPE (t), flags);
        pp_colon_colon (cxx_pp);
        break;
  
      case ARRAY_TYPE:
!       padding = dump_type_prefix (TREE_TYPE (t), flags);
        break;
  
      case ENUMERAL_TYPE:
--- 505,553 ----
        {
  	tree sub = TREE_TYPE (t);
  
! 	dump_type_prefix (sub, flags);
  	if (TREE_CODE (sub) == ARRAY_TYPE)
  	  {
  	    pp_space (cxx_pp);
  	    pp_left_paren (cxx_pp);
  	  }
  	pp_character (cxx_pp, "&*"[TREE_CODE (t) == POINTER_TYPE]);
!         pp_base (cxx_pp)->padding = pp_before;
!         pp_cxx_cv_qualifier_seq (cxx_pp, t);
        }
        break;
  
      case OFFSET_TYPE:
      offset_type:
!       dump_type_prefix (TREE_TYPE (t), flags);
        if (TREE_CODE (t) == OFFSET_TYPE)	/* pmfs deal with this in d_t_p */
  	{
!           pp_maybe_space (cxx_pp);
  	  dump_type (TYPE_OFFSET_BASETYPE (t), flags);
  	  pp_colon_colon (cxx_pp);
  	}
        pp_star (cxx_pp);
!       pp_cxx_cv_qualifier_seq (cxx_pp, t);
        break;
  
        /* Can only be reached through function pointer -- this would not be
           correct if FUNCTION_DECLs used it.  */
      case FUNCTION_TYPE:
!       dump_type_prefix (TREE_TYPE (t), flags);
!       pp_maybe_space (cxx_pp);
        pp_left_paren (cxx_pp);
        break;
  
      case METHOD_TYPE:
!       dump_type_prefix (TREE_TYPE (t), flags);
!       pp_maybe_space (cxx_pp);
        pp_left_paren (cxx_pp);
        dump_aggr_type (TYPE_METHOD_BASETYPE (t), flags);
        pp_colon_colon (cxx_pp);
        break;
  
      case ARRAY_TYPE:
!       dump_type_prefix (TREE_TYPE (t), flags);
        break;
  
      case ENUMERAL_TYPE:
*************** dump_type_prefix (tree t, int flags)
*** 612,618 ****
      case VECTOR_TYPE:
      case TYPEOF_TYPE:
        dump_type (t, flags);
!       padding = before;
        break;
  
      default:
--- 570,576 ----
      case VECTOR_TYPE:
      case TYPEOF_TYPE:
        dump_type (t, flags);
!       pp_base (cxx_pp)->padding = pp_before;
        break;
  
      default:
*************** dump_type_prefix (tree t, int flags)
*** 622,628 ****
        pp_identifier (cxx_pp, "<typeprefixerror>");
        break;
      }
-   return padding;
  }
  
  /* Dump the suffix of type T, under control of FLAGS.  This is the part
--- 580,585 ----
*************** dump_type_suffix (tree t, int flags)
*** 659,666 ****
  	dump_parameters (arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
  
  	if (TREE_CODE (t) == METHOD_TYPE)
! 	  dump_qualifiers
! 	    (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))), before);
  	dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), flags);
  	dump_type_suffix (TREE_TYPE (t), flags);
  	break;
--- 616,623 ----
  	dump_parameters (arg, flags & ~TFF_FUNCTION_DEFAULT_ARGUMENTS);
  
  	if (TREE_CODE (t) == METHOD_TYPE)
!           pp_cxx_cv_qualifier_seq
!             (cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (t))));
  	dump_exception_spec (TYPE_RAISES_EXCEPTIONS (t), flags);
  	dump_type_suffix (TREE_TYPE (t), flags);
  	break;
*************** dump_simple_decl (tree t, tree type, int
*** 736,743 ****
  {
    if (flags & TFF_DECL_SPECIFIERS)
      {
!       if (dump_type_prefix (type, flags) != none)
!         pp_space (cxx_pp);
      }
    if (!DECL_INITIAL (t) || TREE_CODE (DECL_INITIAL (t)) != TEMPLATE_PARM_INDEX)
      dump_scope (CP_DECL_CONTEXT (t), flags);
--- 693,700 ----
  {
    if (flags & TFF_DECL_SPECIFIERS)
      {
!       dump_type_prefix (type, flags);
!       pp_maybe_space (cxx_pp);
      }
    if (!DECL_INITIAL (t) || TREE_CODE (DECL_INITIAL (t)) != TEMPLATE_PARM_INDEX)
      dump_scope (CP_DECL_CONTEXT (t), flags);
*************** dump_function_decl (tree t, int flags)
*** 1095,1102 ****
        dump_parameters (parmtypes, flags);
  
        if (TREE_CODE (fntype) == METHOD_TYPE)
! 	dump_qualifiers (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))),
! 			 before);
  
        if (flags & TFF_EXCEPTION_SPECIFICATION)
  	dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags);
--- 1052,1059 ----
        dump_parameters (parmtypes, flags);
  
        if (TREE_CODE (fntype) == METHOD_TYPE)
!         pp_cxx_cv_qualifier_seq
!           (cxx_pp, TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))));
  
        if (flags & TFF_EXCEPTION_SPECIFICATION)
  	dump_exception_spec (TYPE_RAISES_EXCEPTIONS (fntype), flags);
*************** static const char *
*** 2116,2122 ****
  cv_to_string (tree p, int v)
  {
    pp_clear_output_area (cxx_pp);
!   dump_qualifiers (p, v ? before : none);
    return pp_formatted_text (cxx_pp);
  }
  
--- 2073,2080 ----
  cv_to_string (tree p, int v)
  {
    pp_clear_output_area (cxx_pp);
!   pp_base (cxx_pp)->padding = v ? pp_before : pp_none;
!   pp_cxx_cv_qualifier_seq (cxx_pp, p);
    return pp_formatted_text (cxx_pp);
  }
  
Index: testsuite/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/ChangeLog,v
retrieving revision 1.3624
diff -p -r1.3624 ChangeLog
*** testsuite/ChangeLog	21 Mar 2004 17:48:38 -0000	1.3624
--- testsuite/ChangeLog	21 Mar 2004 23:52:43 -0000
***************
*** 1,3 ****
--- 1,7 ----
+ 2004-03-21  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+ 
+ 	* g++.dg/template/qualttp20.C: Adjust dg- regexp.
+ 
  2004-03-21  Mark Mitchell  <mark@codesourcery.com>
  
  	PR c++/14616
Index: testsuite/g++.dg/template/qualttp20.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/template/qualttp20.C,v
retrieving revision 1.4
diff -p -r1.4 qualttp20.C
*** testsuite/g++.dg/template/qualttp20.C	16 Sep 2002 19:09:05 -0000	1.4
--- testsuite/g++.dg/template/qualttp20.C	21 Mar 2004 23:52:46 -0000
*************** struct AS
*** 15,22 ****
  
  template <typename T> struct B1 : T
  {
!   typedef typename T::L __restrict__ r;// { dg-error "`__restrict' qualifiers cannot" "" }
!   typedef typename T::myT __restrict__ p;// { dg-warning "ignoring `__restrict'" "" { xfail *-*-* } }
  
    // The following are DR 295 dependent
    typedef typename T::myT volatile *myvolatile; // { dg-error "qualifiers" ""  }
--- 15,22 ----
  
  template <typename T> struct B1 : T
  {
!   typedef typename T::L __restrict__ r;// { dg-error "`__restrict__' qualifiers cannot" "" }
!   typedef typename T::myT __restrict__ p;// { dg-warning "ignoring `__restrict__'" "" { xfail *-*-* } }
  
    // The following are DR 295 dependent
    typedef typename T::myT volatile *myvolatile; // { dg-error "qualifiers" ""  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]