static int
resolve_symbol_reference PARAMS ((struct objfile *, struct symbol *, char *));
+void stabsread_clear_cache PARAMS ((void));
+
static const char vptr_name[] =
{'_', 'v', 'p', 't', 'r', CPLUS_MARKER, '\0'};
static const char vb_name[] =
os9k_init_type_vector (tv)
struct type **tv;
{
- int i;
+ unsigned int i;
for (i = 0; i < sizeof (os9k_type_vector) / sizeof (struct type **); i++)
tv[i] = (os9k_type_vector[i] == 0 ? 0 : *(os9k_type_vector[i]));
}
}
\f
-#if !defined (REG_STRUCT_HAS_ADDR)
-#define REG_STRUCT_HAS_ADDR(gcc_p,type) 0
-#endif
-
#define VISIBILITY_PRIVATE '0' /* Stabs character for private field */
#define VISIBILITY_PROTECTED '1' /* Stabs character for protected fld */
#define VISIBILITY_PUBLIC '2' /* Stabs character for public field */
/* Number of chunks malloced. */
static int ref_chunk = 0;
+/* This file maintains a cache of stabs aliases found in the symbol
+ table. If the symbol table changes, this cache must be cleared
+ or we are left holding onto data in invalid obstacks. */
+void
+stabsread_clear_cache ()
+{
+ ref_count = 0;
+ ref_chunk = 0;
+}
+
/* Create array of pointers mapping refids to symbols and stab strings.
Add pointers to reference definition symbols and/or their values as we
find them, using their reference numbers as our index.
switch (type & N_TYPE)
{
case N_TEXT:
- SYMBOL_SECTION (sym) = SECT_OFF_TEXT;
+ SYMBOL_SECTION (sym) = SECT_OFF_TEXT (objfile);
break;
case N_DATA:
- SYMBOL_SECTION (sym) = SECT_OFF_DATA;
+ SYMBOL_SECTION (sym) = SECT_OFF_DATA (objfile);
break;
case N_BSS:
- SYMBOL_SECTION (sym) = SECT_OFF_BSS;
+ SYMBOL_SECTION (sym) = SECT_OFF_BSS (objfile);
break;
}
if (local_symbols
&& local_symbols->nsyms > 0
#ifndef USE_REGISTER_NOT_ARG
+ && REG_STRUCT_HAS_ADDR_P ()
&& REG_STRUCT_HAS_ADDR (processing_gcc_compilation,
SYMBOL_TYPE (sym))
&& (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
/* When passing structures to a function, some systems sometimes pass
the address in a register, not the structure itself. */
- if (REG_STRUCT_HAS_ADDR (processing_gcc_compilation, SYMBOL_TYPE (sym))
- && (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG))
+ if (REG_STRUCT_HAS_ADDR_P ()
+ && REG_STRUCT_HAS_ADDR (processing_gcc_compilation, SYMBOL_TYPE (sym))
+ && (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG))
{
struct type *symbol_type = check_typedef (SYMBOL_TYPE (sym));
{
static struct complaint msg =
{
- "Unknown visibility `%c' for baseclass", 0, 0};
+ "Unknown visibility `%c' for baseclass", 0, 0
+ };
complain (&msg, new->visibility);
new->visibility = VISIBILITY_PUBLIC;
}
/* We used to do this only for subrange of self or subrange of int. */
else if (n2 == 0)
{
+ /* -1 is used for the upper bound of (4 byte) "unsigned int" and
+ "unsigned long", and we already checked for that,
+ so don't need to test for it here. */
+
if (n3 < 0)
/* n3 actually gives the size. */
return init_type (TYPE_CODE_INT, -n3, TYPE_FLAG_UNSIGNED,
NULL, objfile);
- if (n3 == 0xff)
- return init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, NULL, objfile);
- if (n3 == 0xffff)
- return init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, NULL, objfile);
- /* -1 is used for the upper bound of (4 byte) "unsigned int" and
- "unsigned long", and we already checked for that,
- so don't need to test for it here. */
+ /* Is n3 == 2**(8n)-1 for some integer n? Then it's an
+ unsigned n-byte integer. But do require n to be a power of
+ two; we don't want 3- and 5-byte integers flying around. */
+ {
+ int bytes;
+ unsigned long bits;
+
+ bits = n3;
+ for (bytes = 0; (bits & 0xff) == 0xff; bytes++)
+ bits >>= 8;
+ if (bits == 0
+ && ((bytes - 1) & bytes) == 0) /* "bytes is a power of two" */
+ return init_type (TYPE_CODE_INT, bytes, TYPE_FLAG_UNSIGNED, NULL,
+ objfile);
+ }
}
/* I think this is for Convex "long long". Since I don't know whether
Convex sets self_subrange, I also accept that particular size regardless