#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 */
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
{
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;
}
/* 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;
}
upper_limit = LONG_MAX / radix;
- while ((c = *p++) >= '0' && c <= ('0' + radix))
+ while ((c = *p++) >= '0' && c < ('0' + radix))
{
if (n <= upper_limit)
{