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]

Re: Patch for various warnings in gcc



ghazi@caip.rutgers.edu said:
>  > From: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
>  > 
>  > OK here is the warning patch.
>  > [....]
>  > The first FAIL is normal, I cannot see the second in other results.
> 
>  > As anyone seen this ??? I cannot imagine that the patch is
> wrong.... 
>  > but as usual ten verifications are better than one.
>  > 
>  > In case this is OK, here is the full patch for both decl2.c and 
>  > parse.y:
>  > 
>  > ChangeLog for gcc/cp:
>  > 
>  > 2002-08-08 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.f
> r>
>  > 
>  >     * decl2.c (build_offset_ref_call_from_tree) Fix warning.
>  >     * parse.y (parse_finish_call_expr) Likewise.

> Theo - Since you indicated yours added a regression, I went ahead and
> installed my version.  If you manage to get a clean test I encourage
> you to pursue your approach. 

Indeed, I made another test in a clean tree. Everything is OK. My 
laptop tree had some other changes of mine (in the works) that
created this regression (I have to check exactly why, I changed 
slightly an error message and this is maybe it). 
Nevertheless the changes is safe. Here is the updated patch against 
mainline. Bootstrapped and reg-tested on i686-pc-linux-gnu.

For the record here is the relevant excerpt for the regression test:

Running target unix
FAIL: g++.dg/warn/Wunused-2.C  (test for warnings, line 5)

                === g++ Summary ===

# of expected passes            7491
# of unexpected failures        1
# of expected failures          86
# of untested testcases         9
# of unsupported tests          3
/auto/atlantis/u/atlantis/1/egcs/gcc-linux/gcc/testsuite/../g++ version 3.3 20020812 (
experimental)


ChangeLog for gcc/cp:

2002-08-08 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>

    * decl2.c (build_offset_ref_call_from_tree) Fix warning.
    * parse.y (parse_finish_call_expr) Likewise.

Index: decl2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl2.c,v
retrieving revision 1.559
diff -c -3 -p -r1.559 decl2.c
*** decl2.c	11 Aug 2002 18:30:24 -0000	1.559
--- decl2.c	12 Aug 2002 16:41:27 -0000
*************** build_offset_ref_call_from_tree (tree fn
*** 3477,3483 ****
  tree
  build_call_from_tree (tree fn, tree args, bool disallow_virtual)
  {
-   tree template_args;
    tree template_id;
    tree f;
    
--- 3477,3482 ----
*************** build_call_from_tree (tree fn, tree args
*** 3493,3506 ****
    if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
      {
        template_id = fn;
-       template_args = TREE_OPERAND (fn, 1);
        fn = TREE_OPERAND (fn, 0);
      }
    else
!     {
!       template_id = NULL_TREE;
!       template_args = NULL_TREE;
!     }
  
    f = (TREE_CODE (fn) == OVERLOAD) ? get_first_fn (fn) : fn;
    /* Make sure we have a baselink (rather than simply a
--- 3492,3501 ----
    if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
      {
        template_id = fn;
        fn = TREE_OPERAND (fn, 0);
      }
    else
!     template_id = NULL_TREE;
  
    f = (TREE_CODE (fn) == OVERLOAD) ? get_first_fn (fn) : fn;
    /* Make sure we have a baselink (rather than simply a
*************** build_call_from_tree (tree fn, tree args
*** 3520,3528 ****
--- 3515,3526 ----
    if (template_id)
      {
        if (BASELINK_P (fn))
+         {
+           tree template_args = TREE_OPERAND (template_id, 1);
  	  BASELINK_FUNCTIONS (fn) = build_nt (TEMPLATE_ID_EXPR, 
  					      BASELINK_FUNCTIONS (fn),
  					      template_args);
+         }
        else
  	fn = template_id;
      }
Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/parse.y,v
retrieving revision 1.277
diff -c -3 -p -r1.277 parse.y
*** parse.y	11 Aug 2002 18:30:24 -0000	1.277
--- parse.y	12 Aug 2002 16:41:27 -0000
*************** static tree
*** 4110,4116 ****
  parse_finish_call_expr (tree fn, tree args, int koenig)
  {
    bool disallow_virtual;
-   tree template_args;
    tree template_id;
    tree f;
  
--- 4110,4115 ----
*************** parse_finish_call_expr (tree fn, tree ar
*** 4136,4149 ****
  	      if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
  		{
  		  template_id = name;
- 		  template_args = TREE_OPERAND (name, 1);
  		  name = TREE_OPERAND (name, 0);
  		}
  	      else 
! 	        {
! 		  template_id = NULL_TREE;
! 		  template_args = NULL_TREE;
! 		}
  
  	      if (BASELINK_P (name))
  		fn = name;
--- 4135,4144 ----
  	      if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
  		{
  		  template_id = name;
  		  name = TREE_OPERAND (name, 0);
  		}
  	      else 
! 		template_id = NULL_TREE;
  
  	      if (BASELINK_P (name))
  		fn = name;
*************** parse_finish_call_expr (tree fn, tree ar
*** 4154,4163 ****
  		  fn = lookup_member (scope, name, /*protect=*/1, 
  				      /*prefer_type=*/0);
  		  if (BASELINK_P (fn) && template_id)
! 		    BASELINK_FUNCTIONS (fn) 
! 		      = build_nt (TEMPLATE_ID_EXPR,
! 				  BASELINK_FUNCTIONS (fn),
! 				  template_args);
  		}
  	      if (current_class_type)
  		fn = (adjust_result_of_qualified_name_lookup 
--- 4149,4161 ----
  		  fn = lookup_member (scope, name, /*protect=*/1, 
  				      /*prefer_type=*/0);
  		  if (BASELINK_P (fn) && template_id)
!                     {
!                       tree template_args = TREE_OPERAND (template_id, 1);
! 		      BASELINK_FUNCTIONS (fn) 
! 		        = build_nt (TEMPLATE_ID_EXPR,
! 				    BASELINK_FUNCTIONS (fn),
! 				    template_args);
!                     }
  		}
  	      if (current_class_type)
  		fn = (adjust_result_of_qualified_name_lookup

--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
 --------------------------------------------------------------------



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