aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDavid Henkel-Wallace <gumby@cygnus>1991-11-15 23:23:11 +0000
committerDavid Henkel-Wallace <gumby@cygnus>1991-11-15 23:23:11 +0000
commit58050209857ca9ef632254dd05cae407cf7f7a0d (patch)
tree1ae0f4520a548b57e5b0f8f15ddfa870a14e2045 /gdb
parent4c53d9ca84b57631a94d409387a3eb178f01fe75 (diff)
downloadgdb-58050209857ca9ef632254dd05cae407cf7f7a0d.zip
gdb-58050209857ca9ef632254dd05cae407cf7f7a0d.tar.gz
gdb-58050209857ca9ef632254dd05cae407cf7f7a0d.tar.bz2
ansi name abuse changes
Diffstat (limited to 'gdb')
-rw-r--r--gdb/dwarfread.c30
-rw-r--r--gdb/symtab.c59
2 files changed, 63 insertions, 26 deletions
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index bfdddc5..2d72310 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -63,9 +63,12 @@ FIXME: See other FIXME's and "ifdef 0" scattered throughout the code for
other things to work on, if you get bored. :-)
*/
-
#include <stdio.h>
+#ifdef __STDC__
+#include <stdarg.h>
+#else
#include <varargs.h>
+#endif
#include <fcntl.h>
#include "defs.h"
@@ -300,7 +303,8 @@ static int numutypes; /* Max number of user type pointers */
more intuitive, since it can be used for both static and external
definitions. */
-static void dwarfwarn (); /* EXFUN breaks with <varargs.h> (FIXME)*/
+static void
+EXFUN (dwarfwarn, (char *fmt DOTS));
static void
EXFUN (scan_partial_symbols, (char *thisdie AND char *enddie));
@@ -590,6 +594,26 @@ NOTES
information for the DIE where the problem was noticed.
*/
+#ifdef __STDC__
+static void
+DEFUN(dwarfwarn, (fmt), char *fmt DOTS)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ warning_setup ();
+ fprintf (stderr, "DWARF warning (ref 0x%x): ", curdie -> dieref);
+ if (curdie -> at_name)
+ {
+ fprintf (stderr, "'%s': ", curdie -> at_name);
+ }
+ vfprintf (stderr, fmt, ap);
+ fprintf (stderr, "\n");
+ fflush (stderr);
+ va_end (ap);
+}
+#else
+
static void
dwarfwarn (va_alist)
va_dcl
@@ -610,7 +634,7 @@ dwarfwarn (va_alist)
fflush (stderr);
va_end (ap);
}
-
+#endif
/*
LOCAL FUNCTION
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 9d4db8f..27d4952 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -165,25 +165,25 @@ type_name_no_tag (type)
register struct type *type;
{
register char *name = TYPE_NAME (type);
- char *strchr ();
+
if (name == 0)
return 0;
-#if 0
switch (TYPE_CODE (type))
{
case TYPE_CODE_STRUCT:
- return name + 7;
+ if(!strncmp(name,"struct ",7))
+ return name + 7;
+ else return name;
case TYPE_CODE_UNION:
+ if(!strncmp(name,"union ",6))
return name + 6;
+ else return name;
case TYPE_CODE_ENUM:
+ if(!strncmp(name,"enum ",5))
return name + 5;
+ else return name;
}
-#endif
-
- name = strchr (name, ' ');
- if (name)
- return name + 1;
return TYPE_NAME (type);
}
@@ -378,6 +378,31 @@ lookup_enum (name, block)
return SYMBOL_TYPE (sym);
}
+/* Lookup a template type named "template NAME<TYPE>",
+ visible in lexical block BLOCK. */
+
+struct type *
+lookup_template_type (name, type, block)
+ char *name;
+ struct type *type;
+ struct block *block;
+{
+ struct symbol *sym ;
+ char *nam = (char*) alloca(strlen(name) + strlen(type->name) + 4);
+ strcpy(nam, name);
+ strcat(nam, "<");
+ strcat(nam, type->name);
+ strcat(nam, " >"); /* extra space still introduced in gcc? */
+
+ sym = lookup_symbol (nam, block, VAR_NAMESPACE, 0, (struct symtab **)NULL);
+
+ if (sym == 0)
+ error ("No template type named %s.", name);
+ if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT)
+ error ("This context has class, union or enum %s, not a struct.", name);
+ return SYMBOL_TYPE (sym);
+}
+
/* Given a type TYPE, lookup the type of the component of type named
NAME.
If NOERR is nonzero, return zero if NAME is not suitably defined. */
@@ -2072,21 +2097,9 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
/* Extract the file name. */
p1 = p;
while (p != *argptr && p[-1] == ' ') --p;
- copy = (char *) alloca (p - *argptr + 1 + (q1 - q));
- if (q1 - q)
- {
- copy[0] = 'o';
- copy[1] = 'p';
- copy[2] = CPLUS_MARKER;
- bcopy (q, copy + 3, q1-q);
- copy[3 + (q1-q)] = 0;
- p = q1;
- }
- else
- {
- bcopy (*argptr, copy, p - *argptr);
- copy[p - *argptr] = 0;
- }
+ copy = (char *) alloca (p - *argptr + 1);
+ bcopy (*argptr, copy, p - *argptr);
+ copy[p - *argptr] = 0;
/* Find that file's data. */
s = lookup_symtab (copy);