[RFA]: Massive C++ fixes and enhancements

Kevin Buettner kevinb@cygnus.com
Thu Aug 10 09:38:00 GMT 2000


Daniel,

My comments on your patch:

1) I notice that you're still getting rid of the do { ...  } while (0)
   in SYMBOL_INIT_DEMANGLED_NAME...   I realize that you don't like this
   construct, but if someone decides to use SYMBOL_INIT_DEMANGLED_NAME
   as part of an if-then-else construct somewhere, you'll save them a
   lot of grief.  (If you really, really don't like this, then just
   make it a function.)

2) Watch your indentation.  E.g, the following hunk from 
   decode_line_1() doesn't look right to me:

--- 2577,2602 ----
      }
    else
      is_quote_enclosed = 0;
+ tryagain:
    for (; *p; p++)
      {
	if (p[0] == '<')
	{
	  char *temp_end = find_template_name_end (p);
! 	  if (!temp_end && !triedonce)
! 	  {
! 		  triedonce=1;
! 		  is_quote_enclosed=1;
! 		  p=*argptr;
! 		  if (has_comma)
! 			  *ii=',';
! 		  s=NULL;
! 		  goto tryagain;
! 	   }
! 	  else if (!temp_end && triedonce)
! 	  {
	    error ("malformed template specification in command");
+ 	  }
	  p = temp_end;
	}
	/* Check for the end of the first half of the linespec.  End of line,


Here's how (a portion of it) ought to look:

! 	  if (!temp_end && !triedonce)
! 	    {
! 	      triedonce=1;
! 	      is_quote_enclosed=1;
! 	      p=*argptr;
! 	      if (has_comma)
! 	        *ii=',';
! 	      s=NULL;
! 	      goto tryagain;
! 	    }
! 	  else if (!temp_end && triedonce)
! 	    {
	      error ("malformed template specification in command");
+ 	    }

Also, note that GNU coding standard doesn't require the braces around
the call to error().  I.e, you could've left that part of the original
code alone.

3) You might want to get into the habit of having separate source
   and build trees.


More information about the Gdb-patches mailing list