diff options
author | Fred Fish <fnf@specifix.com> | 1992-12-03 20:28:16 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1992-12-03 20:28:16 +0000 |
commit | bf229b4ea5f95fa036f6d3dc8fc7b236c5028f5e (patch) | |
tree | cc20d393117640e08a39907258a8a2c389bd3fe4 /gdb/ch-exp.y | |
parent | ef6bfbdbccdf4a0cbb759614c0ef73e9c07ec04b (diff) | |
download | gdb-bf229b4ea5f95fa036f6d3dc8fc7b236c5028f5e.zip gdb-bf229b4ea5f95fa036f6d3dc8fc7b236c5028f5e.tar.gz gdb-bf229b4ea5f95fa036f6d3dc8fc7b236c5028f5e.tar.bz2 |
* c-exp.y (c_create_fundamental_type): New function to create
language specific fundamental types for C.
* m2-exp.y (m2_create_fundamental_type): New function to create
language specific fundamental types for Modula 2.
* c-exp.y (c_language_defn, cplus_language_defn): Add
c_create_fundamental_type to language struct initializers.
* m2-exp.y (m2_language_defn): Add m2_create_fundamental_type
to language struct initializers.
* dwarfread.c (expression.h, language.h): Include.
* dwarfread.c (ftypes): New array to hold fundamental types
for current compilation unit.
* dwarfread.c (cu_language_defn): New pointer to language
struct for language of current compilation unit.
* dwarfread.c (dwarf_fundamental_type): New function to
create/lookup fundamental types.
* dwarfread.c (set_cu_language): Initialize cu_language_defn.
* dwarfread.c (throughout): Replace lookup_fundamental_type
with dwarf_fundamental_type.
* dwarfread.c (read_file_scope): Zero out ftypes for each new
compilation unit (may be different language or different objfile).
* gdbtypes.c (lookup_fundamental_type): Move actual type
creations into language specific fundamental type creation
functions and call via create_fundamental_type. Add comment
about this function being obsolescent.
* gdbtypes.h (FT_BYTE, FT_UNSIGNED_BYTE): New types, true byte
sized signed and unsigned integers.
* gdbtypes.h (FT_NUM_MEMBERS): Increment, new types added.
* language.c (language_def): New function to lookup a language
struct given it's enumeration.
* language.h (struct language_defn): Add la_fund_type, a pointer
to a function that creates fundamental types for this language.
* language.h (create_fundamental_type): New macro to create
fundamental types based on the current language.
* language.h (language_def): Add prototype.
* language.c (unk_lang_create_fundamental_type): New function
for initializing language structs, calls error if called.
* language.c (unk_language_defn, auto_language_defn,
local_language_defn): Use unk_lang_create_fundamental_type.
**** start-sanitize-chill ****
ch-exp.y (chill_create_fundamental_type): New function.
ch-exp.y (chill_language_defn): Add chill_create_fundamental_type.
ch-exp.y (_initialize_chill_exp): BOOL types are only one byte.
**** end-sanitize-chill ****
Diffstat (limited to 'gdb/ch-exp.y')
-rw-r--r-- | gdb/ch-exp.y | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y index dc60729..96dbda4 100644 --- a/gdb/ch-exp.y +++ b/gdb/ch-exp.y @@ -1431,6 +1431,70 @@ chill_printstr (stream, string, length, force_ellipses) } } +static struct type * +chill_create_fundamental_type (objfile, typeid) + struct objfile *objfile; + int typeid; +{ + register struct type *type = NULL; + register int nbytes; + + switch (typeid) + { + default: + /* FIXME: For now, if we are asked to produce a type not in this + language, create the equivalent of a C integer type with the + name "<?type?>". When all the dust settles from the type + reconstruction work, this should probably become an error. */ + type = init_type (TYPE_CODE_INT, + TARGET_INT_BIT / TARGET_CHAR_BIT, + 0, "<?type?>", objfile); + warning ("internal error: no chill fundamental type %d", typeid); + break; + case FT_BOOLEAN: + type = init_type (TYPE_CODE_BOOL, TARGET_CHAR_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "BOOL", objfile); + break; + case FT_CHAR: + type = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "CHAR", objfile); + break; + case FT_BYTE: + type = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_SIGNED, "BYTE", objfile); + break; + case FT_UNSIGNED_BYTE: + type = init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "UBYTE", objfile); + break; + case FT_INTEGER: + type = init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_SIGNED, "INT", objfile); + break; + case FT_UNSIGNED_INTEGER: + type = init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "UINT", objfile); + break; + case FT_LONG: + type = init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_SIGNED, "LONG", objfile); + break; + case FT_UNSIGNED_LONG: + type = init_type (TYPE_CODE_INT, TARGET_LONG_BIT / TARGET_CHAR_BIT, + TYPE_FLAG_UNSIGNED, "ULONG", objfile); + break; + case FT_FLOAT: + type = init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT, + 0, "REAL", objfile); + break; + case FT_DBL_PREC_FLOAT: + type = init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT, + 0, "LONG REAL", objfile); + break; + } + return (type); +} + /* Table of operators and their precedences for printing expressions. */ @@ -1483,6 +1547,7 @@ const struct language_defn chill_language_defn = { chill_error, /* parser error function */ chill_printchar, /* print a character constant */ chill_printstr, /* function to print a string constant */ + chill_create_fundamental_type,/* Create fundamental type in this language */ &BUILTIN_TYPE_LONGEST, /* longest signed integral type */ &BUILTIN_TYPE_UNSIGNED_LONGEST,/* longest unsigned integral type */ &builtin_type_chill_real, /* longest floating point type */ @@ -1500,7 +1565,7 @@ void _initialize_chill_exp () { builtin_type_chill_bool = - init_type (TYPE_CODE_BOOL, TARGET_INT_BIT / TARGET_CHAR_BIT, + init_type (TYPE_CODE_BOOL, TARGET_CHAR_BIT / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "BOOL", (struct objfile *) NULL); builtin_type_chill_char = |