* stabsread.c: Include <ctype.h>.
[deliverable/binutils-gdb.git] / gdb / stabsread.c
index 531b63b904f2d90e77b0cbf2467f3a2d9a2c7d85..c09525ac64fdea0cf14c963441dc8ba8a1164500 100644 (file)
@@ -36,6 +36,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "complaints.h"
 #include "demangle.h"
 
+#include <ctype.h>
+
 /* Ask stabsread.h to define the vars it normally declares `extern'.  */
 #define        EXTERN  /**/
 #include "stabsread.h"         /* Our own declarations */
@@ -1255,22 +1257,31 @@ read_type (pp, objfile)
        return dbx_alloc_type (typenums, objfile);
 
       /* Type is being defined here.  */
-#if 0 /* Callers aren't prepared for a NULL result!  FIXME -- metin!  */
-      {
-       struct type *tt;
-
-       /* if such a type already exists, this is an unnecessary duplication
-          of the stab string, which is common in (RS/6000) xlc generated
-          objects.  In that case, simply return NULL and let the caller take
-          care of it. */
-
-       tt = *dbx_lookup_type (typenums);
-       if (tt && tt->length && tt->code)
-         return NULL;
-      }
-#endif
+      /* Skip the '='.  */
+      ++(*pp);
 
-      *pp += 2;
+      while (**pp == '@')
+       {
+         char *p = *pp + 1;
+         /* It might be a type attribute or a member type.  */
+         if (isdigit (*p) || *p ==  '(' || *p == '-')
+           /* Member type.  */
+           break;
+         else
+           {
+             /* Type attributes; skip to the semicolon.  */
+             while (*p != ';' && *p != '\0')
+               ++p;
+             *pp = p;
+             if (*p == '\0')
+               return error_type (pp);
+             else
+               /* Skip the semicolon.  */
+               ++*pp;
+           }
+       }
+      /* Skip the type descriptor, we get it below with (*pp)[-1].  */
+      ++(*pp);
     }
   else
     {
@@ -2125,14 +2136,13 @@ read_cpp_abbrev (fip, pp, type, objfile)
       fip->list->field.bitsize = 0;
       fip->list->visibility = VISIBILITY_PRIVATE;
     }
-  else if (*p == '_')
-    {
-      /* GNU C++ anonymous type.  */
-      complain (&stabs_general_complaint, "g++ anonymous type $_ not handled");
-    }
   else
     {
       complain (&invalid_cpp_abbrev_complaint, *pp);
+      /* We have no idea what syntax an unrecognized abbrev would have, so
+        better return 0.  If we returned 1, we would need to at least advance
+        *pp to avoid an infinite loop.  */
+      return 0;
     }
   return 1;
 }
@@ -2332,7 +2342,11 @@ read_struct_fields (fip, pp, type, objfile)
 
       /* Get the field name.  */
       p = *pp;
-      if (*p == CPLUS_MARKER)
+      /* If is starts with CPLUS_MARKER it is a special abbreviation, unless
+        the CPLUS_MARKER is followed by an underscore, in which case it is
+        just the name of an anonymous type, which we should handle like any
+        other type name.  */
+      if (*p == CPLUS_MARKER && p[1] != '_')
        {
          if (!read_cpp_abbrev (fip, pp, type, objfile))
            return 0;
@@ -3122,7 +3136,7 @@ read_huge_number (pp, end, bits)
     }
 
   upper_limit = LONG_MAX / radix;
-  while ((c = *p++) >= '0' && c <= ('0' + radix))
+  while ((c = *p++) >= '0' && c < ('0' + radix))
     {
       if (n <= upper_limit)
        {
This page took 0.024758 seconds and 4 git commands to generate.