[Prev][Next][Index]

Re: Another bug?



Michael,
here is a fix for "redeclaration error" that one gets when parsing the code:

extern int b[12];
extern int *c[12];


int a;
int b[12];
int *c[12];


In parser_lib.c around line 3482 (inside the function
int checkExternFirstPart(symb) )

change 

err_symb("(04.1) redeclaration of symbol", SYMB_IDENT(symb));

to

Message("checkExternFirstPart,  possible redeclaration of a symbol", yylineno);


Because your version of checkExternFirstPart might differ from our current version below is complete code for this  
function. --Beata

int checkExternFirstPart(symb)
PTR_SYMB symb;
{ 

  PTR_TYPE type2;
  if (!symb) {
    err("NULL symbol in checkExternFirstPart"); /* Beckman */
    return 0; }



  /* was is_same_type so make some change 

   look at initial function for changes */
  type2 = (PTR_TYPE) SYMB_UD_CHAIN(symb);
  if (!SYMB_TYPE(symb) && type2) 

    {
      switch (TYPE_CODE(type2)) 

	{
	case T_POINTER  :
	case T_REFERENCE:
	case T_FUNCTION :    

	case T_ARRAY    :
	 err_symb("(03) redeclaration symbol",SYMB_IDENT(symb)); 

	 return 0;
	default:
	  return(1);
	}
    }
  if (!isStrictlySameType(SYMB_TYPE(symb),type2)) 

    { /* function to check */
      if (isPointerType(TYPE_CODE(type2)) && isPointerType(TYPE_CODE(SYMB_TYPE(symb))))
	return 1;
      else if((TYPE_CODE(type2) == T_ARRAY) && 

              (TYPE_CODE(SYMB_TYPE(symb)) == T_ARRAY)){
		  PTR_TYPE types;
		  types = SYMB_TYPE(symb);
		  if(!TYPE_BASE(types) || !TYPE_BASE(type2) ||
		      (isStrictlySameType(TYPE_BASE(types), TYPE_BASE(type2)))){
		          return 1;
			  }
		  else {
		    /* err_symb("(04.1) redeclaration of symbol", SYMB_IDENT(symb)); */
                    Message("checkExternFirstPart,  possible redeclaration of a symbol", yylineno); /* the change is here */
		    return 0;
		    } 

	      }
      else
	{
	  /* err_symb("(04) redeclaration symbol",SYMB_IDENT(symb));  */    

	  return 0;
	}
    }
  return 1;
}