From: Fred Fish Date: Tue, 19 Nov 1991 15:59:55 +0000 (+0000) Subject: Add defines so that parsers produced by SVR4 versions of yacc can coexist X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d018c8a6e1c03b8f220445f9de5af8ba4b3a4199;p=binutils-gdb.git Add defines so that parsers produced by SVR4 versions of yacc can coexist in the same executable without collision (c-exp.y, m2-exp.y). Add forward delaration of function returning pointer to shut up compiler warnings about conversion of int to pointer (symtab.h). --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index eaf6ef03ed1..857b907d9a4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +Tue Nov 19 07:53:55 1991 Fred Fish (fnf at cygnus.com) + + * c-exp.y, m2-exp.y: Add defines for yymaxdepth, yy_yys, and + yy_yyv, so multiple parsers produced by SVR4 versions of yacc + can coexist in the same executable without collision. + + * symtab.h: Add declaration for lookup_template_type() to kill + compiler warnings about conversions from int to pointer. + Mon Nov 18 17:45:18 1991 Fred Fish (fnf at cygnus.com) * procfs.c: Move inclusion of defs.h to before param.h, as in diff --git a/gdb/c-exp.y b/gdb/c-exp.y index bea046322d3..d3703cb5a53 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -41,6 +41,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* These MUST be included in any grammar file!!!! Please choose unique names! */ +#define yymaxdepth c_maxdepth #define yyparse c_parse #define yylex c_lex #define yyerror c_error @@ -60,9 +61,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define yyps c_ps #define yypv c_pv #define yys c_s +#define yy_yys c_yys #define yystate c_state #define yytmp c_tmp #define yyv c_v +#define yy_yyv c_yyv #define yyval c_val #define yylloc c_lloc diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 2c5cf4b9a50..85de5e1e412 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -42,6 +42,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* These MUST be included in any grammar file!!!! Please choose unique names! */ +#define yymaxdepth m2_maxdepth #define yyparse m2_parse #define yylex m2_lex #define yyerror m2_error @@ -61,9 +62,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define yyps m2_ps #define yypv m2_pv #define yys m2_s +#define yy_yys m2_yys #define yystate m2_state #define yytmp m2_tmp #define yyv m2_v +#define yy_yyv m2_yyv #define yyval m2_val #define yylloc m2_lloc diff --git a/gdb/symtab.h b/gdb/symtab.h index c97c22aa911..d9c76968ddf 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -122,10 +122,6 @@ enum type_code someone referenced a type that wasn't definined in a source file via (struct sir_not_appearing_in_this_film *)). */ #define TYPE_FLAG_STUB 8 -/* Set when a class has a constructor defined */ -#define TYPE_FLAG_HAS_CONSTRUCTOR 256 -/* Set when a class has a destructor defined */ -#define TYPE_FLAG_HAS_DESTRUCTOR 512 struct type { @@ -141,6 +137,8 @@ struct type For an array type, describes the type of the elements. For a function or method type, describes the type of the value. For a range type, describes the type of the full range. + For a record type, it's the "main variant" of the record type, + used for computing pointers to members. Unused otherwise. */ struct type *target_type; /* Type that is a pointer to this type. @@ -150,27 +148,13 @@ struct type struct type *pointer_type; /* C++: also need a reference type. */ struct type *reference_type; - struct type **arg_types; - + /* Type that is a function returning this type. Zero if no such function type is known here. The debugger may add the address of such a type if it has to construct one later. */ struct type *function_type; -/* Handling of pointers to members: - TYPE_MAIN_VARIANT is used for pointer and pointer - to member types. Normally it the value of the address of its - containing type. However, for pointers to members, we must be - able to allocate pointer to member types and look them up - from some place of reference. - NEXT_VARIANT is the next element in the chain. - - A long time ago (Jul 88; GDB 2.5) Tiemann said that main_variant - may no longer be necessary and that he might eliminate it. I don't - know whether this is still true (or ever was). */ - struct type *main_variant, *next_variant; - /* Flags about this type. */ short flags; /* Number of fields described for this type */ @@ -206,7 +190,43 @@ struct type char *name; } *fields; - /* C++ */ + /* For types with virtual functions, VPTR_BASETYPE is the base class which + defined the virtual function table pointer. VPTR_FIELDNO is + the field number of that pointer in the structure. + + For types that are pointer to member types, VPTR_BASETYPE + ifs the type that this pointer is a member of. + + Unused otherwise. */ + struct type *vptr_basetype; + + int vptr_fieldno; + + /* Slot to point to additional language-specific fields of this type. */ + union + { + struct type **arg_types; + struct cplus_struct_type *cplus_stuff; + } type_specific; +}; + +/* C++ language-specific information for TYPE_CODE_STRUCT nodes. */ +struct cplus_struct_type +{ + /* Handling of pointers to members: + TYPE_MAIN_VARIANT is used for pointer and pointer + to member types. Normally it is the value of the address of its + containing type. However, for pointers to members, we must be + able to allocate pointer to member types and look them up + from some place of reference. + NEXT_VARIANT is the next element in the chain. + + A long time ago (Jul 88; GDB 2.5) Tiemann said that + MAIN_VARIANT/NEXT_VARIANT may no longer be necessary and that he + might eliminate it. I don't know whether this is still true (or + ever was). */ + struct type *next_variant; + B_TYPE *virtual_field_bits; /* if base class is virtual */ B_TYPE *private_field_bits; B_TYPE *protected_field_bits; @@ -258,18 +278,6 @@ struct type unsigned char via_protected; unsigned char via_public; - - /* For types with virtual functions, VPTR_BASETYPE is the base class which - defined the virtual function table pointer. VPTR_FIELDNO is - the field number of that pointer in the structure. - - For types that are pointer to member types, VPTR_BASETYPE - ifs the type that this pointer is a member of. - - Unused otherwise. */ - struct type *vptr_basetype; - - int vptr_fieldno; }; /* All of the name-scope contours of the program @@ -674,8 +682,8 @@ int current_source_line; #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type #define TYPE_FUNCTION_TYPE(thistype) (thistype)->function_type -#define TYPE_MAIN_VARIANT(thistype) (thistype)->main_variant -#define TYPE_NEXT_VARIANT(thistype) (thistype)->next_variant +#define TYPE_MAIN_VARIANT(thistype) (thistype)->target_type +#define TYPE_NEXT_VARIANT(thistype) (TYPE_CPLUS_SPECIFIC (thistype))->next_variant #define TYPE_LENGTH(thistype) (thistype)->length #define TYPE_FLAGS(thistype) (thistype)->flags #define TYPE_UNSIGNED(thistype) ((thistype)->flags & TYPE_FLAG_UNSIGNED) @@ -686,16 +694,18 @@ int current_source_line; #define TYPE_VPTR_BASETYPE(thistype) (thistype)->vptr_basetype #define TYPE_DOMAIN_TYPE(thistype) (thistype)->vptr_basetype #define TYPE_VPTR_FIELDNO(thistype) (thistype)->vptr_fieldno -#define TYPE_FN_FIELDS(thistype) (thistype)->fn_fields -#define TYPE_NFN_FIELDS(thistype) (thistype)->nfn_fields -#define TYPE_NFN_FIELDS_TOTAL(thistype) (thistype)->nfn_fields_total -#define TYPE_ARG_TYPES(thistype) (thistype)->arg_types +#define TYPE_FN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fields +#define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields +#define TYPE_NFN_FIELDS_TOTAL(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields_total +#define TYPE_ARG_TYPES(thistype) (thistype)->type_specific.arg_types +#define TYPE_CPLUS_SPECIFIC(thistype) (thistype)->type_specific.cplus_stuff #define TYPE_BASECLASS(thistype,index) (thistype)->fields[index].type -#define TYPE_N_BASECLASSES(thistype) (thistype)->n_baseclasses +#define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses #define TYPE_BASECLASS_NAME(thistype,index) (thistype)->fields[index].name #define TYPE_BASECLASS_BITPOS(thistype,index) (thistype)->fields[index].bitpos #define BASETYPE_VIA_PUBLIC(thistype, index) (!TYPE_FIELD_PRIVATE(thistype, index)) -#define BASETYPE_VIA_VIRTUAL(thistype, index) B_TST((thistype)->virtual_field_bits, (index)) +#define BASETYPE_VIA_VIRTUAL(thistype, index) \ + B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)) #define TYPE_FIELD(thistype, n) (thistype)->fields[n] #define TYPE_FIELD_TYPE(thistype, n) (thistype)->fields[n].type @@ -705,44 +715,50 @@ int current_source_line; #define TYPE_FIELD_BITSIZE(thistype, n) (thistype)->fields[n].bitsize #define TYPE_FIELD_PACKED(thistype, n) (thistype)->fields[n].bitsize -#define TYPE_FIELD_PRIVATE_BITS(thistype) (thistype)->private_field_bits -#define TYPE_FIELD_PROTECTED_BITS(thistype) (thistype)->protected_field_bits -#define TYPE_FIELD_VIRTUAL_BITS(thistype) (thistype)->virtual_field_bits -#define SET_TYPE_FIELD_PRIVATE(thistype, n) B_SET ((thistype)->private_field_bits, (n)) -#define SET_TYPE_FIELD_PROTECTED(thistype, n) B_SET ((thistype)->protected_field_bits, (n)) -#define SET_TYPE_FIELD_VIRTUAL(thistype, n) B_SET ((thistype)->virtual_field_bits, (n)) -#define TYPE_FIELD_PRIVATE(thistype, n) B_TST((thistype)->private_field_bits, (n)) -#define TYPE_FIELD_PROTECTED(thistype, n) B_TST((thistype)->protected_field_bits, (n)) -#define TYPE_FIELD_VIRTUAL(thistype, n) B_TST((thistype)->virtual_field_bits, (n)) - -#define TYPE_HAS_DESTRUCTOR(thistype) ((thistype)->flags & TYPE_FLAG_HAS_DESTRUCTOR) -#define TYPE_HAS_CONSTRUCTOR(thistype) ((thistype)->flags & TYPE_FLAG_HAS_CONSTRUCTOR) +#define TYPE_FIELD_PRIVATE_BITS(thistype) \ + TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits +#define TYPE_FIELD_PROTECTED_BITS(thistype) \ + TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits +#define TYPE_FIELD_VIRTUAL_BITS(thistype) \ + TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits +#define SET_TYPE_FIELD_PRIVATE(thistype, n) \ + B_SET (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n)) +#define SET_TYPE_FIELD_PROTECTED(thistype, n) \ + B_SET (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n)) +#define SET_TYPE_FIELD_VIRTUAL(thistype, n) \ + B_SET (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n)) +#define TYPE_FIELD_PRIVATE(thistype, n) \ + B_TST(TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n)) +#define TYPE_FIELD_PROTECTED(thistype, n) \ +B_TST(TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n)) +#define TYPE_FIELD_VIRTUAL(thistype, n) \ + B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n)) #define TYPE_FIELD_STATIC(thistype, n) ((thistype)->fields[n].bitpos == -1) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) ((char *)(thistype)->fields[n].bitsize) -#define TYPE_FN_FIELDLISTS(thistype) (thistype)->fn_fieldlists -#define TYPE_FN_FIELDLIST(thistype, n) (thistype)->fn_fieldlists[n] -#define TYPE_FN_FIELDLIST1(thistype, n) (thistype)->fn_fieldlists[n].fn_fields -#define TYPE_FN_FIELDLIST_NAME(thistype, n) (thistype)->fn_fieldlists[n].name -#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) (thistype)->fn_fieldlists[n].length - -#define TYPE_FN_FIELD(thistype, n) (thistype)[n] -#define TYPE_FN_FIELD_NAME(thistype, n) (thistype)[n].name -#define TYPE_FN_FIELD_TYPE(thistype, n) (thistype)[n].type -#define TYPE_FN_FIELD_ARGS(thistype, n) TYPE_ARG_TYPES ((thistype)[n].type) -#define TYPE_FN_FIELD_PHYSNAME(thistype, n) (thistype)[n].physname -#define TYPE_FN_FIELD_VIRTUAL_P(thistype, n) ((thistype)[n].voffset > 1) -#define TYPE_FN_FIELD_STATIC_P(thistype, n) ((thistype)[n].voffset == VOFFSET_STATIC) -#define TYPE_FN_FIELD_VOFFSET(thistype, n) ((thistype)[n].voffset-2) -#define TYPE_FN_FIELD_FCONTEXT(thistype, n) ((thistype)[n].fcontext) - -#define TYPE_FN_PRIVATE_BITS(thistype) (thistype).private_fn_field_bits -#define TYPE_FN_PROTECTED_BITS(thistype) (thistype).protected_fn_field_bits -#define SET_TYPE_FN_PRIVATE(thistype, n) B_SET ((thistype).private_fn_field_bits, n) -#define SET_TYPE_FN_PROTECTED(thistype, n) B_SET ((thistype).protected_fn_field_bits, n) -#define TYPE_FN_PRIVATE(thistype, n) B_TST ((thistype).private_fn_field_bits, n) -#define TYPE_FN_PROTECTED(thistype, n) B_TST ((thistype).protected_fn_field_bits, n) +#define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists +#define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n] +#define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields +#define TYPE_FN_FIELDLIST_NAME(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].name +#define TYPE_FN_FIELDLIST_LENGTH(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].length + +#define TYPE_FN_FIELD(thisfn, n) (thisfn)[n] +#define TYPE_FN_FIELD_NAME(thisfn, n) (thisfn)[n].name +#define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type +#define TYPE_FN_FIELD_ARGS(thisfn, n) TYPE_ARG_TYPES ((thisfn)[n].type) +#define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname +#define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1) +#define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC) +#define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2) +#define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext) + +#define TYPE_FN_PRIVATE_BITS(thisfn) (thisfn).private_fn_field_bits +#define TYPE_FN_PROTECTED_BITS(thisfn) (thisfn).protected_fn_field_bits +#define SET_TYPE_FN_PRIVATE(thisfn, n) B_SET ((thisfn).private_fn_field_bits, n) +#define SET_TYPE_FN_PROTECTED(thisfn, n) B_SET ((thisfn).protected_fn_field_bits, n) +#define TYPE_FN_PRIVATE(thisfn, n) B_TST ((thisfn).private_fn_field_bits, n) +#define TYPE_FN_PROTECTED(thisfn, n) B_TST ((thisfn).protected_fn_field_bits, n) /* The virtual function table is now an array of structures which have the form { int16 offset, delta; void *pfn; }. @@ -799,6 +815,7 @@ extern char *type_name_no_tag (); extern int contained_in(); /* C++ stuff. */ +extern struct type *lookup_template_type (); extern struct type *lookup_reference_type (); extern struct type *lookup_member_type (); extern struct type *lookup_method_type ();