Re: insight/352: 2 comparisons in cp-name-parser.y create errors at line 1980 and 1985

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: insight/352: 2 comparisons in cp-name-parser.y create errors at line 1980 and 1985

Johannes Schlatow
The following reply was made to PR insight/352; it has been noted by GNATS.

From: Johannes Schlatow <[hidden email]>
To: [hidden email]
Cc:  
Subject: Re: insight/352: 2 comparisons in cp-name-parser.y create errors
 at line 1980 and 1985
Date: Sat, 06 Nov 2010 21:30:57 +0100

 I just encountered the same problem. I think the gcc 4.5 is somewhat more restrictive when it comes to the comparison of enums. Thus I patched the corresponding lines:
 
 diff -rup insight-6.8/gdb//ada-lang.c insight-6.8_patch/gdb//ada-lang.c
 --- insight-6.8/gdb//ada-lang.c 2008-02-07 23:27:53.000000000 +0100
 +++ insight-6.8_patch/gdb//ada-lang.c 2010-11-06 20:38:22.000000000 +0100
 @@ -7683,7 +7683,7 @@ static const char *attribute_names[] = {
  const char *
  ada_attribute_name (enum exp_opcode n)
  {
 -  if (n >= OP_ATR_FIRST && n <= (int) OP_ATR_VAL)
 +  if (n >= (int) OP_ATR_FIRST && n <= (int) OP_ATR_VAL)
      return attribute_names[n - OP_ATR_FIRST + 1];
    else
      return attribute_names[0];
 @@ -8183,7 +8183,7 @@ assign_component (struct value *containe
        elt = ada_to_fixed_value (unwrap_value (elt));
      }
 
 -  if (exp->elts[*pos].opcode == OP_AGGREGATE)
 +  if (exp->elts[*pos].opcode == (int)OP_AGGREGATE)
      assign_aggregate (container, elt, exp, pos, EVAL_NORMAL);
    else
      value_assign_to_component (container, elt,
 @@ -8338,7 +8338,7 @@ aggregate_assign_from_choices (struct va
      {
        LONGEST lower, upper;
        enum exp_opcode op = exp->elts[choice_pos].opcode;
 -      if (op == OP_DISCRETE_RANGE)
 +      if (op == (int)OP_DISCRETE_RANGE)
  {
   choice_pos += 1;
   lower = value_as_long (ada_evaluate_subexp (NULL, exp, pos,
 @@ -8537,7 +8537,7 @@ ada_evaluate_subexp (struct type *expect
 
      case BINOP_ASSIGN:
        arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
 -      if (exp->elts[*pos].opcode == OP_AGGREGATE)
 +      if (exp->elts[*pos].opcode == (int)OP_AGGREGATE)
  {
   arg1 = assign_aggregate (arg1, arg1, exp, pos, noside);
   if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
 @@ -9096,7 +9096,7 @@ ada_evaluate_subexp (struct type *expect
          return value_zero (value_type (arg1), not_lval);
        else
          return value_binop (arg1, arg2,
 -                            op == OP_ATR_MIN ? BINOP_MIN : BINOP_MAX);
 +                            op == (int)OP_ATR_MIN ? BINOP_MIN : BINOP_MAX);
 
      case OP_ATR_MODULUS:
        {
 
 diff -rup insight-6.8/gdb//cp-name-parser.y insight-6.8_patch/gdb//cp-name-parser.y
 --- insight-6.8/gdb//cp-name-parser.y 2008-01-01 23:53:09.000000000 +0100
 +++ insight-6.8_patch/gdb//cp-name-parser.y 2010-11-06 20:38:22.000000000 +0100
 @@ -1977,12 +1977,12 @@ cp_comp_to_string (struct demangle_compo
    char *str, *prefix = NULL, *buf;
    size_t err = 0;
 
 -  if (result->type == GLOBAL_DESTRUCTORS)
 +  if ((int)result->type == GLOBAL_DESTRUCTORS)
      {
        result = d_left (result);
        prefix = "global destructors keyed to ";
      }
 -  else if (result->type == GLOBAL_CONSTRUCTORS)
 +  else if ((int)result->type == GLOBAL_CONSTRUCTORS)
      {
        result = d_left (result);
        prefix = "global constructors keyed to ";
Reply | Threaded
Open this post in threaded view
|

Re: insight/352: 2 comparisons in cp-name-parser.y create errors at line 1980 and 1985

kseitz
Synopsis: 2 comparisons in cp-name-parser.y create errors at line 1980 and 1985

Responsible-Changed-From-To: unassigned->kseitz
Responsible-Changed-By: kseitz
Responsible-Changed-When: Wed Nov 10 19:27:40 2010
Responsible-Changed-Why:
    mine
State-Changed-From-To: open->closed
State-Changed-By: kseitz
State-Changed-When: Wed Nov 10 19:27:40 2010
State-Changed-Why:
    Thanks for the report. Normally, this bug would need to be filed against gdb, since the files in question are gdb's responsibility.
   
    However, since 6.8, cp-name-parser.y has undergone quite a bit of change, and I believe this problem no longer exists.

http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=insight&pr=352