diff --git a/gdb-6.6-buildid-locate-rpm-configure-error.patch b/gdb-6.6-buildid-locate-rpm-configure-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..1c8e0277f111c3f36695543e20718415337e6a03 --- /dev/null +++ b/gdb-6.6-buildid-locate-rpm-configure-error.patch @@ -0,0 +1,43 @@ +From 7ea134e81e38f2498bce45945bfab69974e6006f Mon Sep 17 00:00:00 2001 +From: root +Date: Sat, 6 May 2023 11:16:51 +0800 +Subject: [PATCH 2/2] fix + +--- + gdb-6.6-buildid-locate-rpm.patch | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch +index 64a96b7..96b5d5f 100644 +--- a/gdb-6.6-buildid-locate-rpm.patch ++++ b/gdb-6.6-buildid-locate-rpm.patch +@@ -806,7 +806,7 @@ diff --git a/gdb/configure b/gdb/configure + + if test "$cross_compiling" = yes; then : + + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +-+as_fn_error "cannot run test program while cross compiling +++as_fn_error $? "cannot run test program while cross compiling + +See \`config.log' for more details." "$LINENO" 5; } + +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +@@ -978,7 +978,7 @@ diff --git a/gdb/configure b/gdb/configure + +$as_echo "no" >&6; } + + LIBS="$save_LIBS" + + if $DLOPEN_REQUIRE; then +-+ as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5 +++ as_fn_error $? "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5 + + fi + + + + +@@ -1234,7 +1234,7 @@ diff --git a/gdb/configure b/gdb/configure + + LIBS="$LIBS $RPM_LIBS" + + else + + if $RPM_REQUIRE; then +-+ as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5 +++ as_fn_error $? "$RPM_PKG_ERRORS" "$LINENO" 5 + + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5 + +$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;} +-- +2.33.0 + diff --git a/gdb-8.3.1/bfd/doc/aoutx.texi b/gdb-8.3.1/bfd/doc/aoutx.texi new file mode 100644 index 0000000000000000000000000000000000000000..9927f954e65ec064a5906490d0043ac2fe1872e3 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/aoutx.texi @@ -0,0 +1,211 @@ +@section a.out backends + + +@strong{Description}@* +BFD supports a number of different flavours of a.out format, +though the major differences are only the sizes of the +structures on disk, and the shape of the relocation +information. + +The support is split into a basic support file @file{aoutx.h} +and other files which derive functions from the base. One +derivation file is @file{aoutf1.h} (for a.out flavour 1), and +adds to the basic a.out functions support for sun3, sun4, and +386 a.out files, to create a target jump vector for a specific +target. + +This information is further split out into more specific files +for each machine, including @file{sunos.c} for sun3 and sun4, +and @file{demo64.c} for a demonstration of a 64 bit a.out format. + +The base file @file{aoutx.h} defines general mechanisms for +reading and writing records to and from disk and various +other methods which BFD requires. It is included by +@file{aout32.c} and @file{aout64.c} to form the names +@code{aout_32_swap_exec_header_in}, @code{aout_64_swap_exec_header_in}, etc. + +As an example, this is what goes on to make the back end for a +sun4, from @file{aout32.c}: + +@example + #define ARCH_SIZE 32 + #include "aoutx.h" +@end example + +Which exports names: + +@example + ... + aout_32_canonicalize_reloc + aout_32_find_nearest_line + aout_32_get_lineno + aout_32_get_reloc_upper_bound + ... +@end example + +from @file{sunos.c}: + +@example + #define TARGET_NAME "a.out-sunos-big" + #define VECNAME sparc_aout_sunos_be_vec + #include "aoutf1.h" +@end example + +requires all the names from @file{aout32.c}, and produces the jump vector + +@example + sparc_aout_sunos_be_vec +@end example + +The file @file{host-aout.c} is a special case. It is for a large set +of hosts that use ``more or less standard'' a.out files, and +for which cross-debugging is not interesting. It uses the +standard 32-bit a.out support routines, but determines the +file offsets and addresses of the text, data, and BSS +sections, the machine architecture and machine type, and the +entry point address, in a host-dependent manner. Once these +values have been determined, generic code is used to handle +the object file. + +When porting it to run on a new system, you must supply: + +@example + HOST_PAGE_SIZE + HOST_SEGMENT_SIZE + HOST_MACHINE_ARCH (optional) + HOST_MACHINE_MACHINE (optional) + HOST_TEXT_START_ADDR + HOST_STACK_END_ADDR +@end example + +in the file @file{../include/sys/h-@var{XXX}.h} (for your host). These +values, plus the structures and macros defined in @file{a.out.h} on +your host system, will produce a BFD target that will access +ordinary a.out files on your host. To configure a new machine +to use @file{host-aout.c}, specify: + +@example + TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec + TDEPFILES= host-aout.o trad-core.o +@end example + +in the @file{config/@var{XXX}.mt} file, and modify @file{configure.ac} +to use the +@file{@var{XXX}.mt} file (by setting "@code{bfd_target=XXX}") when your +configuration is selected. + +@subsection Relocations + + +@strong{Description}@* +The file @file{aoutx.h} provides for both the @emph{standard} +and @emph{extended} forms of a.out relocation records. + +The standard records contain only an address, a symbol index, +and a type field. The extended records also have a full +integer for an addend. + +@subsection Internal entry points + + +@strong{Description}@* +@file{aoutx.h} exports several routines for accessing the +contents of an a.out file, which are gathered and exported in +turn by various format specific files (eg sunos.c). + +@findex aout_@var{size}_swap_exec_header_in +@subsubsection @code{aout_@var{size}_swap_exec_header_in} +@strong{Synopsis} +@example +void aout_@var{size}_swap_exec_header_in, + (bfd *abfd, + struct external_exec *bytes, + struct internal_exec *execp); +@end example +@strong{Description}@* +Swap the information in an executable header @var{raw_bytes} taken +from a raw byte stream memory image into the internal exec header +structure @var{execp}. + +@findex aout_@var{size}_swap_exec_header_out +@subsubsection @code{aout_@var{size}_swap_exec_header_out} +@strong{Synopsis} +@example +void aout_@var{size}_swap_exec_header_out + (bfd *abfd, + struct internal_exec *execp, + struct external_exec *raw_bytes); +@end example +@strong{Description}@* +Swap the information in an internal exec header structure +@var{execp} into the buffer @var{raw_bytes} ready for writing to disk. + +@findex aout_@var{size}_some_aout_object_p +@subsubsection @code{aout_@var{size}_some_aout_object_p} +@strong{Synopsis} +@example +const bfd_target *aout_@var{size}_some_aout_object_p + (bfd *abfd, + struct internal_exec *execp, + const bfd_target *(*callback_to_real_object_p) (bfd *)); +@end example +@strong{Description}@* +Some a.out variant thinks that the file open in @var{abfd} +checking is an a.out file. Do some more checking, and set up +for access if it really is. Call back to the calling +environment's "finish up" function just before returning, to +handle any last-minute setup. + +@findex aout_@var{size}_mkobject +@subsubsection @code{aout_@var{size}_mkobject} +@strong{Synopsis} +@example +bfd_boolean aout_@var{size}_mkobject, (bfd *abfd); +@end example +@strong{Description}@* +Initialize BFD @var{abfd} for use with a.out files. + +@findex aout_@var{size}_machine_type +@subsubsection @code{aout_@var{size}_machine_type} +@strong{Synopsis} +@example +enum machine_type aout_@var{size}_machine_type + (enum bfd_architecture arch, + unsigned long machine, + bfd_boolean *unknown); +@end example +@strong{Description}@* +Keep track of machine architecture and machine type for +a.out's. Return the @code{machine_type} for a particular +architecture and machine, or @code{M_UNKNOWN} if that exact architecture +and machine can't be represented in a.out format. + +If the architecture is understood, machine type 0 (default) +is always understood. + +@findex aout_@var{size}_set_arch_mach +@subsubsection @code{aout_@var{size}_set_arch_mach} +@strong{Synopsis} +@example +bfd_boolean aout_@var{size}_set_arch_mach, + (bfd *, + enum bfd_architecture arch, + unsigned long machine); +@end example +@strong{Description}@* +Set the architecture and the machine of the BFD @var{abfd} to the +values @var{arch} and @var{machine}. Verify that @var{abfd}'s format +can support the architecture required. + +@findex aout_@var{size}_new_section_hook +@subsubsection @code{aout_@var{size}_new_section_hook} +@strong{Synopsis} +@example +bfd_boolean aout_@var{size}_new_section_hook, + (bfd *abfd, + asection *newsect); +@end example +@strong{Description}@* +Called by the BFD in response to a @code{bfd_make_section} +request. + diff --git a/gdb-8.3.1/bfd/doc/archive.texi b/gdb-8.3.1/bfd/doc/archive.texi new file mode 100644 index 0000000000000000000000000000000000000000..3a90941d0d1802f9993c5c0720c6acc3dd990d14 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/archive.texi @@ -0,0 +1,106 @@ +@section Archives + + +@strong{Description}@* +An archive (or library) is just another BFD. It has a symbol +table, although there's not much a user program will do with it. + +The big difference between an archive BFD and an ordinary BFD +is that the archive doesn't have sections. Instead it has a +chain of BFDs that are considered its contents. These BFDs can +be manipulated like any other. The BFDs contained in an +archive opened for reading will all be opened for reading. You +may put either input or output BFDs into an archive opened for +output; they will be handled correctly when the archive is closed. + +Use @code{bfd_openr_next_archived_file} to step through +the contents of an archive opened for input. You don't +have to read the entire archive if you don't want +to! Read it until you find what you want. + +A BFD returned by @code{bfd_openr_next_archived_file} can be +closed manually with @code{bfd_close}. If you do not close it, +then a second iteration through the members of an archive may +return the same BFD. If you close the archive BFD, then all +the member BFDs will automatically be closed as well. + +Archive contents of output BFDs are chained through the +@code{archive_next} pointer in a BFD. The first one is findable +through the @code{archive_head} slot of the archive. Set it with +@code{bfd_set_archive_head} (q.v.). A given BFD may be in only +one open output archive at a time. + +As expected, the BFD archive code is more general than the +archive code of any given environment. BFD archives may +contain files of different formats (e.g., a.out and coff) and +even different architectures. You may even place archives +recursively into archives! + +This can cause unexpected confusion, since some archive +formats are more expressive than others. For instance, Intel +COFF archives can preserve long filenames; SunOS a.out archives +cannot. If you move a file from the first to the second +format and back again, the filename may be truncated. +Likewise, different a.out environments have different +conventions as to how they truncate filenames, whether they +preserve directory names in filenames, etc. When +interoperating with native tools, be sure your files are +homogeneous. + +Beware: most of these formats do not react well to the +presence of spaces in filenames. We do the best we can, but +can't always handle this case due to restrictions in the format of +archives. Many Unix utilities are braindead in regards to +spaces and such in filenames anyway, so this shouldn't be much +of a restriction. + +Archives are supported in BFD in @code{archive.c}. + +@subsection Archive functions + + +@findex bfd_get_next_mapent +@subsubsection @code{bfd_get_next_mapent} +@strong{Synopsis} +@example +symindex bfd_get_next_mapent + (bfd *abfd, symindex previous, carsym **sym); +@end example +@strong{Description}@* +Step through archive @var{abfd}'s symbol table (if it +has one). Successively update @var{sym} with the next symbol's +information, returning that symbol's (internal) index into the +symbol table. + +Supply @code{BFD_NO_MORE_SYMBOLS} as the @var{previous} entry to get +the first one; returns @code{BFD_NO_MORE_SYMBOLS} when you've already +got the last one. + +A @code{carsym} is a canonical archive symbol. The only +user-visible element is its name, a null-terminated string. + +@findex bfd_set_archive_head +@subsubsection @code{bfd_set_archive_head} +@strong{Synopsis} +@example +bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head); +@end example +@strong{Description}@* +Set the head of the chain of +BFDs contained in the archive @var{output} to @var{new_head}. + +@findex bfd_openr_next_archived_file +@subsubsection @code{bfd_openr_next_archived_file} +@strong{Synopsis} +@example +bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous); +@end example +@strong{Description}@* +Provided a BFD, @var{archive}, containing an archive and NULL, open +an input BFD on the first contained element and returns that. +Subsequent calls should pass the archive and the previous return +value to return a created BFD to the next contained element. NULL +is returned when there are no more. +Note - if you want to process the bfd returned by this call be +sure to call bfd_check_format() on it first. + diff --git a/gdb-8.3.1/bfd/doc/archures.texi b/gdb-8.3.1/bfd/doc/archures.texi new file mode 100644 index 0000000000000000000000000000000000000000..ca9d1e91fd1832012bab05bc19fd748a3498291e --- /dev/null +++ b/gdb-8.3.1/bfd/doc/archures.texi @@ -0,0 +1,766 @@ +@section Architectures +BFD keeps one atom in a BFD describing the +architecture of the data attached to the BFD: a pointer to a +@code{bfd_arch_info_type}. + +Pointers to structures can be requested independently of a BFD +so that an architecture's information can be interrogated +without access to an open BFD. + +The architecture information is provided by each architecture package. +The set of default architectures is selected by the macro +@code{SELECT_ARCHITECTURES}. This is normally set up in the +@file{config/@var{target}.mt} file of your choice. If the name is not +defined, then all the architectures supported are included. + +When BFD starts up, all the architectures are called with an +initialize method. It is up to the architecture back end to +insert as many items into the list of architectures as it wants to; +generally this would be one for each machine and one for the +default case (an item with a machine field of 0). + +BFD's idea of an architecture is implemented in @file{archures.c}. + +@subsection bfd_architecture + + +@strong{Description}@* +This enum gives the object file's CPU architecture, in a +global sense---i.e., what processor family does it belong to? +Another field indicates which processor within +the family is in use. The machine gives a number which +distinguishes different versions of the architecture, +containing, for example, 68020 for Motorola 68020. +@example +enum bfd_architecture +@{ + bfd_arch_unknown, /* File arch not known. */ + bfd_arch_obscure, /* Arch known, not one of these. */ + bfd_arch_m68k, /* Motorola 68xxx. */ +#define bfd_mach_m68000 1 +#define bfd_mach_m68008 2 +#define bfd_mach_m68010 3 +#define bfd_mach_m68020 4 +#define bfd_mach_m68030 5 +#define bfd_mach_m68040 6 +#define bfd_mach_m68060 7 +#define bfd_mach_cpu32 8 +#define bfd_mach_fido 9 +#define bfd_mach_mcf_isa_a_nodiv 10 +#define bfd_mach_mcf_isa_a 11 +#define bfd_mach_mcf_isa_a_mac 12 +#define bfd_mach_mcf_isa_a_emac 13 +#define bfd_mach_mcf_isa_aplus 14 +#define bfd_mach_mcf_isa_aplus_mac 15 +#define bfd_mach_mcf_isa_aplus_emac 16 +#define bfd_mach_mcf_isa_b_nousp 17 +#define bfd_mach_mcf_isa_b_nousp_mac 18 +#define bfd_mach_mcf_isa_b_nousp_emac 19 +#define bfd_mach_mcf_isa_b 20 +#define bfd_mach_mcf_isa_b_mac 21 +#define bfd_mach_mcf_isa_b_emac 22 +#define bfd_mach_mcf_isa_b_float 23 +#define bfd_mach_mcf_isa_b_float_mac 24 +#define bfd_mach_mcf_isa_b_float_emac 25 +#define bfd_mach_mcf_isa_c 26 +#define bfd_mach_mcf_isa_c_mac 27 +#define bfd_mach_mcf_isa_c_emac 28 +#define bfd_mach_mcf_isa_c_nodiv 29 +#define bfd_mach_mcf_isa_c_nodiv_mac 30 +#define bfd_mach_mcf_isa_c_nodiv_emac 31 + bfd_arch_vax, /* DEC Vax. */ + + bfd_arch_or1k, /* OpenRISC 1000. */ +#define bfd_mach_or1k 1 +#define bfd_mach_or1knd 2 + + bfd_arch_sparc, /* SPARC. */ +#define bfd_mach_sparc 1 +/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */ +#define bfd_mach_sparc_sparclet 2 +#define bfd_mach_sparc_sparclite 3 +#define bfd_mach_sparc_v8plus 4 +#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */ +#define bfd_mach_sparc_sparclite_le 6 +#define bfd_mach_sparc_v9 7 +#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */ +#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */ +#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */ +#define bfd_mach_sparc_v8plusc 11 /* with UA2005 and T1 add'ns. */ +#define bfd_mach_sparc_v9c 12 /* with UA2005 and T1 add'ns. */ +#define bfd_mach_sparc_v8plusd 13 /* with UA2007 and T3 add'ns. */ +#define bfd_mach_sparc_v9d 14 /* with UA2007 and T3 add'ns. */ +#define bfd_mach_sparc_v8pluse 15 /* with OSA2001 and T4 add'ns (no IMA). */ +#define bfd_mach_sparc_v9e 16 /* with OSA2001 and T4 add'ns (no IMA). */ +#define bfd_mach_sparc_v8plusv 17 /* with OSA2011 and T4 and IMA and FJMAU add'ns. */ +#define bfd_mach_sparc_v9v 18 /* with OSA2011 and T4 and IMA and FJMAU add'ns. */ +#define bfd_mach_sparc_v8plusm 19 /* with OSA2015 and M7 add'ns. */ +#define bfd_mach_sparc_v9m 20 /* with OSA2015 and M7 add'ns. */ +#define bfd_mach_sparc_v8plusm8 21 /* with OSA2017 and M8 add'ns. */ +#define bfd_mach_sparc_v9m8 22 /* with OSA2017 and M8 add'ns. */ +/* Nonzero if MACH has the v9 instruction set. */ +#define bfd_mach_sparc_v9_p(mach) \ + ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9m8 \ + && (mach) != bfd_mach_sparc_sparclite_le) +/* Nonzero if MACH is a 64 bit sparc architecture. */ +#define bfd_mach_sparc_64bit_p(mach) \ + ((mach) >= bfd_mach_sparc_v9 \ + && (mach) != bfd_mach_sparc_v8plusb \ + && (mach) != bfd_mach_sparc_v8plusc \ + && (mach) != bfd_mach_sparc_v8plusd \ + && (mach) != bfd_mach_sparc_v8pluse \ + && (mach) != bfd_mach_sparc_v8plusv \ + && (mach) != bfd_mach_sparc_v8plusm \ + && (mach) != bfd_mach_sparc_v8plusm8) + bfd_arch_spu, /* PowerPC SPU. */ +#define bfd_mach_spu 256 + bfd_arch_mips, /* MIPS Rxxxx. */ +#define bfd_mach_mips3000 3000 +#define bfd_mach_mips3900 3900 +#define bfd_mach_mips4000 4000 +#define bfd_mach_mips4010 4010 +#define bfd_mach_mips4100 4100 +#define bfd_mach_mips4111 4111 +#define bfd_mach_mips4120 4120 +#define bfd_mach_mips4300 4300 +#define bfd_mach_mips4400 4400 +#define bfd_mach_mips4600 4600 +#define bfd_mach_mips4650 4650 +#define bfd_mach_mips5000 5000 +#define bfd_mach_mips5400 5400 +#define bfd_mach_mips5500 5500 +#define bfd_mach_mips5900 5900 +#define bfd_mach_mips6000 6000 +#define bfd_mach_mips7000 7000 +#define bfd_mach_mips8000 8000 +#define bfd_mach_mips9000 9000 +#define bfd_mach_mips10000 10000 +#define bfd_mach_mips12000 12000 +#define bfd_mach_mips14000 14000 +#define bfd_mach_mips16000 16000 +#define bfd_mach_mips16 16 +#define bfd_mach_mips5 5 +#define bfd_mach_mips_loongson_2e 3001 +#define bfd_mach_mips_loongson_2f 3002 +#define bfd_mach_mips_gs464 3003 +#define bfd_mach_mips_gs464e 3004 +#define bfd_mach_mips_gs264e 3005 +#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01. */ +#define bfd_mach_mips_octeon 6501 +#define bfd_mach_mips_octeonp 6601 +#define bfd_mach_mips_octeon2 6502 +#define bfd_mach_mips_octeon3 6503 +#define bfd_mach_mips_xlr 887682 /* decimal 'XLR'. */ +#define bfd_mach_mips_interaptiv_mr2 736550 /* decimal 'IA2'. */ +#define bfd_mach_mipsisa32 32 +#define bfd_mach_mipsisa32r2 33 +#define bfd_mach_mipsisa32r3 34 +#define bfd_mach_mipsisa32r5 36 +#define bfd_mach_mipsisa32r6 37 +#define bfd_mach_mipsisa64 64 +#define bfd_mach_mipsisa64r2 65 +#define bfd_mach_mipsisa64r3 66 +#define bfd_mach_mipsisa64r5 68 +#define bfd_mach_mipsisa64r6 69 +#define bfd_mach_mips_micromips 96 + bfd_arch_i386, /* Intel 386. */ +#define bfd_mach_i386_intel_syntax (1 << 0) +#define bfd_mach_i386_i8086 (1 << 1) +#define bfd_mach_i386_i386 (1 << 2) +#define bfd_mach_x86_64 (1 << 3) +#define bfd_mach_x64_32 (1 << 4) +#define bfd_mach_i386_i386_intel_syntax (bfd_mach_i386_i386 | bfd_mach_i386_intel_syntax) +#define bfd_mach_x86_64_intel_syntax (bfd_mach_x86_64 | bfd_mach_i386_intel_syntax) +#define bfd_mach_x64_32_intel_syntax (bfd_mach_x64_32 | bfd_mach_i386_intel_syntax) + bfd_arch_l1om, /* Intel L1OM. */ +#define bfd_mach_l1om (1 << 5) +#define bfd_mach_l1om_intel_syntax (bfd_mach_l1om | bfd_mach_i386_intel_syntax) + bfd_arch_k1om, /* Intel K1OM. */ +#define bfd_mach_k1om (1 << 6) +#define bfd_mach_k1om_intel_syntax (bfd_mach_k1om | bfd_mach_i386_intel_syntax) +#define bfd_mach_i386_nacl (1 << 7) +#define bfd_mach_i386_i386_nacl (bfd_mach_i386_i386 | bfd_mach_i386_nacl) +#define bfd_mach_x86_64_nacl (bfd_mach_x86_64 | bfd_mach_i386_nacl) +#define bfd_mach_x64_32_nacl (bfd_mach_x64_32 | bfd_mach_i386_nacl) + bfd_arch_iamcu, /* Intel MCU. */ +#define bfd_mach_iamcu (1 << 8) +#define bfd_mach_i386_iamcu (bfd_mach_i386_i386 | bfd_mach_iamcu) +#define bfd_mach_i386_iamcu_intel_syntax (bfd_mach_i386_iamcu | bfd_mach_i386_intel_syntax) + bfd_arch_romp, /* IBM ROMP PC/RT. */ + bfd_arch_convex, /* Convex. */ + bfd_arch_m98k, /* Motorola 98xxx. */ + bfd_arch_pyramid, /* Pyramid Technology. */ + bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300). */ +#define bfd_mach_h8300 1 +#define bfd_mach_h8300h 2 +#define bfd_mach_h8300s 3 +#define bfd_mach_h8300hn 4 +#define bfd_mach_h8300sn 5 +#define bfd_mach_h8300sx 6 +#define bfd_mach_h8300sxn 7 + bfd_arch_pdp11, /* DEC PDP-11. */ + bfd_arch_plugin, + bfd_arch_powerpc, /* PowerPC. */ +#define bfd_mach_ppc 32 +#define bfd_mach_ppc64 64 +#define bfd_mach_ppc_403 403 +#define bfd_mach_ppc_403gc 4030 +#define bfd_mach_ppc_405 405 +#define bfd_mach_ppc_505 505 +#define bfd_mach_ppc_601 601 +#define bfd_mach_ppc_602 602 +#define bfd_mach_ppc_603 603 +#define bfd_mach_ppc_ec603e 6031 +#define bfd_mach_ppc_604 604 +#define bfd_mach_ppc_620 620 +#define bfd_mach_ppc_630 630 +#define bfd_mach_ppc_750 750 +#define bfd_mach_ppc_860 860 +#define bfd_mach_ppc_a35 35 +#define bfd_mach_ppc_rs64ii 642 +#define bfd_mach_ppc_rs64iii 643 +#define bfd_mach_ppc_7400 7400 +#define bfd_mach_ppc_e500 500 +#define bfd_mach_ppc_e500mc 5001 +#define bfd_mach_ppc_e500mc64 5005 +#define bfd_mach_ppc_e5500 5006 +#define bfd_mach_ppc_e6500 5007 +#define bfd_mach_ppc_titan 83 +#define bfd_mach_ppc_vle 84 + bfd_arch_rs6000, /* IBM RS/6000. */ +#define bfd_mach_rs6k 6000 +#define bfd_mach_rs6k_rs1 6001 +#define bfd_mach_rs6k_rsc 6003 +#define bfd_mach_rs6k_rs2 6002 + bfd_arch_hppa, /* HP PA RISC. */ +#define bfd_mach_hppa10 10 +#define bfd_mach_hppa11 11 +#define bfd_mach_hppa20 20 +#define bfd_mach_hppa20w 25 + bfd_arch_d10v, /* Mitsubishi D10V. */ +#define bfd_mach_d10v 1 +#define bfd_mach_d10v_ts2 2 +#define bfd_mach_d10v_ts3 3 + bfd_arch_d30v, /* Mitsubishi D30V. */ + bfd_arch_dlx, /* DLX. */ + bfd_arch_m68hc11, /* Motorola 68HC11. */ + bfd_arch_m68hc12, /* Motorola 68HC12. */ +#define bfd_mach_m6812_default 0 +#define bfd_mach_m6812 1 +#define bfd_mach_m6812s 2 + bfd_arch_m9s12x, /* Freescale S12X. */ + bfd_arch_m9s12xg, /* Freescale XGATE. */ + bfd_arch_s12z, /* Freescale S12Z. */ +#define bfd_mach_s12z_default 0 + bfd_arch_z8k, /* Zilog Z8000. */ +#define bfd_mach_z8001 1 +#define bfd_mach_z8002 2 + bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH). */ +#define bfd_mach_sh 1 +#define bfd_mach_sh2 0x20 +#define bfd_mach_sh_dsp 0x2d +#define bfd_mach_sh2a 0x2a +#define bfd_mach_sh2a_nofpu 0x2b +#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1 +#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2 +#define bfd_mach_sh2a_or_sh4 0x2a3 +#define bfd_mach_sh2a_or_sh3e 0x2a4 +#define bfd_mach_sh2e 0x2e +#define bfd_mach_sh3 0x30 +#define bfd_mach_sh3_nommu 0x31 +#define bfd_mach_sh3_dsp 0x3d +#define bfd_mach_sh3e 0x3e +#define bfd_mach_sh4 0x40 +#define bfd_mach_sh4_nofpu 0x41 +#define bfd_mach_sh4_nommu_nofpu 0x42 +#define bfd_mach_sh4a 0x4a +#define bfd_mach_sh4a_nofpu 0x4b +#define bfd_mach_sh4al_dsp 0x4d + bfd_arch_alpha, /* Dec Alpha. */ +#define bfd_mach_alpha_ev4 0x10 +#define bfd_mach_alpha_ev5 0x20 +#define bfd_mach_alpha_ev6 0x30 + bfd_arch_arm, /* Advanced Risc Machines ARM. */ +#define bfd_mach_arm_unknown 0 +#define bfd_mach_arm_2 1 +#define bfd_mach_arm_2a 2 +#define bfd_mach_arm_3 3 +#define bfd_mach_arm_3M 4 +#define bfd_mach_arm_4 5 +#define bfd_mach_arm_4T 6 +#define bfd_mach_arm_5 7 +#define bfd_mach_arm_5T 8 +#define bfd_mach_arm_5TE 9 +#define bfd_mach_arm_XScale 10 +#define bfd_mach_arm_ep9312 11 +#define bfd_mach_arm_iWMMXt 12 +#define bfd_mach_arm_iWMMXt2 13 +#define bfd_mach_arm_5TEJ 14 +#define bfd_mach_arm_6 15 +#define bfd_mach_arm_6KZ 16 +#define bfd_mach_arm_6T2 17 +#define bfd_mach_arm_6K 18 +#define bfd_mach_arm_7 19 +#define bfd_mach_arm_6M 20 +#define bfd_mach_arm_6SM 21 +#define bfd_mach_arm_7EM 22 +#define bfd_mach_arm_8 23 +#define bfd_mach_arm_8R 24 +#define bfd_mach_arm_8M_BASE 25 +#define bfd_mach_arm_8M_MAIN 26 + bfd_arch_nds32, /* Andes NDS32. */ +#define bfd_mach_n1 1 +#define bfd_mach_n1h 2 +#define bfd_mach_n1h_v2 3 +#define bfd_mach_n1h_v3 4 +#define bfd_mach_n1h_v3m 5 + bfd_arch_ns32k, /* National Semiconductors ns32000. */ + bfd_arch_tic30, /* Texas Instruments TMS320C30. */ + bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X. */ +#define bfd_mach_tic3x 30 +#define bfd_mach_tic4x 40 + bfd_arch_tic54x, /* Texas Instruments TMS320C54X. */ + bfd_arch_tic6x, /* Texas Instruments TMS320C6X. */ + bfd_arch_tic80, /* TI TMS320c80 (MVP). */ + bfd_arch_v850, /* NEC V850. */ + bfd_arch_v850_rh850,/* NEC V850 (using RH850 ABI). */ +#define bfd_mach_v850 1 +#define bfd_mach_v850e 'E' +#define bfd_mach_v850e1 '1' +#define bfd_mach_v850e2 0x4532 +#define bfd_mach_v850e2v3 0x45325633 +#define bfd_mach_v850e3v5 0x45335635 /* ('E'|'3'|'V'|'5'). */ + bfd_arch_arc, /* ARC Cores. */ +#define bfd_mach_arc_a4 0 +#define bfd_mach_arc_a5 1 +#define bfd_mach_arc_arc600 2 +#define bfd_mach_arc_arc601 4 +#define bfd_mach_arc_arc700 3 +#define bfd_mach_arc_arcv2 5 + bfd_arch_m32c, /* Renesas M16C/M32C. */ +#define bfd_mach_m16c 0x75 +#define bfd_mach_m32c 0x78 + bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D). */ +#define bfd_mach_m32r 1 /* For backwards compatibility. */ +#define bfd_mach_m32rx 'x' +#define bfd_mach_m32r2 '2' + bfd_arch_mn10200, /* Matsushita MN10200. */ + bfd_arch_mn10300, /* Matsushita MN10300. */ +#define bfd_mach_mn10300 300 +#define bfd_mach_am33 330 +#define bfd_mach_am33_2 332 + bfd_arch_fr30, +#define bfd_mach_fr30 0x46523330 + bfd_arch_frv, +#define bfd_mach_frv 1 +#define bfd_mach_frvsimple 2 +#define bfd_mach_fr300 300 +#define bfd_mach_fr400 400 +#define bfd_mach_fr450 450 +#define bfd_mach_frvtomcat 499 /* fr500 prototype. */ +#define bfd_mach_fr500 500 +#define bfd_mach_fr550 550 + bfd_arch_moxie, /* The moxie processor. */ +#define bfd_mach_moxie 1 + bfd_arch_ft32, /* The ft32 processor. */ +#define bfd_mach_ft32 1 +#define bfd_mach_ft32b 2 + bfd_arch_mcore, + bfd_arch_mep, +#define bfd_mach_mep 1 +#define bfd_mach_mep_h1 0x6831 +#define bfd_mach_mep_c5 0x6335 + bfd_arch_metag, +#define bfd_mach_metag 1 + bfd_arch_ia64, /* HP/Intel ia64. */ +#define bfd_mach_ia64_elf64 64 +#define bfd_mach_ia64_elf32 32 + bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */ +#define bfd_mach_ip2022 1 +#define bfd_mach_ip2022ext 2 + bfd_arch_iq2000, /* Vitesse IQ2000. */ +#define bfd_mach_iq2000 1 +#define bfd_mach_iq10 2 + bfd_arch_epiphany, /* Adapteva EPIPHANY. */ +#define bfd_mach_epiphany16 1 +#define bfd_mach_epiphany32 2 + bfd_arch_mt, +#define bfd_mach_ms1 1 +#define bfd_mach_mrisc2 2 +#define bfd_mach_ms2 3 + bfd_arch_pj, + bfd_arch_avr, /* Atmel AVR microcontrollers. */ +#define bfd_mach_avr1 1 +#define bfd_mach_avr2 2 +#define bfd_mach_avr25 25 +#define bfd_mach_avr3 3 +#define bfd_mach_avr31 31 +#define bfd_mach_avr35 35 +#define bfd_mach_avr4 4 +#define bfd_mach_avr5 5 +#define bfd_mach_avr51 51 +#define bfd_mach_avr6 6 +#define bfd_mach_avrtiny 100 +#define bfd_mach_avrxmega1 101 +#define bfd_mach_avrxmega2 102 +#define bfd_mach_avrxmega3 103 +#define bfd_mach_avrxmega4 104 +#define bfd_mach_avrxmega5 105 +#define bfd_mach_avrxmega6 106 +#define bfd_mach_avrxmega7 107 + bfd_arch_bfin, /* ADI Blackfin. */ +#define bfd_mach_bfin 1 + bfd_arch_cr16, /* National Semiconductor CompactRISC (ie CR16). */ +#define bfd_mach_cr16 1 + bfd_arch_cr16c, /* National Semiconductor CompactRISC. */ +#define bfd_mach_cr16c 1 + bfd_arch_crx, /* National Semiconductor CRX. */ +#define bfd_mach_crx 1 + bfd_arch_cris, /* Axis CRIS. */ +#define bfd_mach_cris_v0_v10 255 +#define bfd_mach_cris_v32 32 +#define bfd_mach_cris_v10_v32 1032 + bfd_arch_riscv, +#define bfd_mach_riscv32 132 +#define bfd_mach_riscv64 164 + bfd_arch_rl78, +#define bfd_mach_rl78 0x75 + bfd_arch_rx, /* Renesas RX. */ +#define bfd_mach_rx 0x75 +#define bfd_mach_rx_v2 0x76 +#define bfd_mach_rx_v3 0x77 + bfd_arch_s390, /* IBM s390. */ +#define bfd_mach_s390_31 31 +#define bfd_mach_s390_64 64 + bfd_arch_score, /* Sunplus score. */ +#define bfd_mach_score3 3 +#define bfd_mach_score7 7 + bfd_arch_mmix, /* Donald Knuth's educational processor. */ + bfd_arch_xstormy16, +#define bfd_mach_xstormy16 1 + bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */ +#define bfd_mach_msp11 11 +#define bfd_mach_msp110 110 +#define bfd_mach_msp12 12 +#define bfd_mach_msp13 13 +#define bfd_mach_msp14 14 +#define bfd_mach_msp15 15 +#define bfd_mach_msp16 16 +#define bfd_mach_msp20 20 +#define bfd_mach_msp21 21 +#define bfd_mach_msp22 22 +#define bfd_mach_msp23 23 +#define bfd_mach_msp24 24 +#define bfd_mach_msp26 26 +#define bfd_mach_msp31 31 +#define bfd_mach_msp32 32 +#define bfd_mach_msp33 33 +#define bfd_mach_msp41 41 +#define bfd_mach_msp42 42 +#define bfd_mach_msp43 43 +#define bfd_mach_msp44 44 +#define bfd_mach_msp430x 45 +#define bfd_mach_msp46 46 +#define bfd_mach_msp47 47 +#define bfd_mach_msp54 54 + bfd_arch_xc16x, /* Infineon's XC16X Series. */ +#define bfd_mach_xc16x 1 +#define bfd_mach_xc16xl 2 +#define bfd_mach_xc16xs 3 + bfd_arch_xgate, /* Freescale XGATE. */ +#define bfd_mach_xgate 1 + bfd_arch_xtensa, /* Tensilica's Xtensa cores. */ +#define bfd_mach_xtensa 1 + bfd_arch_z80, +#define bfd_mach_z80strict 1 /* No undocumented opcodes. */ +#define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */ +#define bfd_mach_z80full 7 /* All undocumented instructions. */ +#define bfd_mach_r800 11 /* R800: successor with multiplication. */ + bfd_arch_lm32, /* Lattice Mico32. */ +#define bfd_mach_lm32 1 + bfd_arch_microblaze,/* Xilinx MicroBlaze. */ + bfd_arch_tilepro, /* Tilera TILEPro. */ + bfd_arch_tilegx, /* Tilera TILE-Gx. */ +#define bfd_mach_tilepro 1 +#define bfd_mach_tilegx 1 +#define bfd_mach_tilegx32 2 + bfd_arch_aarch64, /* AArch64. */ +#define bfd_mach_aarch64 0 +#define bfd_mach_aarch64_ilp32 32 + bfd_arch_nios2, /* Nios II. */ +#define bfd_mach_nios2 0 +#define bfd_mach_nios2r1 1 +#define bfd_mach_nios2r2 2 + bfd_arch_visium, /* Visium. */ +#define bfd_mach_visium 1 + bfd_arch_wasm32, /* WebAssembly. */ +#define bfd_mach_wasm32 1 + bfd_arch_pru, /* PRU. */ +#define bfd_mach_pru 0 + bfd_arch_nfp, /* Netronome Flow Processor */ +#define bfd_mach_nfp3200 0x3200 +#define bfd_mach_nfp6000 0x6000 + bfd_arch_csky, /* C-SKY. */ +#define bfd_mach_ck_unknown 0 +#define bfd_mach_ck510 1 +#define bfd_mach_ck610 2 +#define bfd_mach_ck801 3 +#define bfd_mach_ck802 4 +#define bfd_mach_ck803 5 +#define bfd_mach_ck807 6 +#define bfd_mach_ck810 7 + bfd_arch_last + @}; +@end example + +@subsection bfd_arch_info + + +@strong{Description}@* +This structure contains information on architectures for use +within BFD. +@example + +typedef struct bfd_arch_info +@{ + int bits_per_word; + int bits_per_address; + int bits_per_byte; + enum bfd_architecture arch; + unsigned long mach; + const char *arch_name; + const char *printable_name; + unsigned int section_align_power; + /* TRUE if this is the default machine for the architecture. + The default arch should be the first entry for an arch so that + all the entries for that arch can be accessed via @code{next}. */ + bfd_boolean the_default; + const struct bfd_arch_info * (*compatible) (const struct bfd_arch_info *, + const struct bfd_arch_info *); + + bfd_boolean (*scan) (const struct bfd_arch_info *, const char *); + + /* Allocate via bfd_malloc and return a fill buffer of size COUNT. If + IS_BIGENDIAN is TRUE, the order of bytes is big endian. If CODE is + TRUE, the buffer contains code. */ + void *(*fill) (bfd_size_type count, bfd_boolean is_bigendian, + bfd_boolean code); + + const struct bfd_arch_info *next; +@} +bfd_arch_info_type; + +@end example + +@findex bfd_printable_name +@subsubsection @code{bfd_printable_name} +@strong{Synopsis} +@example +const char *bfd_printable_name (bfd *abfd); +@end example +@strong{Description}@* +Return a printable string representing the architecture and machine +from the pointer to the architecture info structure. + +@findex bfd_scan_arch +@subsubsection @code{bfd_scan_arch} +@strong{Synopsis} +@example +const bfd_arch_info_type *bfd_scan_arch (const char *string); +@end example +@strong{Description}@* +Figure out if BFD supports any cpu which could be described with +the name @var{string}. Return a pointer to an @code{arch_info} +structure if a machine is found, otherwise NULL. + +@findex bfd_arch_list +@subsubsection @code{bfd_arch_list} +@strong{Synopsis} +@example +const char **bfd_arch_list (void); +@end example +@strong{Description}@* +Return a freshly malloced NULL-terminated vector of the names +of all the valid BFD architectures. Do not modify the names. + +@findex bfd_arch_get_compatible +@subsubsection @code{bfd_arch_get_compatible} +@strong{Synopsis} +@example +const bfd_arch_info_type *bfd_arch_get_compatible + (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns); +@end example +@strong{Description}@* +Determine whether two BFDs' architectures and machine types +are compatible. Calculates the lowest common denominator +between the two architectures and machine types implied by +the BFDs and returns a pointer to an @code{arch_info} structure +describing the compatible machine. + +@findex bfd_default_arch_struct +@subsubsection @code{bfd_default_arch_struct} +@strong{Description}@* +The @code{bfd_default_arch_struct} is an item of +@code{bfd_arch_info_type} which has been initialized to a fairly +generic state. A BFD starts life by pointing to this +structure, until the correct back end has determined the real +architecture of the file. +@example +extern const bfd_arch_info_type bfd_default_arch_struct; +@end example + +@findex bfd_set_arch_info +@subsubsection @code{bfd_set_arch_info} +@strong{Synopsis} +@example +void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg); +@end example +@strong{Description}@* +Set the architecture info of @var{abfd} to @var{arg}. + +@findex bfd_default_set_arch_mach +@subsubsection @code{bfd_default_set_arch_mach} +@strong{Synopsis} +@example +bfd_boolean bfd_default_set_arch_mach + (bfd *abfd, enum bfd_architecture arch, unsigned long mach); +@end example +@strong{Description}@* +Set the architecture and machine type in BFD @var{abfd} +to @var{arch} and @var{mach}. Find the correct +pointer to a structure and insert it into the @code{arch_info} +pointer. + +@findex bfd_get_arch +@subsubsection @code{bfd_get_arch} +@strong{Synopsis} +@example +enum bfd_architecture bfd_get_arch (bfd *abfd); +@end example +@strong{Description}@* +Return the enumerated type which describes the BFD @var{abfd}'s +architecture. + +@findex bfd_get_mach +@subsubsection @code{bfd_get_mach} +@strong{Synopsis} +@example +unsigned long bfd_get_mach (bfd *abfd); +@end example +@strong{Description}@* +Return the long type which describes the BFD @var{abfd}'s +machine. + +@findex bfd_arch_bits_per_byte +@subsubsection @code{bfd_arch_bits_per_byte} +@strong{Synopsis} +@example +unsigned int bfd_arch_bits_per_byte (bfd *abfd); +@end example +@strong{Description}@* +Return the number of bits in one of the BFD @var{abfd}'s +architecture's bytes. + +@findex bfd_arch_bits_per_address +@subsubsection @code{bfd_arch_bits_per_address} +@strong{Synopsis} +@example +unsigned int bfd_arch_bits_per_address (bfd *abfd); +@end example +@strong{Description}@* +Return the number of bits in one of the BFD @var{abfd}'s +architecture's addresses. + +@findex bfd_default_compatible +@subsubsection @code{bfd_default_compatible} +@strong{Synopsis} +@example +const bfd_arch_info_type *bfd_default_compatible + (const bfd_arch_info_type *a, const bfd_arch_info_type *b); +@end example +@strong{Description}@* +The default function for testing for compatibility. + +@findex bfd_default_scan +@subsubsection @code{bfd_default_scan} +@strong{Synopsis} +@example +bfd_boolean bfd_default_scan + (const struct bfd_arch_info *info, const char *string); +@end example +@strong{Description}@* +The default function for working out whether this is an +architecture hit and a machine hit. + +@findex bfd_get_arch_info +@subsubsection @code{bfd_get_arch_info} +@strong{Synopsis} +@example +const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd); +@end example +@strong{Description}@* +Return the architecture info struct in @var{abfd}. + +@findex bfd_lookup_arch +@subsubsection @code{bfd_lookup_arch} +@strong{Synopsis} +@example +const bfd_arch_info_type *bfd_lookup_arch + (enum bfd_architecture arch, unsigned long machine); +@end example +@strong{Description}@* +Look for the architecture info structure which matches the +arguments @var{arch} and @var{machine}. A machine of 0 matches the +machine/architecture structure which marks itself as the +default. + +@findex bfd_printable_arch_mach +@subsubsection @code{bfd_printable_arch_mach} +@strong{Synopsis} +@example +const char *bfd_printable_arch_mach + (enum bfd_architecture arch, unsigned long machine); +@end example +@strong{Description}@* +Return a printable string representing the architecture and +machine type. + +This routine is depreciated. + +@findex bfd_octets_per_byte +@subsubsection @code{bfd_octets_per_byte} +@strong{Synopsis} +@example +unsigned int bfd_octets_per_byte (bfd *abfd); +@end example +@strong{Description}@* +Return the number of octets (8-bit quantities) per target byte +(minimum addressable unit). In most cases, this will be one, but some +DSP targets have 16, 32, or even 48 bits per byte. + +@findex bfd_arch_mach_octets_per_byte +@subsubsection @code{bfd_arch_mach_octets_per_byte} +@strong{Synopsis} +@example +unsigned int bfd_arch_mach_octets_per_byte + (enum bfd_architecture arch, unsigned long machine); +@end example +@strong{Description}@* +See bfd_octets_per_byte. + +This routine is provided for those cases where a bfd * is not +available + +@findex bfd_arch_default_fill +@subsubsection @code{bfd_arch_default_fill} +@strong{Synopsis} +@example +void *bfd_arch_default_fill (bfd_size_type count, + bfd_boolean is_bigendian, + bfd_boolean code); +@end example +@strong{Description}@* +Allocate via bfd_malloc and return a fill buffer of size COUNT. +If IS_BIGENDIAN is TRUE, the order of bytes is big endian. If +CODE is TRUE, the buffer contains code. + diff --git a/gdb-8.3.1/bfd/doc/bfdio.texi b/gdb-8.3.1/bfd/doc/bfdio.texi new file mode 100644 index 0000000000000000000000000000000000000000..53226e5d8c63e6e4114ee9fb57c7409ca25da91f --- /dev/null +++ b/gdb-8.3.1/bfd/doc/bfdio.texi @@ -0,0 +1,106 @@ +@findex struct bfd_iovec +@subsubsection @code{struct bfd_iovec} +@strong{Description}@* +The @code{struct bfd_iovec} contains the internal file I/O class. +Each @code{BFD} has an instance of this class and all file I/O is +routed through it (it is assumed that the instance implements +all methods listed below). +@example +struct bfd_iovec +@{ + /* To avoid problems with macros, a "b" rather than "f" + prefix is prepended to each method name. */ + /* Attempt to read/write NBYTES on ABFD's IOSTREAM storing/fetching + bytes starting at PTR. Return the number of bytes actually + transfered (a read past end-of-file returns less than NBYTES), + or -1 (setting @code{bfd_error}) if an error occurs. */ + file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes); + file_ptr (*bwrite) (struct bfd *abfd, const void *ptr, + file_ptr nbytes); + /* Return the current IOSTREAM file offset, or -1 (setting @code{bfd_error} + if an error occurs. */ + file_ptr (*btell) (struct bfd *abfd); + /* For the following, on successful completion a value of 0 is returned. + Otherwise, a value of -1 is returned (and @code{bfd_error} is set). */ + int (*bseek) (struct bfd *abfd, file_ptr offset, int whence); + int (*bclose) (struct bfd *abfd); + int (*bflush) (struct bfd *abfd); + int (*bstat) (struct bfd *abfd, struct stat *sb); + /* Mmap a part of the files. ADDR, LEN, PROT, FLAGS and OFFSET are the usual + mmap parameter, except that LEN and OFFSET do not need to be page + aligned. Returns (void *)-1 on failure, mmapped address on success. + Also write in MAP_ADDR the address of the page aligned buffer and in + MAP_LEN the size mapped (a page multiple). Use unmap with MAP_ADDR and + MAP_LEN to unmap. */ + void *(*bmmap) (struct bfd *abfd, void *addr, bfd_size_type len, + int prot, int flags, file_ptr offset, + void **map_addr, bfd_size_type *map_len); +@}; +extern const struct bfd_iovec _bfd_memory_iovec; +@end example + +@findex bfd_get_mtime +@subsubsection @code{bfd_get_mtime} +@strong{Synopsis} +@example +long bfd_get_mtime (bfd *abfd); +@end example +@strong{Description}@* +Return the file modification time (as read from the file system, or +from the archive header for archive members). + +@findex bfd_get_size +@subsubsection @code{bfd_get_size} +@strong{Synopsis} +@example +ufile_ptr bfd_get_size (bfd *abfd); +@end example +@strong{Description}@* +Return the file size (as read from file system) for the file +associated with BFD @var{abfd}. + +The initial motivation for, and use of, this routine is not +so we can get the exact size of the object the BFD applies to, since +that might not be generally possible (archive members for example). +It would be ideal if someone could eventually modify +it so that such results were guaranteed. + +Instead, we want to ask questions like "is this NNN byte sized +object I'm about to try read from file offset YYY reasonable?" +As as example of where we might do this, some object formats +use string tables for which the first @code{sizeof (long)} bytes of the +table contain the size of the table itself, including the size bytes. +If an application tries to read what it thinks is one of these +string tables, without some way to validate the size, and for +some reason the size is wrong (byte swapping error, wrong location +for the string table, etc.), the only clue is likely to be a read +error when it tries to read the table, or a "virtual memory +exhausted" error when it tries to allocate 15 bazillon bytes +of space for the 15 bazillon byte table it is about to read. +This function at least allows us to answer the question, "is the +size reasonable?". + +@findex bfd_get_file_size +@subsubsection @code{bfd_get_file_size} +@strong{Synopsis} +@example +ufile_ptr bfd_get_file_size (bfd *abfd); +@end example +@strong{Description}@* +Return the file size (as read from file system) for the file +associated with BFD @var{abfd}. It supports both normal files +and archive elements. + +@findex bfd_mmap +@subsubsection @code{bfd_mmap} +@strong{Synopsis} +@example +void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len, + int prot, int flags, file_ptr offset, + void **map_addr, bfd_size_type *map_len); +@end example +@strong{Description}@* +Return mmap()ed region of the file, if possible and implemented. +LEN and OFFSET do not need to be page aligned. The page aligned +address and length are written to MAP_ADDR and MAP_LEN. + diff --git a/gdb-8.3.1/bfd/doc/bfdt.texi b/gdb-8.3.1/bfd/doc/bfdt.texi new file mode 100644 index 0000000000000000000000000000000000000000..3764e4d17fdfac1459631934b90bd1522ece5188 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/bfdt.texi @@ -0,0 +1,992 @@ +@node typedef bfd, Error reporting, BFD front end, BFD front end +@section @code{typedef bfd} +A BFD has type @code{bfd}; objects of this type are the +cornerstone of any application using BFD. Using BFD +consists of making references though the BFD and to data in the BFD. + +Here is the structure that defines the type @code{bfd}. It +contains the major data about the file and pointers +to the rest of the data. + + +@example + +enum bfd_direction + @{ + no_direction = 0, + read_direction = 1, + write_direction = 2, + both_direction = 3 + @}; + +enum bfd_plugin_format + @{ + bfd_plugin_unknown = 0, + bfd_plugin_yes = 1, + bfd_plugin_no = 2 + @}; + +struct bfd_build_id + @{ + bfd_size_type size; + bfd_byte data[1]; + @}; + +struct bfd +@{ + /* The filename the application opened the BFD with. */ + const char *filename; + + /* A pointer to the target jump table. */ + const struct bfd_target *xvec; + + /* The IOSTREAM, and corresponding IO vector that provide access + to the file backing the BFD. */ + void *iostream; + const struct bfd_iovec *iovec; + + /* The caching routines use these to maintain a + least-recently-used list of BFDs. */ + struct bfd *lru_prev, *lru_next; + + /* Track current file position (or current buffer offset for + in-memory BFDs). When a file is closed by the caching routines, + BFD retains state information on the file here. */ + ufile_ptr where; + + /* File modified time, if mtime_set is TRUE. */ + long mtime; + + /* A unique identifier of the BFD */ + unsigned int id; + + /* The format which belongs to the BFD. (object, core, etc.) */ + ENUM_BITFIELD (bfd_format) format : 3; + + /* The direction with which the BFD was opened. */ + ENUM_BITFIELD (bfd_direction) direction : 2; + + /* Format_specific flags. */ + flagword flags : 20; + + /* Values that may appear in the flags field of a BFD. These also + appear in the object_flags field of the bfd_target structure, where + they indicate the set of flags used by that backend (not all flags + are meaningful for all object file formats) (FIXME: at the moment, + the object_flags values have mostly just been copied from backend + to another, and are not necessarily correct). */ + +#define BFD_NO_FLAGS 0x0 + + /* BFD contains relocation entries. */ +#define HAS_RELOC 0x1 + + /* BFD is directly executable. */ +#define EXEC_P 0x2 + + /* BFD has line number information (basically used for F_LNNO in a + COFF header). */ +#define HAS_LINENO 0x4 + + /* BFD has debugging information. */ +#define HAS_DEBUG 0x08 + + /* BFD has symbols. */ +#define HAS_SYMS 0x10 + + /* BFD has local symbols (basically used for F_LSYMS in a COFF + header). */ +#define HAS_LOCALS 0x20 + + /* BFD is a dynamic object. */ +#define DYNAMIC 0x40 + + /* Text section is write protected (if D_PAGED is not set, this is + like an a.out NMAGIC file) (the linker sets this by default, but + clears it for -r or -N). */ +#define WP_TEXT 0x80 + + /* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the + linker sets this by default, but clears it for -r or -n or -N). */ +#define D_PAGED 0x100 + + /* BFD is relaxable (this means that bfd_relax_section may be able to + do something) (sometimes bfd_relax_section can do something even if + this is not set). */ +#define BFD_IS_RELAXABLE 0x200 + + /* This may be set before writing out a BFD to request using a + traditional format. For example, this is used to request that when + writing out an a.out object the symbols not be hashed to eliminate + duplicates. */ +#define BFD_TRADITIONAL_FORMAT 0x400 + + /* This flag indicates that the BFD contents are actually cached + in memory. If this is set, iostream points to a bfd_in_memory + struct. */ +#define BFD_IN_MEMORY 0x800 + + /* This BFD has been created by the linker and doesn't correspond + to any input file. */ +#define BFD_LINKER_CREATED 0x1000 + + /* This may be set before writing out a BFD to request that it + be written using values for UIDs, GIDs, timestamps, etc. that + will be consistent from run to run. */ +#define BFD_DETERMINISTIC_OUTPUT 0x2000 + + /* Compress sections in this BFD. */ +#define BFD_COMPRESS 0x4000 + + /* Decompress sections in this BFD. */ +#define BFD_DECOMPRESS 0x8000 + + /* BFD is a dummy, for plugins. */ +#define BFD_PLUGIN 0x10000 + + /* Compress sections in this BFD with SHF_COMPRESSED from gABI. */ +#define BFD_COMPRESS_GABI 0x20000 + + /* Convert ELF common symbol type to STT_COMMON or STT_OBJECT in this + BFD. */ +#define BFD_CONVERT_ELF_COMMON 0x40000 + + /* Use the ELF STT_COMMON type in this BFD. */ +#define BFD_USE_ELF_STT_COMMON 0x80000 + + /* Flags bits to be saved in bfd_preserve_save. */ +#define BFD_FLAGS_SAVED \ + (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \ + | BFD_PLUGIN | BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON \ + | BFD_USE_ELF_STT_COMMON) + + /* Flags bits which are for BFD use only. */ +#define BFD_FLAGS_FOR_BFD_USE_MASK \ + (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \ + | BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT \ + | BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON | BFD_USE_ELF_STT_COMMON) + + /* Is the file descriptor being cached? That is, can it be closed as + needed, and re-opened when accessed later? */ + unsigned int cacheable : 1; + + /* Marks whether there was a default target specified when the + BFD was opened. This is used to select which matching algorithm + to use to choose the back end. */ + unsigned int target_defaulted : 1; + + /* ... and here: (``once'' means at least once). */ + unsigned int opened_once : 1; + + /* Set if we have a locally maintained mtime value, rather than + getting it from the file each time. */ + unsigned int mtime_set : 1; + + /* Flag set if symbols from this BFD should not be exported. */ + unsigned int no_export : 1; + + /* Remember when output has begun, to stop strange things + from happening. */ + unsigned int output_has_begun : 1; + + /* Have archive map. */ + unsigned int has_armap : 1; + + /* Set if this is a thin archive. */ + unsigned int is_thin_archive : 1; + + /* Set if only required symbols should be added in the link hash table for + this object. Used by VMS linkers. */ + unsigned int selective_search : 1; + + /* Set if this is the linker output BFD. */ + unsigned int is_linker_output : 1; + + /* Set if this is the linker input BFD. */ + unsigned int is_linker_input : 1; + + /* If this is an input for a compiler plug-in library. */ + ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2; + + /* Set if this is a plugin output file. */ + unsigned int lto_output : 1; + + /* Set to dummy BFD created when claimed by a compiler plug-in + library. */ + bfd *plugin_dummy_bfd; + + /* Currently my_archive is tested before adding origin to + anything. I believe that this can become always an add of + origin, with origin set to 0 for non archive files. */ + ufile_ptr origin; + + /* The origin in the archive of the proxy entry. This will + normally be the same as origin, except for thin archives, + when it will contain the current offset of the proxy in the + thin archive rather than the offset of the bfd in its actual + container. */ + ufile_ptr proxy_origin; + + /* A hash table for section names. */ + struct bfd_hash_table section_htab; + + /* Pointer to linked list of sections. */ + struct bfd_section *sections; + + /* The last section on the section list. */ + struct bfd_section *section_last; + + /* The number of sections. */ + unsigned int section_count; + + /* A field used by _bfd_generic_link_add_archive_symbols. This will + be used only for archive elements. */ + int archive_pass; + + /* Stuff only useful for object files: + The start address. */ + bfd_vma start_address; + + /* Symbol table for output BFD (with symcount entries). + Also used by the linker to cache input BFD symbols. */ + struct bfd_symbol **outsymbols; + + /* Used for input and output. */ + unsigned int symcount; + + /* Used for slurped dynamic symbol tables. */ + unsigned int dynsymcount; + + /* Pointer to structure which contains architecture information. */ + const struct bfd_arch_info *arch_info; + + /* Stuff only useful for archives. */ + void *arelt_data; + struct bfd *my_archive; /* The containing archive BFD. */ + struct bfd *archive_next; /* The next BFD in the archive. */ + struct bfd *archive_head; /* The first BFD in the archive. */ + struct bfd *nested_archives; /* List of nested archive in a flattened + thin archive. */ + + union @{ + /* For input BFDs, a chain of BFDs involved in a link. */ + struct bfd *next; + /* For output BFD, the linker hash table. */ + struct bfd_link_hash_table *hash; + @} link; + + /* Used by the back end to hold private data. */ + union + @{ + struct aout_data_struct *aout_data; + struct artdata *aout_ar_data; + struct coff_tdata *coff_obj_data; + struct pe_tdata *pe_obj_data; + struct xcoff_tdata *xcoff_obj_data; + struct ecoff_tdata *ecoff_obj_data; + struct srec_data_struct *srec_data; + struct verilog_data_struct *verilog_data; + struct ihex_data_struct *ihex_data; + struct tekhex_data_struct *tekhex_data; + struct elf_obj_tdata *elf_obj_data; + struct mmo_data_struct *mmo_data; + struct sun_core_struct *sun_core_data; + struct sco5_core_struct *sco5_core_data; + struct trad_core_struct *trad_core_data; + struct som_data_struct *som_data; + struct hpux_core_struct *hpux_core_data; + struct hppabsd_core_struct *hppabsd_core_data; + struct sgi_core_struct *sgi_core_data; + struct lynx_core_struct *lynx_core_data; + struct osf_core_struct *osf_core_data; + struct cisco_core_struct *cisco_core_data; + struct versados_data_struct *versados_data; + struct netbsd_core_struct *netbsd_core_data; + struct mach_o_data_struct *mach_o_data; + struct mach_o_fat_data_struct *mach_o_fat_data; + struct plugin_data_struct *plugin_data; + struct bfd_pef_data_struct *pef_data; + struct bfd_pef_xlib_data_struct *pef_xlib_data; + struct bfd_sym_data_struct *sym_data; + void *any; + @} + tdata; + + /* Used by the application to hold private data. */ + void *usrdata; + + /* Where all the allocated stuff under this BFD goes. This is a + struct objalloc *, but we use void * to avoid requiring the inclusion + of objalloc.h. */ + void *memory; + + /* For input BFDs, the build ID, if the object has one. */ + const struct bfd_build_id *build_id; +@}; + +/* See note beside bfd_set_section_userdata. */ +static inline bfd_boolean +bfd_set_cacheable (bfd * abfd, bfd_boolean val) +@{ + abfd->cacheable = val; + return TRUE; +@} + +@end example +@node Error reporting, Miscellaneous, typedef bfd, BFD front end +@section Error reporting +Most BFD functions return nonzero on success (check their +individual documentation for precise semantics). On an error, +they call @code{bfd_set_error} to set an error condition that callers +can check by calling @code{bfd_get_error}. +If that returns @code{bfd_error_system_call}, then check +@code{errno}. + +The easiest way to report a BFD error to the user is to +use @code{bfd_perror}. + +@subsection Type @code{bfd_error_type} +The values returned by @code{bfd_get_error} are defined by the +enumerated type @code{bfd_error_type}. + + +@example + +typedef enum bfd_error +@{ + bfd_error_no_error = 0, + bfd_error_system_call, + bfd_error_invalid_target, + bfd_error_wrong_format, + bfd_error_wrong_object_format, + bfd_error_invalid_operation, + bfd_error_no_memory, + bfd_error_no_symbols, + bfd_error_no_armap, + bfd_error_no_more_archived_files, + bfd_error_malformed_archive, + bfd_error_missing_dso, + bfd_error_file_not_recognized, + bfd_error_file_ambiguously_recognized, + bfd_error_no_contents, + bfd_error_nonrepresentable_section, + bfd_error_no_debug_section, + bfd_error_bad_value, + bfd_error_file_truncated, + bfd_error_file_too_big, + bfd_error_on_input, + bfd_error_invalid_error_code +@} +bfd_error_type; + +@end example +@findex bfd_get_error +@subsubsection @code{bfd_get_error} +@strong{Synopsis} +@example +bfd_error_type bfd_get_error (void); +@end example +@strong{Description}@* +Return the current BFD error condition. + +@findex bfd_set_error +@subsubsection @code{bfd_set_error} +@strong{Synopsis} +@example +void bfd_set_error (bfd_error_type error_tag); +@end example +@strong{Description}@* +Set the BFD error condition to be @var{error_tag}. + +@var{error_tag} must not be bfd_error_on_input. Use +bfd_set_input_error for input errors instead. + +@findex bfd_set_input_error +@subsubsection @code{bfd_set_input_error} +@strong{Synopsis} +@example +void bfd_set_input_error (bfd *input, bfd_error_type error_tag); +@end example +@strong{Description}@* +Set the BFD error condition to be bfd_error_on_input. +@var{input} is the input bfd where the error occurred, and +@var{error_tag} the bfd_error_type error. + +@findex bfd_errmsg +@subsubsection @code{bfd_errmsg} +@strong{Synopsis} +@example +const char *bfd_errmsg (bfd_error_type error_tag); +@end example +@strong{Description}@* +Return a string describing the error @var{error_tag}, or +the system error if @var{error_tag} is @code{bfd_error_system_call}. + +@findex bfd_perror +@subsubsection @code{bfd_perror} +@strong{Synopsis} +@example +void bfd_perror (const char *message); +@end example +@strong{Description}@* +Print to the standard error stream a string describing the +last BFD error that occurred, or the last system error if +the last BFD error was a system call failure. If @var{message} +is non-NULL and non-empty, the error string printed is preceded +by @var{message}, a colon, and a space. It is followed by a newline. + +@subsection BFD error handler +Some BFD functions want to print messages describing the +problem. They call a BFD error handler function. This +function may be overridden by the program. + +The BFD error handler acts like vprintf. + + +@example + +typedef void (*bfd_error_handler_type) (const char *, va_list); + +@end example +@findex _bfd_error_handler +@subsubsection @code{_bfd_error_handler} +@strong{Synopsis} +@example +void _bfd_error_handler (const char *fmt, ...) ATTRIBUTE_PRINTF_1; +@end example +@strong{Description}@* +This is the default routine to handle BFD error messages. +Like fprintf (stderr, ...), but also handles some extra format +specifiers. + +%pA section name from section. For group components, prints +group name too. +%pB file name from bfd. For archive components, prints +archive too. + +Beware: Only supports a maximum of 9 format arguments. + +@findex bfd_set_error_handler +@subsubsection @code{bfd_set_error_handler} +@strong{Synopsis} +@example +bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); +@end example +@strong{Description}@* +Set the BFD error handler function. Returns the previous +function. + +@findex bfd_set_error_program_name +@subsubsection @code{bfd_set_error_program_name} +@strong{Synopsis} +@example +void bfd_set_error_program_name (const char *); +@end example +@strong{Description}@* +Set the program name to use when printing a BFD error. This +is printed before the error message followed by a colon and +space. The string must not be changed after it is passed to +this function. + +@subsection BFD assert handler +If BFD finds an internal inconsistency, the bfd assert +handler is called with information on the BFD version, BFD +source file and line. If this happens, most programs linked +against BFD are expected to want to exit with an error, or mark +the current BFD operation as failed, so it is recommended to +override the default handler, which just calls +_bfd_error_handler and continues. + + +@example + +typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg, + const char *bfd_version, + const char *bfd_file, + int bfd_line); + +@end example +@findex bfd_set_assert_handler +@subsubsection @code{bfd_set_assert_handler} +@strong{Synopsis} +@example +bfd_assert_handler_type bfd_set_assert_handler (bfd_assert_handler_type); +@end example +@strong{Description}@* +Set the BFD assert handler function. Returns the previous +function. + +@node Miscellaneous, Memory Usage, Error reporting, BFD front end +@section Miscellaneous + + +@subsection Miscellaneous functions + + +@findex bfd_get_reloc_upper_bound +@subsubsection @code{bfd_get_reloc_upper_bound} +@strong{Synopsis} +@example +long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect); +@end example +@strong{Description}@* +Return the number of bytes required to store the +relocation information associated with section @var{sect} +attached to bfd @var{abfd}. If an error occurs, return -1. + +@findex bfd_canonicalize_reloc +@subsubsection @code{bfd_canonicalize_reloc} +@strong{Synopsis} +@example +long bfd_canonicalize_reloc + (bfd *abfd, asection *sec, arelent **loc, asymbol **syms); +@end example +@strong{Description}@* +Call the back end associated with the open BFD +@var{abfd} and translate the external form of the relocation +information attached to @var{sec} into the internal canonical +form. Place the table into memory at @var{loc}, which has +been preallocated, usually by a call to +@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or +-1 on error. + +The @var{syms} table is also needed for horrible internal magic +reasons. + +@findex bfd_set_reloc +@subsubsection @code{bfd_set_reloc} +@strong{Synopsis} +@example +void bfd_set_reloc + (bfd *abfd, asection *sec, arelent **rel, unsigned int count); +@end example +@strong{Description}@* +Set the relocation pointer and count within +section @var{sec} to the values @var{rel} and @var{count}. +The argument @var{abfd} is ignored. +@example +#define bfd_set_reloc(abfd, asect, location, count) \ + BFD_SEND (abfd, _bfd_set_reloc, (abfd, asect, location, count)) +@end example + +@findex bfd_set_file_flags +@subsubsection @code{bfd_set_file_flags} +@strong{Synopsis} +@example +bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags); +@end example +@strong{Description}@* +Set the flag word in the BFD @var{abfd} to the value @var{flags}. + +Possible errors are: +@itemize @bullet + +@item +@code{bfd_error_wrong_format} - The target bfd was not of object format. +@item +@code{bfd_error_invalid_operation} - The target bfd was open for reading. +@item +@code{bfd_error_invalid_operation} - +The flag word contained a bit which was not applicable to the +type of file. E.g., an attempt was made to set the @code{D_PAGED} bit +on a BFD format which does not support demand paging. +@end itemize + +@findex bfd_get_arch_size +@subsubsection @code{bfd_get_arch_size} +@strong{Synopsis} +@example +int bfd_get_arch_size (bfd *abfd); +@end example +@strong{Description}@* +Returns the normalized architecture address size, in bits, as +determined by the object file's format. By normalized, we mean +either 32 or 64. For ELF, this information is included in the +header. Use bfd_arch_bits_per_address for number of bits in +the architecture address. + +@strong{Returns}@* +Returns the arch size in bits if known, @code{-1} otherwise. + +@findex bfd_get_sign_extend_vma +@subsubsection @code{bfd_get_sign_extend_vma} +@strong{Synopsis} +@example +int bfd_get_sign_extend_vma (bfd *abfd); +@end example +@strong{Description}@* +Indicates if the target architecture "naturally" sign extends +an address. Some architectures implicitly sign extend address +values when they are converted to types larger than the size +of an address. For instance, bfd_get_start_address() will +return an address sign extended to fill a bfd_vma when this is +the case. + +@strong{Returns}@* +Returns @code{1} if the target architecture is known to sign +extend addresses, @code{0} if the target architecture is known to +not sign extend addresses, and @code{-1} otherwise. + +@findex bfd_set_start_address +@subsubsection @code{bfd_set_start_address} +@strong{Synopsis} +@example +bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma); +@end example +@strong{Description}@* +Make @var{vma} the entry point of output BFD @var{abfd}. + +@strong{Returns}@* +Returns @code{TRUE} on success, @code{FALSE} otherwise. + +@findex bfd_get_gp_size +@subsubsection @code{bfd_get_gp_size} +@strong{Synopsis} +@example +unsigned int bfd_get_gp_size (bfd *abfd); +@end example +@strong{Description}@* +Return the maximum size of objects to be optimized using the GP +register under MIPS ECOFF. This is typically set by the @code{-G} +argument to the compiler, assembler or linker. + +@findex bfd_set_gp_size +@subsubsection @code{bfd_set_gp_size} +@strong{Synopsis} +@example +void bfd_set_gp_size (bfd *abfd, unsigned int i); +@end example +@strong{Description}@* +Set the maximum size of objects to be optimized using the GP +register under ECOFF or MIPS ELF. This is typically set by +the @code{-G} argument to the compiler, assembler or linker. + +@findex bfd_scan_vma +@subsubsection @code{bfd_scan_vma} +@strong{Synopsis} +@example +bfd_vma bfd_scan_vma (const char *string, const char **end, int base); +@end example +@strong{Description}@* +Convert, like @code{strtoul}, a numerical expression +@var{string} into a @code{bfd_vma} integer, and return that integer. +(Though without as many bells and whistles as @code{strtoul}.) +The expression is assumed to be unsigned (i.e., positive). +If given a @var{base}, it is used as the base for conversion. +A base of 0 causes the function to interpret the string +in hex if a leading "0x" or "0X" is found, otherwise +in octal if a leading zero is found, otherwise in decimal. + +If the value would overflow, the maximum @code{bfd_vma} value is +returned. + +@findex bfd_copy_private_header_data +@subsubsection @code{bfd_copy_private_header_data} +@strong{Synopsis} +@example +bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd); +@end example +@strong{Description}@* +Copy private BFD header information from the BFD @var{ibfd} to the +the BFD @var{obfd}. This copies information that may require +sections to exist, but does not require symbol tables. Return +@code{true} on success, @code{false} on error. +Possible error returns are: + +@itemize @bullet + +@item +@code{bfd_error_no_memory} - +Not enough memory exists to create private data for @var{obfd}. +@end itemize +@example +#define bfd_copy_private_header_data(ibfd, obfd) \ + BFD_SEND (obfd, _bfd_copy_private_header_data, \ + (ibfd, obfd)) +@end example + +@findex bfd_copy_private_bfd_data +@subsubsection @code{bfd_copy_private_bfd_data} +@strong{Synopsis} +@example +bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd); +@end example +@strong{Description}@* +Copy private BFD information from the BFD @var{ibfd} to the +the BFD @var{obfd}. Return @code{TRUE} on success, @code{FALSE} on error. +Possible error returns are: + +@itemize @bullet + +@item +@code{bfd_error_no_memory} - +Not enough memory exists to create private data for @var{obfd}. +@end itemize +@example +#define bfd_copy_private_bfd_data(ibfd, obfd) \ + BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ + (ibfd, obfd)) +@end example + +@findex bfd_set_private_flags +@subsubsection @code{bfd_set_private_flags} +@strong{Synopsis} +@example +bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); +@end example +@strong{Description}@* +Set private BFD flag information in the BFD @var{abfd}. +Return @code{TRUE} on success, @code{FALSE} on error. Possible error +returns are: + +@itemize @bullet + +@item +@code{bfd_error_no_memory} - +Not enough memory exists to create private data for @var{obfd}. +@end itemize +@example +#define bfd_set_private_flags(abfd, flags) \ + BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags)) +@end example + +@findex Other functions +@subsubsection @code{Other functions} +@strong{Description}@* +The following functions exist but have not yet been documented. +@example +#define bfd_sizeof_headers(abfd, info) \ + BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info)) + +#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ + BFD_SEND (abfd, _bfd_find_nearest_line, \ + (abfd, syms, sec, off, file, func, line, NULL)) + +#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \ + line, disc) \ + BFD_SEND (abfd, _bfd_find_nearest_line, \ + (abfd, syms, sec, off, file, func, line, disc)) + +#define bfd_find_line(abfd, syms, sym, file, line) \ + BFD_SEND (abfd, _bfd_find_line, \ + (abfd, syms, sym, file, line)) + +#define bfd_find_inliner_info(abfd, file, func, line) \ + BFD_SEND (abfd, _bfd_find_inliner_info, \ + (abfd, file, func, line)) + +#define bfd_debug_info_start(abfd) \ + BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) + +#define bfd_debug_info_end(abfd) \ + BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) + +#define bfd_debug_info_accumulate(abfd, section) \ + BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) + +#define bfd_stat_arch_elt(abfd, stat) \ + BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) + +#define bfd_update_armap_timestamp(abfd) \ + BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) + +#define bfd_set_arch_mach(abfd, arch, mach)\ + BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) + +#define bfd_relax_section(abfd, section, link_info, again) \ + BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again)) + +#define bfd_gc_sections(abfd, link_info) \ + BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info)) + +#define bfd_lookup_section_flags(link_info, flag_info, section) \ + BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info, section)) + +#define bfd_merge_sections(abfd, link_info) \ + BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) + +#define bfd_is_group_section(abfd, sec) \ + BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec)) + +#define bfd_discard_group(abfd, sec) \ + BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) + +#define bfd_link_hash_table_create(abfd) \ + BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) + +#define bfd_link_add_symbols(abfd, info) \ + BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) + +#define bfd_link_just_syms(abfd, sec, info) \ + BFD_SEND (abfd, _bfd_link_just_syms, (sec, info)) + +#define bfd_final_link(abfd, info) \ + BFD_SEND (abfd, _bfd_final_link, (abfd, info)) + +#define bfd_free_cached_info(abfd) \ + BFD_SEND (abfd, _bfd_free_cached_info, (abfd)) + +#define bfd_get_dynamic_symtab_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd)) + +#define bfd_print_private_bfd_data(abfd, file)\ + BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file)) + +#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ + BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) + +#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \ + BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \ + dyncount, dynsyms, ret)) + +#define bfd_get_dynamic_reloc_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) + +#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \ + BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) + +extern bfd_byte *bfd_get_relocated_section_contents + (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, + bfd_boolean, asymbol **); + +@end example + +@findex bfd_alt_mach_code +@subsubsection @code{bfd_alt_mach_code} +@strong{Synopsis} +@example +bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative); +@end example +@strong{Description}@* +When more than one machine code number is available for the +same machine type, this function can be used to switch between +the preferred one (alternative == 0) and any others. Currently, +only ELF supports this feature, with up to two alternate +machine codes. + +@findex bfd_emul_get_maxpagesize +@subsubsection @code{bfd_emul_get_maxpagesize} +@strong{Synopsis} +@example +bfd_vma bfd_emul_get_maxpagesize (const char *); +@end example +@strong{Description}@* +Returns the maximum page size, in bytes, as determined by +emulation. + +@strong{Returns}@* +Returns the maximum page size in bytes for ELF, 0 otherwise. + +@findex bfd_emul_set_maxpagesize +@subsubsection @code{bfd_emul_set_maxpagesize} +@strong{Synopsis} +@example +void bfd_emul_set_maxpagesize (const char *, bfd_vma); +@end example +@strong{Description}@* +For ELF, set the maximum page size for the emulation. It is +a no-op for other formats. + +@findex bfd_emul_get_commonpagesize +@subsubsection @code{bfd_emul_get_commonpagesize} +@strong{Synopsis} +@example +bfd_vma bfd_emul_get_commonpagesize (const char *, bfd_boolean); +@end example +@strong{Description}@* +Returns the common page size, in bytes, as determined by +emulation. + +@strong{Returns}@* +Returns the common page size in bytes for ELF, 0 otherwise. + +@findex bfd_emul_set_commonpagesize +@subsubsection @code{bfd_emul_set_commonpagesize} +@strong{Synopsis} +@example +void bfd_emul_set_commonpagesize (const char *, bfd_vma); +@end example +@strong{Description}@* +For ELF, set the common page size for the emulation. It is +a no-op for other formats. + +@findex bfd_demangle +@subsubsection @code{bfd_demangle} +@strong{Synopsis} +@example +char *bfd_demangle (bfd *, const char *, int); +@end example +@strong{Description}@* +Wrapper around cplus_demangle. Strips leading underscores and +other such chars that would otherwise confuse the demangler. +If passed a g++ v3 ABI mangled name, returns a buffer allocated +with malloc holding the demangled name. Returns NULL otherwise +and on memory alloc failure. + +@findex bfd_update_compression_header +@subsubsection @code{bfd_update_compression_header} +@strong{Synopsis} +@example +void bfd_update_compression_header + (bfd *abfd, bfd_byte *contents, asection *sec); +@end example +@strong{Description}@* +Set the compression header at CONTENTS of SEC in ABFD and update +elf_section_flags for compression. + +@findex bfd_check_compression_header +@subsubsection @code{bfd_check_compression_header} +@strong{Synopsis} +@example +bfd_boolean bfd_check_compression_header + (bfd *abfd, bfd_byte *contents, asection *sec, + bfd_size_type *uncompressed_size, + unsigned int *uncompressed_alignment_power); +@end example +@strong{Description}@* +Check the compression header at CONTENTS of SEC in ABFD and +store the uncompressed size in UNCOMPRESSED_SIZE and the +uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER +if the compression header is valid. + +@strong{Returns}@* +Return TRUE if the compression header is valid. + +@findex bfd_get_compression_header_size +@subsubsection @code{bfd_get_compression_header_size} +@strong{Synopsis} +@example +int bfd_get_compression_header_size (bfd *abfd, asection *sec); +@end example +@strong{Description}@* +Return the size of the compression header of SEC in ABFD. + +@strong{Returns}@* +Return the size of the compression header in bytes. + +@findex bfd_convert_section_size +@subsubsection @code{bfd_convert_section_size} +@strong{Synopsis} +@example +bfd_size_type bfd_convert_section_size + (bfd *ibfd, asection *isec, bfd *obfd, bfd_size_type size); +@end example +@strong{Description}@* +Convert the size @var{size} of the section @var{isec} in input +BFD @var{ibfd} to the section size in output BFD @var{obfd}. + +@findex bfd_convert_section_contents +@subsubsection @code{bfd_convert_section_contents} +@strong{Synopsis} +@example +bfd_boolean bfd_convert_section_contents + (bfd *ibfd, asection *isec, bfd *obfd, + bfd_byte **ptr, bfd_size_type *ptr_size); +@end example +@strong{Description}@* +Convert the contents, stored in @var{*ptr}, of the section +@var{isec} in input BFD @var{ibfd} to output BFD @var{obfd} +if needed. The original buffer pointed to by @var{*ptr} may +be freed and @var{*ptr} is returned with memory malloc'd by this +function, and the new size written to @var{ptr_size}. + diff --git a/gdb-8.3.1/bfd/doc/bfdver.texi b/gdb-8.3.1/bfd/doc/bfdver.texi new file mode 100644 index 0000000000000000000000000000000000000000..5373ebf600eb395bb4796886fa19b67098ffd748 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/bfdver.texi @@ -0,0 +1,4 @@ +@set VERSION 2.32.51 +@set VERSION_PACKAGE (GNU Binutils) +@set UPDATED September 2019 +@set BUGURL @uref{http://www.sourceware.org/bugzilla/} diff --git a/gdb-8.3.1/bfd/doc/bfdwin.texi b/gdb-8.3.1/bfd/doc/bfdwin.texi new file mode 100644 index 0000000000000000000000000000000000000000..b1fd7d5bed690234cced92d5c8bdd7011c07e949 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/bfdwin.texi @@ -0,0 +1,2 @@ +@findex +@subsubsection @code{} diff --git a/gdb-8.3.1/bfd/doc/cache.texi b/gdb-8.3.1/bfd/doc/cache.texi new file mode 100644 index 0000000000000000000000000000000000000000..05b627e6ff9888281ac9f062ffb13d9227e44c94 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/cache.texi @@ -0,0 +1,65 @@ +@section File caching +The file caching mechanism is embedded within BFD and allows +the application to open as many BFDs as it wants without +regard to the underlying operating system's file descriptor +limit (often as low as 20 open files). The module in +@code{cache.c} maintains a least recently used list of +@code{bfd_cache_max_open} files, and exports the name +@code{bfd_cache_lookup}, which runs around and makes sure that +the required BFD is open. If not, then it chooses a file to +close, closes it and opens the one wanted, returning its file +handle. + +@subsection Caching functions + + +@findex bfd_cache_init +@subsubsection @code{bfd_cache_init} +@strong{Synopsis} +@example +bfd_boolean bfd_cache_init (bfd *abfd); +@end example +@strong{Description}@* +Add a newly opened BFD to the cache. + +@findex bfd_cache_close +@subsubsection @code{bfd_cache_close} +@strong{Synopsis} +@example +bfd_boolean bfd_cache_close (bfd *abfd); +@end example +@strong{Description}@* +Remove the BFD @var{abfd} from the cache. If the attached file is open, +then close it too. + +@strong{Returns}@* +@code{FALSE} is returned if closing the file fails, @code{TRUE} is +returned if all is well. + +@findex bfd_cache_close_all +@subsubsection @code{bfd_cache_close_all} +@strong{Synopsis} +@example +bfd_boolean bfd_cache_close_all (void); +@end example +@strong{Description}@* +Remove all BFDs from the cache. If the attached file is open, +then close it too. + +@strong{Returns}@* +@code{FALSE} is returned if closing one of the file fails, @code{TRUE} is +returned if all is well. + +@findex bfd_open_file +@subsubsection @code{bfd_open_file} +@strong{Synopsis} +@example +FILE* bfd_open_file (bfd *abfd); +@end example +@strong{Description}@* +Call the OS to open a file for @var{abfd}. Return the @code{FILE *} +(possibly @code{NULL}) that results from this operation. Set up the +BFD so that future accesses know the file is open. If the @code{FILE *} +returned is @code{NULL}, then it won't have been put in the +cache, so it won't have to be removed from it. + diff --git a/gdb-8.3.1/bfd/doc/coffcode.texi b/gdb-8.3.1/bfd/doc/coffcode.texi new file mode 100644 index 0000000000000000000000000000000000000000..96e206a0972c6cd44630a7c5ab099c85790595ce --- /dev/null +++ b/gdb-8.3.1/bfd/doc/coffcode.texi @@ -0,0 +1,681 @@ +@section coff backends +BFD supports a number of different flavours of coff format. +The major differences between formats are the sizes and +alignments of fields in structures on disk, and the occasional +extra field. + +Coff in all its varieties is implemented with a few common +files and a number of implementation specific files. For +example, the i386 coff format is implemented in the file +@file{coff-i386.c}. This file @code{#include}s +@file{coff/i386.h} which defines the external structure of the +coff format for the i386, and @file{coff/internal.h} which +defines the internal structure. @file{coff-i386.c} also +defines the relocations used by the i386 coff format +@xref{Relocations}. + +@subsection Porting to a new version of coff +The recommended method is to select from the existing +implementations the version of coff which is most like the one +you want to use. For example, we'll say that i386 coff is +the one you select, and that your coff flavour is called foo. +Copy @file{i386coff.c} to @file{foocoff.c}, copy +@file{../include/coff/i386.h} to @file{../include/coff/foo.h}, +and add the lines to @file{targets.c} and @file{Makefile.in} +so that your new back end is used. Alter the shapes of the +structures in @file{../include/coff/foo.h} so that they match +what you need. You will probably also have to add +@code{#ifdef}s to the code in @file{coff/internal.h} and +@file{coffcode.h} if your version of coff is too wild. + +You can verify that your new BFD backend works quite simply by +building @file{objdump} from the @file{binutils} directory, +and making sure that its version of what's going on and your +host system's idea (assuming it has the pretty standard coff +dump utility, usually called @code{att-dump} or just +@code{dump}) are the same. Then clean up your code, and send +what you've done to Cygnus. Then your stuff will be in the +next release, and you won't have to keep integrating it. + +@subsection How the coff backend works + + +@subsubsection File layout +The Coff backend is split into generic routines that are +applicable to any Coff target and routines that are specific +to a particular target. The target-specific routines are +further split into ones which are basically the same for all +Coff targets except that they use the external symbol format +or use different values for certain constants. + +The generic routines are in @file{coffgen.c}. These routines +work for any Coff target. They use some hooks into the target +specific code; the hooks are in a @code{bfd_coff_backend_data} +structure, one of which exists for each target. + +The essentially similar target-specific routines are in +@file{coffcode.h}. This header file includes executable C code. +The various Coff targets first include the appropriate Coff +header file, make any special defines that are needed, and +then include @file{coffcode.h}. + +Some of the Coff targets then also have additional routines in +the target source file itself. + +@subsubsection Coff long section names +In the standard Coff object format, section names are limited to +the eight bytes available in the @code{s_name} field of the +@code{SCNHDR} section header structure. The format requires the +field to be NUL-padded, but not necessarily NUL-terminated, so +the longest section names permitted are a full eight characters. + +The Microsoft PE variants of the Coff object file format add +an extension to support the use of long section names. This +extension is defined in section 4 of the Microsoft PE/COFF +specification (rev 8.1). If a section name is too long to fit +into the section header's @code{s_name} field, it is instead +placed into the string table, and the @code{s_name} field is +filled with a slash ("/") followed by the ASCII decimal +representation of the offset of the full name relative to the +string table base. + +Note that this implies that the extension can only be used in object +files, as executables do not contain a string table. The standard +specifies that long section names from objects emitted into executable +images are to be truncated. + +However, as a GNU extension, BFD can generate executable images +that contain a string table and long section names. This +would appear to be technically valid, as the standard only says +that Coff debugging information is deprecated, not forbidden, +and in practice it works, although some tools that parse PE files +expecting the MS standard format may become confused; @file{PEview} is +one known example. + +The functionality is supported in BFD by code implemented under +the control of the macro @code{COFF_LONG_SECTION_NAMES}. If not +defined, the format does not support long section names in any way. +If defined, it is used to initialise a flag, +@code{_bfd_coff_long_section_names}, and a hook function pointer, +@code{_bfd_coff_set_long_section_names}, in the Coff backend data +structure. The flag controls the generation of long section names +in output BFDs at runtime; if it is false, as it will be by default +when generating an executable image, long section names are truncated; +if true, the long section names extension is employed. The hook +points to a function that allows the value of the flag to be altered +at runtime, on formats that support long section names at all; on +other formats it points to a stub that returns an error indication. + +With input BFDs, the flag is set according to whether any long section +names are detected while reading the section headers. For a completely +new BFD, the flag is set to the default for the target format. This +information can be used by a client of the BFD library when deciding +what output format to generate, and means that a BFD that is opened +for read and subsequently converted to a writeable BFD and modified +in-place will retain whatever format it had on input. + +If @code{COFF_LONG_SECTION_NAMES} is simply defined (blank), or is +defined to the value "1", then long section names are enabled by +default; if it is defined to the value zero, they are disabled by +default (but still accepted in input BFDs). The header @file{coffcode.h} +defines a macro, @code{COFF_DEFAULT_LONG_SECTION_NAMES}, which is +used in the backends to initialise the backend data structure fields +appropriately; see the comments for further detail. + +@subsubsection Bit twiddling +Each flavour of coff supported in BFD has its own header file +describing the external layout of the structures. There is also +an internal description of the coff layout, in +@file{coff/internal.h}. A major function of the +coff backend is swapping the bytes and twiddling the bits to +translate the external form of the structures into the normal +internal form. This is all performed in the +@code{bfd_swap}_@i{thing}_@i{direction} routines. Some +elements are different sizes between different versions of +coff; it is the duty of the coff version specific include file +to override the definitions of various packing routines in +@file{coffcode.h}. E.g., the size of line number entry in coff is +sometimes 16 bits, and sometimes 32 bits. @code{#define}ing +@code{PUT_LNSZ_LNNO} and @code{GET_LNSZ_LNNO} will select the +correct one. No doubt, some day someone will find a version of +coff which has a varying field size not catered to at the +moment. To port BFD, that person will have to add more @code{#defines}. +Three of the bit twiddling routines are exported to +@code{gdb}; @code{coff_swap_aux_in}, @code{coff_swap_sym_in} +and @code{coff_swap_lineno_in}. @code{GDB} reads the symbol +table on its own, but uses BFD to fix things up. More of the +bit twiddlers are exported for @code{gas}; +@code{coff_swap_aux_out}, @code{coff_swap_sym_out}, +@code{coff_swap_lineno_out}, @code{coff_swap_reloc_out}, +@code{coff_swap_filehdr_out}, @code{coff_swap_aouthdr_out}, +@code{coff_swap_scnhdr_out}. @code{Gas} currently keeps track +of all the symbol table and reloc drudgery itself, thereby +saving the internal BFD overhead, but uses BFD to swap things +on the way out, making cross ports much safer. Doing so also +allows BFD (and thus the linker) to use the same header files +as @code{gas}, which makes one avenue to disaster disappear. + +@subsubsection Symbol reading +The simple canonical form for symbols used by BFD is not rich +enough to keep all the information available in a coff symbol +table. The back end gets around this problem by keeping the original +symbol table around, "behind the scenes". + +When a symbol table is requested (through a call to +@code{bfd_canonicalize_symtab}), a request gets through to +@code{coff_get_normalized_symtab}. This reads the symbol table from +the coff file and swaps all the structures inside into the +internal form. It also fixes up all the pointers in the table +(represented in the file by offsets from the first symbol in +the table) into physical pointers to elements in the new +internal table. This involves some work since the meanings of +fields change depending upon context: a field that is a +pointer to another structure in the symbol table at one moment +may be the size in bytes of a structure at the next. Another +pass is made over the table. All symbols which mark file names +(@code{C_FILE} symbols) are modified so that the internal +string points to the value in the auxent (the real filename) +rather than the normal text associated with the symbol +(@code{".file"}). + +At this time the symbol names are moved around. Coff stores +all symbols less than nine characters long physically +within the symbol table; longer strings are kept at the end of +the file in the string table. This pass moves all strings +into memory and replaces them with pointers to the strings. + +The symbol table is massaged once again, this time to create +the canonical table used by the BFD application. Each symbol +is inspected in turn, and a decision made (using the +@code{sclass} field) about the various flags to set in the +@code{asymbol}. @xref{Symbols}. The generated canonical table +shares strings with the hidden internal symbol table. + +Any linenumbers are read from the coff file too, and attached +to the symbols which own the functions the linenumbers belong to. + +@subsubsection Symbol writing +Writing a symbol to a coff file which didn't come from a coff +file will lose any debugging information. The @code{asymbol} +structure remembers the BFD from which the symbol was taken, and on +output the back end makes sure that the same destination target as +source target is present. + +When the symbols have come from a coff file then all the +debugging information is preserved. + +Symbol tables are provided for writing to the back end in a +vector of pointers to pointers. This allows applications like +the linker to accumulate and output large symbol tables +without having to do too much byte copying. + +This function runs through the provided symbol table and +patches each symbol marked as a file place holder +(@code{C_FILE}) to point to the next file place holder in the +list. It also marks each @code{offset} field in the list with +the offset from the first symbol of the current symbol. + +Another function of this procedure is to turn the canonical +value form of BFD into the form used by coff. Internally, BFD +expects symbol values to be offsets from a section base; so a +symbol physically at 0x120, but in a section starting at +0x100, would have the value 0x20. Coff expects symbols to +contain their final value, so symbols have their values +changed at this point to reflect their sum with their owning +section. This transformation uses the +@code{output_section} field of the @code{asymbol}'s +@code{asection} @xref{Sections}. + +@itemize @bullet + +@item +@code{coff_mangle_symbols} +@end itemize +This routine runs though the provided symbol table and uses +the offsets generated by the previous pass and the pointers +generated when the symbol table was read in to create the +structured hierarchy required by coff. It changes each pointer +to a symbol into the index into the symbol table of the asymbol. + +@itemize @bullet + +@item +@code{coff_write_symbols} +@end itemize +This routine runs through the symbol table and patches up the +symbols from their internal form into the coff way, calls the +bit twiddlers, and writes out the table to the file. + +@findex coff_symbol_type +@subsubsection @code{coff_symbol_type} +@strong{Description}@* +The hidden information for an @code{asymbol} is described in a +@code{combined_entry_type}: + + +@example + +typedef struct coff_ptr_struct +@{ + /* Remembers the offset from the first symbol in the file for + this symbol. Generated by coff_renumber_symbols. */ + unsigned int offset; + + /* Should the value of this symbol be renumbered. Used for + XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */ + unsigned int fix_value : 1; + + /* Should the tag field of this symbol be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_tag : 1; + + /* Should the endidx field of this symbol be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_end : 1; + + /* Should the x_csect.x_scnlen field be renumbered. + Created by coff_pointerize_aux. */ + unsigned int fix_scnlen : 1; + + /* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the + index into the line number entries. Set by coff_slurp_symbol_table. */ + unsigned int fix_line : 1; + + /* The container for the symbol structure as read and translated + from the file. */ + union + @{ + union internal_auxent auxent; + struct internal_syment syment; + @} u; + + /* Selector for the union above. */ + bfd_boolean is_sym; +@} combined_entry_type; + + +/* Each canonical asymbol really looks like this: */ + +typedef struct coff_symbol_struct +@{ + /* The actual symbol which the rest of BFD works with */ + asymbol symbol; + + /* A pointer to the hidden information for this symbol */ + combined_entry_type *native; + + /* A pointer to the linenumber information for this symbol */ + struct lineno_cache_entry *lineno; + + /* Have the line numbers been relocated yet ? */ + bfd_boolean done_lineno; +@} coff_symbol_type; +@end example +@findex bfd_coff_backend_data +@subsubsection @code{bfd_coff_backend_data} + +@example +/* COFF symbol classifications. */ + +enum coff_symbol_classification +@{ + /* Global symbol. */ + COFF_SYMBOL_GLOBAL, + /* Common symbol. */ + COFF_SYMBOL_COMMON, + /* Undefined symbol. */ + COFF_SYMBOL_UNDEFINED, + /* Local symbol. */ + COFF_SYMBOL_LOCAL, + /* PE section symbol. */ + COFF_SYMBOL_PE_SECTION +@}; + +typedef asection * (*coff_gc_mark_hook_fn) + (asection *, struct bfd_link_info *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *); + +@end example +Special entry points for gdb to swap in coff symbol table parts: +@example +typedef struct +@{ + void (*_bfd_coff_swap_aux_in) + (bfd *, void *, int, int, int, int, void *); + + void (*_bfd_coff_swap_sym_in) + (bfd *, void *, void *); + + void (*_bfd_coff_swap_lineno_in) + (bfd *, void *, void *); + + unsigned int (*_bfd_coff_swap_aux_out) + (bfd *, void *, int, int, int, int, void *); + + unsigned int (*_bfd_coff_swap_sym_out) + (bfd *, void *, void *); + + unsigned int (*_bfd_coff_swap_lineno_out) + (bfd *, void *, void *); + + unsigned int (*_bfd_coff_swap_reloc_out) + (bfd *, void *, void *); + + unsigned int (*_bfd_coff_swap_filehdr_out) + (bfd *, void *, void *); + + unsigned int (*_bfd_coff_swap_aouthdr_out) + (bfd *, void *, void *); + + unsigned int (*_bfd_coff_swap_scnhdr_out) + (bfd *, void *, void *); + + unsigned int _bfd_filhsz; + unsigned int _bfd_aoutsz; + unsigned int _bfd_scnhsz; + unsigned int _bfd_symesz; + unsigned int _bfd_auxesz; + unsigned int _bfd_relsz; + unsigned int _bfd_linesz; + unsigned int _bfd_filnmlen; + bfd_boolean _bfd_coff_long_filenames; + + bfd_boolean _bfd_coff_long_section_names; + bfd_boolean (*_bfd_coff_set_long_section_names) + (bfd *, int); + + unsigned int _bfd_coff_default_section_alignment_power; + bfd_boolean _bfd_coff_force_symnames_in_strings; + unsigned int _bfd_coff_debug_string_prefix_length; + unsigned int _bfd_coff_max_nscns; + + void (*_bfd_coff_swap_filehdr_in) + (bfd *, void *, void *); + + void (*_bfd_coff_swap_aouthdr_in) + (bfd *, void *, void *); + + void (*_bfd_coff_swap_scnhdr_in) + (bfd *, void *, void *); + + void (*_bfd_coff_swap_reloc_in) + (bfd *abfd, void *, void *); + + bfd_boolean (*_bfd_coff_bad_format_hook) + (bfd *, void *); + + bfd_boolean (*_bfd_coff_set_arch_mach_hook) + (bfd *, void *); + + void * (*_bfd_coff_mkobject_hook) + (bfd *, void *, void *); + + bfd_boolean (*_bfd_styp_to_sec_flags_hook) + (bfd *, void *, const char *, asection *, flagword *); + + void (*_bfd_set_alignment_hook) + (bfd *, asection *, void *); + + bfd_boolean (*_bfd_coff_slurp_symbol_table) + (bfd *); + + bfd_boolean (*_bfd_coff_symname_in_debug) + (bfd *, struct internal_syment *); + + bfd_boolean (*_bfd_coff_pointerize_aux_hook) + (bfd *, combined_entry_type *, combined_entry_type *, + unsigned int, combined_entry_type *); + + bfd_boolean (*_bfd_coff_print_aux) + (bfd *, FILE *, combined_entry_type *, combined_entry_type *, + combined_entry_type *, unsigned int); + + void (*_bfd_coff_reloc16_extra_cases) + (bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, + bfd_byte *, unsigned int *, unsigned int *); + + int (*_bfd_coff_reloc16_estimate) + (bfd *, asection *, arelent *, unsigned int, + struct bfd_link_info *); + + enum coff_symbol_classification (*_bfd_coff_classify_symbol) + (bfd *, struct internal_syment *); + + bfd_boolean (*_bfd_coff_compute_section_file_positions) + (bfd *); + + bfd_boolean (*_bfd_coff_start_final_link) + (bfd *, struct bfd_link_info *); + + bfd_boolean (*_bfd_coff_relocate_section) + (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **); + + reloc_howto_type *(*_bfd_coff_rtype_to_howto) + (bfd *, asection *, struct internal_reloc *, + struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *); + + bfd_boolean (*_bfd_coff_adjust_symndx) + (bfd *, struct bfd_link_info *, bfd *, asection *, + struct internal_reloc *, bfd_boolean *); + + bfd_boolean (*_bfd_coff_link_add_one_symbol) + (struct bfd_link_info *, bfd *, const char *, flagword, + asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, + struct bfd_link_hash_entry **); + + bfd_boolean (*_bfd_coff_link_output_has_begun) + (bfd *, struct coff_final_link_info *); + + bfd_boolean (*_bfd_coff_final_link_postscript) + (bfd *, struct coff_final_link_info *); + + bfd_boolean (*_bfd_coff_print_pdata) + (bfd *, void *); + +@} bfd_coff_backend_data; + +#define coff_backend_info(abfd) \ + ((bfd_coff_backend_data *) (abfd)->xvec->backend_data) + +#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \ + ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i)) + +#define bfd_coff_swap_sym_in(a,e,i) \ + ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i)) + +#define bfd_coff_swap_lineno_in(a,e,i) \ + ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i)) + +#define bfd_coff_swap_reloc_out(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o)) + +#define bfd_coff_swap_lineno_out(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o)) + +#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \ + ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o)) + +#define bfd_coff_swap_sym_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o)) + +#define bfd_coff_swap_scnhdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o)) + +#define bfd_coff_swap_filehdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o)) + +#define bfd_coff_swap_aouthdr_out(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o)) + +#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz) +#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz) +#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz) +#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz) +#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz) +#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz) +#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz) +#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen) +#define bfd_coff_long_filenames(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_long_filenames) +#define bfd_coff_long_section_names(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_long_section_names) +#define bfd_coff_set_long_section_names(abfd, enable) \ + ((coff_backend_info (abfd)->_bfd_coff_set_long_section_names) (abfd, enable)) +#define bfd_coff_default_section_alignment_power(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) +#define bfd_coff_max_nscns(abfd) \ + (coff_backend_info (abfd)->_bfd_coff_max_nscns) + +#define bfd_coff_swap_filehdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) + +#define bfd_coff_swap_aouthdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) + +#define bfd_coff_swap_scnhdr_in(abfd, i,o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o)) + +#define bfd_coff_swap_reloc_in(abfd, i, o) \ + ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o)) + +#define bfd_coff_bad_format_hook(abfd, filehdr) \ + ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr)) + +#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\ + ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)) +#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\ + ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook)\ + (abfd, filehdr, aouthdr)) + +#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section, flags_ptr)\ + ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\ + (abfd, scnhdr, name, section, flags_ptr)) + +#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ + ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) + +#define bfd_coff_slurp_symbol_table(abfd)\ + ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd)) + +#define bfd_coff_symname_in_debug(abfd, sym)\ + ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym)) + +#define bfd_coff_force_symnames_in_strings(abfd)\ + (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings) + +#define bfd_coff_debug_string_prefix_length(abfd)\ + (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length) + +#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\ + ((coff_backend_info (abfd)->_bfd_coff_print_aux)\ + (abfd, file, base, symbol, aux, indaux)) + +#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\ + reloc, data, src_ptr, dst_ptr)\ + ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\ + (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)) + +#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\ + ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\ + (abfd, section, reloc, shrink, link_info)) + +#define bfd_coff_classify_symbol(abfd, sym)\ + ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\ + (abfd, sym)) + +#define bfd_coff_compute_section_file_positions(abfd)\ + ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\ + (abfd)) + +#define bfd_coff_start_final_link(obfd, info)\ + ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\ + (obfd, info)) +#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\ + ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\ + (obfd, info, ibfd, o, con, rel, isyms, secs)) +#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\ + ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\ + (abfd, sec, rel, h, sym, addendp)) +#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\ + ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\ + (obfd, info, ibfd, sec, rel, adjustedp)) +#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\ + value, string, cp, coll, hashp)\ + ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\ + (info, abfd, name, flags, section, value, string, cp, coll, hashp)) + +#define bfd_coff_link_output_has_begun(a,p) \ + ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a, p)) +#define bfd_coff_final_link_postscript(a,p) \ + ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a, p)) + +#define bfd_coff_have_print_pdata(a) \ + (coff_backend_info (a)->_bfd_coff_print_pdata) +#define bfd_coff_print_pdata(a,p) \ + ((coff_backend_info (a)->_bfd_coff_print_pdata) (a, p)) + +/* Macro: Returns true if the bfd is a PE executable as opposed to a + PE object file. */ +#define bfd_pei_p(abfd) \ + (CONST_STRNEQ ((abfd)->xvec->name, "pei-")) +@end example +@subsubsection Writing relocations +To write relocations, the back end steps though the +canonical relocation table and create an +@code{internal_reloc}. The symbol index to use is removed from +the @code{offset} field in the symbol table supplied. The +address comes directly from the sum of the section base +address and the relocation offset; the type is dug directly +from the howto field. Then the @code{internal_reloc} is +swapped into the shape of an @code{external_reloc} and written +out to disk. + +@subsubsection Reading linenumbers +Creating the linenumber table is done by reading in the entire +coff linenumber table, and creating another table for internal use. + +A coff linenumber table is structured so that each function +is marked as having a line number of 0. Each line within the +function is an offset from the first line in the function. The +base of the line number information for the table is stored in +the symbol associated with the function. + +Note: The PE format uses line number 0 for a flag indicating a +new source file. + +The information is copied from the external to the internal +table, and each symbol which marks a function is marked by +pointing its... + +How does this work ? + +@subsubsection Reading relocations +Coff relocations are easily transformed into the internal BFD form +(@code{arelent}). + +Reading a coff relocation table is done in the following stages: + +@itemize @bullet + +@item +Read the entire coff relocation table into memory. + +@item +Process each relocation in turn; first swap it from the +external to the internal form. + +@item +Turn the symbol referenced in the relocation's symbol index +into a pointer into the canonical symbol table. +This table is the same as the one returned by a call to +@code{bfd_canonicalize_symtab}. The back end will call that +routine and save the result if a canonicalization hasn't been done. + +@item +The reloc index is turned into a pointer to a howto +structure, in a back end specific way. For instance, the 386 +uses the @code{r_type} to directly produce an index +into a howto table vector. +@end itemize + diff --git a/gdb-8.3.1/bfd/doc/core.texi b/gdb-8.3.1/bfd/doc/core.texi new file mode 100644 index 0000000000000000000000000000000000000000..cd98c4ac4038a672bcfef057682b88aa2098a35e --- /dev/null +++ b/gdb-8.3.1/bfd/doc/core.texi @@ -0,0 +1,70 @@ +@section Core files + + +@subsection Core file functions + + +@strong{Description}@* +These are functions pertaining to core files. + +@findex bfd_core_file_failing_command +@subsubsection @code{bfd_core_file_failing_command} +@strong{Synopsis} +@example +const char *bfd_core_file_failing_command (bfd *abfd); +@end example +@strong{Description}@* +Return a read-only string explaining which program was running +when it failed and produced the core file @var{abfd}. + +@findex bfd_core_file_failing_signal +@subsubsection @code{bfd_core_file_failing_signal} +@strong{Synopsis} +@example +int bfd_core_file_failing_signal (bfd *abfd); +@end example +@strong{Description}@* +Returns the signal number which caused the core dump which +generated the file the BFD @var{abfd} is attached to. + +@findex bfd_core_file_pid +@subsubsection @code{bfd_core_file_pid} +@strong{Synopsis} +@example +int bfd_core_file_pid (bfd *abfd); +@end example +@strong{Description}@* +Returns the PID of the process the core dump the BFD +@var{abfd} is attached to was generated from. + +@findex core_file_matches_executable_p +@subsubsection @code{core_file_matches_executable_p} +@strong{Synopsis} +@example +bfd_boolean core_file_matches_executable_p + (bfd *core_bfd, bfd *exec_bfd); +@end example +@strong{Description}@* +Return @code{TRUE} if the core file attached to @var{core_bfd} +was generated by a run of the executable file attached to +@var{exec_bfd}, @code{FALSE} otherwise. + +@findex generic_core_file_matches_executable_p +@subsubsection @code{generic_core_file_matches_executable_p} +@strong{Synopsis} +@example +bfd_boolean generic_core_file_matches_executable_p + (bfd *core_bfd, bfd *exec_bfd); +@end example +@strong{Description}@* +Return TRUE if the core file attached to @var{core_bfd} +was generated by a run of the executable file attached +to @var{exec_bfd}. The match is based on executable +basenames only. + +Note: When not able to determine the core file failing +command or the executable name, we still return TRUE even +though we're not sure that core file and executable match. +This is to avoid generating a false warning in situations +where we really don't know whether they match or not. + diff --git a/gdb-8.3.1/bfd/doc/elf.texi b/gdb-8.3.1/bfd/doc/elf.texi new file mode 100644 index 0000000000000000000000000000000000000000..40533860c858dd2eeb47317d0a443637c76c3a88 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/elf.texi @@ -0,0 +1,9 @@ +@section ELF backends +BFD support for ELF formats is being worked on. +Currently, the best supported back ends are for sparc and i386 +(running svr4 or Solaris 2). + +Documentation of the internals of the support code still needs +to be written. The code is changing quickly enough that we +haven't bothered yet. + diff --git a/gdb-8.3.1/bfd/doc/elfcode.texi b/gdb-8.3.1/bfd/doc/elfcode.texi new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/gdb-8.3.1/bfd/doc/format.texi b/gdb-8.3.1/bfd/doc/format.texi new file mode 100644 index 0000000000000000000000000000000000000000..9674acff440ba827221ffccc63969bf80f06ad1c --- /dev/null +++ b/gdb-8.3.1/bfd/doc/format.texi @@ -0,0 +1,112 @@ +@section File formats +A format is a BFD concept of high level file contents type. The +formats supported by BFD are: + +@itemize @bullet + +@item +@code{bfd_object} +@end itemize +The BFD may contain data, symbols, relocations and debug info. + +@itemize @bullet + +@item +@code{bfd_archive} +@end itemize +The BFD contains other BFDs and an optional index. + +@itemize @bullet + +@item +@code{bfd_core} +@end itemize +The BFD contains the result of an executable core dump. + +@subsection File format functions + + +@findex bfd_check_format +@subsubsection @code{bfd_check_format} +@strong{Synopsis} +@example +bfd_boolean bfd_check_format (bfd *abfd, bfd_format format); +@end example +@strong{Description}@* +Verify if the file attached to the BFD @var{abfd} is compatible +with the format @var{format} (i.e., one of @code{bfd_object}, +@code{bfd_archive} or @code{bfd_core}). + +If the BFD has been set to a specific target before the +call, only the named target and format combination is +checked. If the target has not been set, or has been set to +@code{default}, then all the known target backends is +interrogated to determine a match. If the default target +matches, it is used. If not, exactly one target must recognize +the file, or an error results. + +The function returns @code{TRUE} on success, otherwise @code{FALSE} +with one of the following error codes: + +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - +if @code{format} is not one of @code{bfd_object}, @code{bfd_archive} or +@code{bfd_core}. + +@item +@code{bfd_error_system_call} - +if an error occured during a read - even some file mismatches +can cause bfd_error_system_calls. + +@item +@code{file_not_recognised} - +none of the backends recognised the file format. + +@item +@code{bfd_error_file_ambiguously_recognized} - +more than one backend recognised the file format. +@end itemize + +@findex bfd_check_format_matches +@subsubsection @code{bfd_check_format_matches} +@strong{Synopsis} +@example +bfd_boolean bfd_check_format_matches + (bfd *abfd, bfd_format format, char ***matching); +@end example +@strong{Description}@* +Like @code{bfd_check_format}, except when it returns FALSE with +@code{bfd_errno} set to @code{bfd_error_file_ambiguously_recognized}. In that +case, if @var{matching} is not NULL, it will be filled in with +a NULL-terminated list of the names of the formats that matched, +allocated with @code{malloc}. +Then the user may choose a format and try again. + +When done with the list that @var{matching} points to, the caller +should free it. + +@findex bfd_set_format +@subsubsection @code{bfd_set_format} +@strong{Synopsis} +@example +bfd_boolean bfd_set_format (bfd *abfd, bfd_format format); +@end example +@strong{Description}@* +This function sets the file format of the BFD @var{abfd} to the +format @var{format}. If the target set in the BFD does not +support the format requested, the format is invalid, or the BFD +is not open for writing, then an error occurs. + +@findex bfd_format_string +@subsubsection @code{bfd_format_string} +@strong{Synopsis} +@example +const char *bfd_format_string (bfd_format format); +@end example +@strong{Description}@* +Return a pointer to a const string +@code{invalid}, @code{object}, @code{archive}, @code{core}, or @code{unknown}, +depending upon the value of @var{format}. + diff --git a/gdb-8.3.1/bfd/doc/hash.texi b/gdb-8.3.1/bfd/doc/hash.texi new file mode 100644 index 0000000000000000000000000000000000000000..f3096ceec67585efe01cb844bad414487f5b7b48 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/hash.texi @@ -0,0 +1,247 @@ +@section Hash Tables +@cindex Hash tables +BFD provides a simple set of hash table functions. Routines +are provided to initialize a hash table, to free a hash table, +to look up a string in a hash table and optionally create an +entry for it, and to traverse a hash table. There is +currently no routine to delete an string from a hash table. + +The basic hash table does not permit any data to be stored +with a string. However, a hash table is designed to present a +base class from which other types of hash tables may be +derived. These derived types may store additional information +with the string. Hash tables were implemented in this way, +rather than simply providing a data pointer in a hash table +entry, because they were designed for use by the linker back +ends. The linker may create thousands of hash table entries, +and the overhead of allocating private data and storing and +following pointers becomes noticeable. + +The basic hash table code is in @code{hash.c}. + +@menu +* Creating and Freeing a Hash Table:: +* Looking Up or Entering a String:: +* Traversing a Hash Table:: +* Deriving a New Hash Table Type:: +@end menu + +@node Creating and Freeing a Hash Table, Looking Up or Entering a String, Hash Tables, Hash Tables +@subsection Creating and freeing a hash table +@findex bfd_hash_table_init +@findex bfd_hash_table_init_n +To create a hash table, create an instance of a @code{struct +bfd_hash_table} (defined in @code{bfd.h}) and call +@code{bfd_hash_table_init} (if you know approximately how many +entries you will need, the function @code{bfd_hash_table_init_n}, +which takes a @var{size} argument, may be used). +@code{bfd_hash_table_init} returns @code{FALSE} if some sort of +error occurs. + +@findex bfd_hash_newfunc +The function @code{bfd_hash_table_init} take as an argument a +function to use to create new entries. For a basic hash +table, use the function @code{bfd_hash_newfunc}. @xref{Deriving +a New Hash Table Type}, for why you would want to use a +different value for this argument. + +@findex bfd_hash_allocate +@code{bfd_hash_table_init} will create an objalloc which will be +used to allocate new entries. You may allocate memory on this +objalloc using @code{bfd_hash_allocate}. + +@findex bfd_hash_table_free +Use @code{bfd_hash_table_free} to free up all the memory that has +been allocated for a hash table. This will not free up the +@code{struct bfd_hash_table} itself, which you must provide. + +@findex bfd_hash_set_default_size +Use @code{bfd_hash_set_default_size} to set the default size of +hash table to use. + +@node Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables +@subsection Looking up or entering a string +@findex bfd_hash_lookup +The function @code{bfd_hash_lookup} is used both to look up a +string in the hash table and to create a new entry. + +If the @var{create} argument is @code{FALSE}, @code{bfd_hash_lookup} +will look up a string. If the string is found, it will +returns a pointer to a @code{struct bfd_hash_entry}. If the +string is not found in the table @code{bfd_hash_lookup} will +return @code{NULL}. You should not modify any of the fields in +the returns @code{struct bfd_hash_entry}. + +If the @var{create} argument is @code{TRUE}, the string will be +entered into the hash table if it is not already there. +Either way a pointer to a @code{struct bfd_hash_entry} will be +returned, either to the existing structure or to a newly +created one. In this case, a @code{NULL} return means that an +error occurred. + +If the @var{create} argument is @code{TRUE}, and a new entry is +created, the @var{copy} argument is used to decide whether to +copy the string onto the hash table objalloc or not. If +@var{copy} is passed as @code{FALSE}, you must be careful not to +deallocate or modify the string as long as the hash table +exists. + +@node Traversing a Hash Table, Deriving a New Hash Table Type, Looking Up or Entering a String, Hash Tables +@subsection Traversing a hash table +@findex bfd_hash_traverse +The function @code{bfd_hash_traverse} may be used to traverse a +hash table, calling a function on each element. The traversal +is done in a random order. + +@code{bfd_hash_traverse} takes as arguments a function and a +generic @code{void *} pointer. The function is called with a +hash table entry (a @code{struct bfd_hash_entry *}) and the +generic pointer passed to @code{bfd_hash_traverse}. The function +must return a @code{boolean} value, which indicates whether to +continue traversing the hash table. If the function returns +@code{FALSE}, @code{bfd_hash_traverse} will stop the traversal and +return immediately. + +@node Deriving a New Hash Table Type, , Traversing a Hash Table, Hash Tables +@subsection Deriving a new hash table type +Many uses of hash tables want to store additional information +which each entry in the hash table. Some also find it +convenient to store additional information with the hash table +itself. This may be done using a derived hash table. + +Since C is not an object oriented language, creating a derived +hash table requires sticking together some boilerplate +routines with a few differences specific to the type of hash +table you want to create. + +An example of a derived hash table is the linker hash table. +The structures for this are defined in @code{bfdlink.h}. The +functions are in @code{linker.c}. + +You may also derive a hash table from an already derived hash +table. For example, the a.out linker backend code uses a hash +table derived from the linker hash table. + +@menu +* Define the Derived Structures:: +* Write the Derived Creation Routine:: +* Write Other Derived Routines:: +@end menu + +@node Define the Derived Structures, Write the Derived Creation Routine, Deriving a New Hash Table Type, Deriving a New Hash Table Type +@subsubsection Define the derived structures +You must define a structure for an entry in the hash table, +and a structure for the hash table itself. + +The first field in the structure for an entry in the hash +table must be of the type used for an entry in the hash table +you are deriving from. If you are deriving from a basic hash +table this is @code{struct bfd_hash_entry}, which is defined in +@code{bfd.h}. The first field in the structure for the hash +table itself must be of the type of the hash table you are +deriving from itself. If you are deriving from a basic hash +table, this is @code{struct bfd_hash_table}. + +For example, the linker hash table defines @code{struct +bfd_link_hash_entry} (in @code{bfdlink.h}). The first field, +@code{root}, is of type @code{struct bfd_hash_entry}. Similarly, +the first field in @code{struct bfd_link_hash_table}, @code{table}, +is of type @code{struct bfd_hash_table}. + +@node Write the Derived Creation Routine, Write Other Derived Routines, Define the Derived Structures, Deriving a New Hash Table Type +@subsubsection Write the derived creation routine +You must write a routine which will create and initialize an +entry in the hash table. This routine is passed as the +function argument to @code{bfd_hash_table_init}. + +In order to permit other hash tables to be derived from the +hash table you are creating, this routine must be written in a +standard way. + +The first argument to the creation routine is a pointer to a +hash table entry. This may be @code{NULL}, in which case the +routine should allocate the right amount of space. Otherwise +the space has already been allocated by a hash table type +derived from this one. + +After allocating space, the creation routine must call the +creation routine of the hash table type it is derived from, +passing in a pointer to the space it just allocated. This +will initialize any fields used by the base hash table. + +Finally the creation routine must initialize any local fields +for the new hash table type. + +Here is a boilerplate example of a creation routine. +@var{function_name} is the name of the routine. +@var{entry_type} is the type of an entry in the hash table you +are creating. @var{base_newfunc} is the name of the creation +routine of the hash table type your hash table is derived +from. + + +@example +struct bfd_hash_entry * +@var{function_name} (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) +@{ + struct @var{entry_type} *ret = (@var{entry_type} *) entry; + + /* Allocate the structure if it has not already been allocated by a + derived class. */ + if (ret == NULL) + @{ + ret = bfd_hash_allocate (table, sizeof (* ret)); + if (ret == NULL) + return NULL; + @} + + /* Call the allocation method of the base class. */ + ret = ((@var{entry_type} *) + @var{base_newfunc} ((struct bfd_hash_entry *) ret, table, string)); + + /* Initialize the local fields here. */ + + return (struct bfd_hash_entry *) ret; +@} +@end example +@strong{Description}@* +The creation routine for the linker hash table, which is in +@code{linker.c}, looks just like this example. +@var{function_name} is @code{_bfd_link_hash_newfunc}. +@var{entry_type} is @code{struct bfd_link_hash_entry}. +@var{base_newfunc} is @code{bfd_hash_newfunc}, the creation +routine for a basic hash table. + +@code{_bfd_link_hash_newfunc} also initializes the local fields +in a linker hash table entry: @code{type}, @code{written} and +@code{next}. + +@node Write Other Derived Routines, , Write the Derived Creation Routine, Deriving a New Hash Table Type +@subsubsection Write other derived routines +You will want to write other routines for your new hash table, +as well. + +You will want an initialization routine which calls the +initialization routine of the hash table you are deriving from +and initializes any other local fields. For the linker hash +table, this is @code{_bfd_link_hash_table_init} in @code{linker.c}. + +You will want a lookup routine which calls the lookup routine +of the hash table you are deriving from and casts the result. +The linker hash table uses @code{bfd_link_hash_lookup} in +@code{linker.c} (this actually takes an additional argument which +it uses to decide how to return the looked up value). + +You may want a traversal routine. This should just call the +traversal routine of the hash table you are deriving from with +appropriate casts. The linker hash table uses +@code{bfd_link_hash_traverse} in @code{linker.c}. + +These routines may simply be defined as macros. For example, +the a.out backend linker hash table, which is derived from the +linker hash table, uses macros for the lookup and traversal +routines. These are @code{aout_link_hash_lookup} and +@code{aout_link_hash_traverse} in aoutx.h. + diff --git a/gdb-8.3.1/bfd/doc/init.texi b/gdb-8.3.1/bfd/doc/init.texi new file mode 100644 index 0000000000000000000000000000000000000000..68352db13c4b6f16d1d4981b3e3ad433336278c0 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/init.texi @@ -0,0 +1,24 @@ +@section Initialization + + +@subsection Initialization functions +These are the functions that handle initializing a BFD. + +@findex bfd_init +@subsubsection @code{bfd_init} +@strong{Synopsis} +@example +unsigned int bfd_init (void); +@end example +@strong{Description}@* +This routine must be called before any other BFD function to +initialize magical internal data structures. +Returns a magic number, which may be used to check +that the bfd library is configured as expected by users. +@example + +/* Value returned by bfd_init. */ + +#define BFD_INIT_MAGIC (sizeof (struct bfd_section)) +@end example + diff --git a/gdb-8.3.1/bfd/doc/libbfd.texi b/gdb-8.3.1/bfd/doc/libbfd.texi new file mode 100644 index 0000000000000000000000000000000000000000..201355b859f688466f03ec01e934ebdd95d8f792 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/libbfd.texi @@ -0,0 +1,193 @@ +@section Implementation details + + +@subsection Internal functions + + +@strong{Description}@* +These routines are used within BFD. +They are not intended for export, but are documented here for +completeness. + +@findex bfd_write_bigendian_4byte_int +@subsubsection @code{bfd_write_bigendian_4byte_int} +@strong{Synopsis} +@example +bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int); +@end example +@strong{Description}@* +Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big +endian order regardless of what else is going on. This is useful in +archives. + +@findex bfd_put_size +@subsubsection @code{bfd_put_size} +@findex bfd_get_size +@subsubsection @code{bfd_get_size} +@strong{Description}@* +These macros as used for reading and writing raw data in +sections; each access (except for bytes) is vectored through +the target format of the BFD and mangled accordingly. The +mangling performs any necessary endian translations and +removes alignment restrictions. Note that types accepted and +returned by these macros are identical so they can be swapped +around in macros---for example, @file{libaout.h} defines @code{GET_WORD} +to either @code{bfd_get_32} or @code{bfd_get_64}. + +In the put routines, @var{val} must be a @code{bfd_vma}. If we are on a +system without prototypes, the caller is responsible for making +sure that is true, with a cast if necessary. We don't cast +them in the macro definitions because that would prevent @code{lint} +or @code{gcc -Wall} from detecting sins such as passing a pointer. +To detect calling these with less than a @code{bfd_vma}, use +@code{gcc -Wconversion} on a host with 64 bit @code{bfd_vma}'s. +@example + +/* Byte swapping macros for user section data. */ + +#define bfd_put_8(abfd, val, ptr) \ + ((void) (*((unsigned char *) (ptr)) = (val) & 0xff)) +#define bfd_put_signed_8 \ + bfd_put_8 +#define bfd_get_8(abfd, ptr) \ + (*(const unsigned char *) (ptr) & 0xff) +#define bfd_get_signed_8(abfd, ptr) \ + (((*(const unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) + +#define bfd_put_16(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_putx16, ((val),(ptr))) +#define bfd_put_signed_16 \ + bfd_put_16 +#define bfd_get_16(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx16, (ptr)) +#define bfd_get_signed_16(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) + +#define bfd_put_24(abfd, val, ptr) \ + do \ + if (bfd_big_endian (abfd)) \ + bfd_putb24 ((val), (ptr)); \ + else \ + bfd_putl24 ((val), (ptr)); \ + while (0) + +bfd_vma bfd_getb24 (const void *p); +bfd_vma bfd_getl24 (const void *p); + +#define bfd_get_24(abfd, ptr) \ + (bfd_big_endian (abfd) ? bfd_getb24 (ptr) : bfd_getl24 (ptr)) + +#define bfd_put_32(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_putx32, ((val),(ptr))) +#define bfd_put_signed_32 \ + bfd_put_32 +#define bfd_get_32(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx32, (ptr)) +#define bfd_get_signed_32(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx_signed_32, (ptr)) + +#define bfd_put_64(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_putx64, ((val), (ptr))) +#define bfd_put_signed_64 \ + bfd_put_64 +#define bfd_get_64(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx64, (ptr)) +#define bfd_get_signed_64(abfd, ptr) \ + BFD_SEND (abfd, bfd_getx_signed_64, (ptr)) + +#define bfd_get(bits, abfd, ptr) \ + ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ + : (bits) == 16 ? bfd_get_16 (abfd, ptr) \ + : (bits) == 32 ? bfd_get_32 (abfd, ptr) \ + : (bits) == 64 ? bfd_get_64 (abfd, ptr) \ + : (abort (), (bfd_vma) - 1)) + +#define bfd_put(bits, abfd, val, ptr) \ + ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ + : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ + : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ + : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ + : (abort (), (void) 0)) + +@end example + +@findex bfd_h_put_size +@subsubsection @code{bfd_h_put_size} +@strong{Description}@* +These macros have the same function as their @code{bfd_get_x} +brethren, except that they are used for removing information +for the header records of object files. Believe it or not, +some object files keep their header records in big endian +order and their data in little endian order. +@example + +/* Byte swapping macros for file header data. */ + +#define bfd_h_put_8(abfd, val, ptr) \ + bfd_put_8 (abfd, val, ptr) +#define bfd_h_put_signed_8(abfd, val, ptr) \ + bfd_put_8 (abfd, val, ptr) +#define bfd_h_get_8(abfd, ptr) \ + bfd_get_8 (abfd, ptr) +#define bfd_h_get_signed_8(abfd, ptr) \ + bfd_get_signed_8 (abfd, ptr) + +#define bfd_h_put_16(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_h_putx16, (val, ptr)) +#define bfd_h_put_signed_16 \ + bfd_h_put_16 +#define bfd_h_get_16(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx16, (ptr)) +#define bfd_h_get_signed_16(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr)) + +#define bfd_h_put_32(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_h_putx32, (val, ptr)) +#define bfd_h_put_signed_32 \ + bfd_h_put_32 +#define bfd_h_get_32(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx32, (ptr)) +#define bfd_h_get_signed_32(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr)) + +#define bfd_h_put_64(abfd, val, ptr) \ + BFD_SEND (abfd, bfd_h_putx64, (val, ptr)) +#define bfd_h_put_signed_64 \ + bfd_h_put_64 +#define bfd_h_get_64(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx64, (ptr)) +#define bfd_h_get_signed_64(abfd, ptr) \ + BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr)) + +/* Aliases for the above, which should eventually go away. */ + +#define H_PUT_64 bfd_h_put_64 +#define H_PUT_32 bfd_h_put_32 +#define H_PUT_16 bfd_h_put_16 +#define H_PUT_8 bfd_h_put_8 +#define H_PUT_S64 bfd_h_put_signed_64 +#define H_PUT_S32 bfd_h_put_signed_32 +#define H_PUT_S16 bfd_h_put_signed_16 +#define H_PUT_S8 bfd_h_put_signed_8 +#define H_GET_64 bfd_h_get_64 +#define H_GET_32 bfd_h_get_32 +#define H_GET_16 bfd_h_get_16 +#define H_GET_8 bfd_h_get_8 +#define H_GET_S64 bfd_h_get_signed_64 +#define H_GET_S32 bfd_h_get_signed_32 +#define H_GET_S16 bfd_h_get_signed_16 +#define H_GET_S8 bfd_h_get_signed_8 + + +@end example + +@findex bfd_log2 +@subsubsection @code{bfd_log2} +@strong{Synopsis} +@example +unsigned int bfd_log2 (bfd_vma x); +@end example +@strong{Description}@* +Return the log base 2 of the value supplied, rounded up. E.g., an +@var{x} of 1025 returns 11. A @var{x} of 0 returns 0. + diff --git a/gdb-8.3.1/bfd/doc/linker.texi b/gdb-8.3.1/bfd/doc/linker.texi new file mode 100644 index 0000000000000000000000000000000000000000..11d7143e8e5e8717f1d3562893a862c5735e2c17 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/linker.texi @@ -0,0 +1,517 @@ +@section Linker Functions +@cindex Linker +The linker uses three special entry points in the BFD target +vector. It is not necessary to write special routines for +these entry points when creating a new BFD back end, since +generic versions are provided. However, writing them can +speed up linking and make it use significantly less runtime +memory. + +The first routine creates a hash table used by the other +routines. The second routine adds the symbols from an object +file to the hash table. The third routine takes all the +object files and links them together to create the output +file. These routines are designed so that the linker proper +does not need to know anything about the symbols in the object +files that it is linking. The linker merely arranges the +sections as directed by the linker script and lets BFD handle +the details of symbols and relocs. + +The second routine and third routines are passed a pointer to +a @code{struct bfd_link_info} structure (defined in +@code{bfdlink.h}) which holds information relevant to the link, +including the linker hash table (which was created by the +first routine) and a set of callback functions to the linker +proper. + +The generic linker routines are in @code{linker.c}, and use the +header file @code{genlink.h}. As of this writing, the only back +ends which have implemented versions of these routines are +a.out (in @code{aoutx.h}) and ECOFF (in @code{ecoff.c}). The a.out +routines are used as examples throughout this section. + +@menu +* Creating a Linker Hash Table:: +* Adding Symbols to the Hash Table:: +* Performing the Final Link:: +@end menu + +@node Creating a Linker Hash Table, Adding Symbols to the Hash Table, Linker Functions, Linker Functions +@subsection Creating a linker hash table +@cindex _bfd_link_hash_table_create in target vector +@cindex target vector (_bfd_link_hash_table_create) +The linker routines must create a hash table, which must be +derived from @code{struct bfd_link_hash_table} described in +@code{bfdlink.c}. @xref{Hash Tables}, for information on how to +create a derived hash table. This entry point is called using +the target vector of the linker output file. + +The @code{_bfd_link_hash_table_create} entry point must allocate +and initialize an instance of the desired hash table. If the +back end does not require any additional information to be +stored with the entries in the hash table, the entry point may +simply create a @code{struct bfd_link_hash_table}. Most likely, +however, some additional information will be needed. + +For example, with each entry in the hash table the a.out +linker keeps the index the symbol has in the final output file +(this index number is used so that when doing a relocatable +link the symbol index used in the output file can be quickly +filled in when copying over a reloc). The a.out linker code +defines the required structures and functions for a hash table +derived from @code{struct bfd_link_hash_table}. The a.out linker +hash table is created by the function +@code{NAME(aout,link_hash_table_create)}; it simply allocates +space for the hash table, initializes it, and returns a +pointer to it. + +When writing the linker routines for a new back end, you will +generally not know exactly which fields will be required until +you have finished. You should simply create a new hash table +which defines no additional fields, and then simply add fields +as they become necessary. + +@node Adding Symbols to the Hash Table, Performing the Final Link, Creating a Linker Hash Table, Linker Functions +@subsection Adding symbols to the hash table +@cindex _bfd_link_add_symbols in target vector +@cindex target vector (_bfd_link_add_symbols) +The linker proper will call the @code{_bfd_link_add_symbols} +entry point for each object file or archive which is to be +linked (typically these are the files named on the command +line, but some may also come from the linker script). The +entry point is responsible for examining the file. For an +object file, BFD must add any relevant symbol information to +the hash table. For an archive, BFD must determine which +elements of the archive should be used and adding them to the +link. + +The a.out version of this entry point is +@code{NAME(aout,link_add_symbols)}. + +@menu +* Differing file formats:: +* Adding symbols from an object file:: +* Adding symbols from an archive:: +@end menu + +@node Differing file formats, Adding symbols from an object file, Adding Symbols to the Hash Table, Adding Symbols to the Hash Table +@subsubsection Differing file formats +Normally all the files involved in a link will be of the same +format, but it is also possible to link together different +format object files, and the back end must support that. The +@code{_bfd_link_add_symbols} entry point is called via the target +vector of the file to be added. This has an important +consequence: the function may not assume that the hash table +is the type created by the corresponding +@code{_bfd_link_hash_table_create} vector. All the +@code{_bfd_link_add_symbols} function can assume about the hash +table is that it is derived from @code{struct +bfd_link_hash_table}. + +Sometimes the @code{_bfd_link_add_symbols} function must store +some information in the hash table entry to be used by the +@code{_bfd_final_link} function. In such a case the output bfd +xvec must be checked to make sure that the hash table was +created by an object file of the same format. + +The @code{_bfd_final_link} routine must be prepared to handle a +hash entry without any extra information added by the +@code{_bfd_link_add_symbols} function. A hash entry without +extra information will also occur when the linker script +directs the linker to create a symbol. Note that, regardless +of how a hash table entry is added, all the fields will be +initialized to some sort of null value by the hash table entry +initialization function. + +See @code{ecoff_link_add_externals} for an example of how to +check the output bfd before saving information (in this +case, the ECOFF external symbol debugging information) in a +hash table entry. + +@node Adding symbols from an object file, Adding symbols from an archive, Differing file formats, Adding Symbols to the Hash Table +@subsubsection Adding symbols from an object file +When the @code{_bfd_link_add_symbols} routine is passed an object +file, it must add all externally visible symbols in that +object file to the hash table. The actual work of adding the +symbol to the hash table is normally handled by the function +@code{_bfd_generic_link_add_one_symbol}. The +@code{_bfd_link_add_symbols} routine is responsible for reading +all the symbols from the object file and passing the correct +information to @code{_bfd_generic_link_add_one_symbol}. + +The @code{_bfd_link_add_symbols} routine should not use +@code{bfd_canonicalize_symtab} to read the symbols. The point of +providing this routine is to avoid the overhead of converting +the symbols into generic @code{asymbol} structures. + +@findex _bfd_generic_link_add_one_symbol +@code{_bfd_generic_link_add_one_symbol} handles the details of +combining common symbols, warning about multiple definitions, +and so forth. It takes arguments which describe the symbol to +add, notably symbol flags, a section, and an offset. The +symbol flags include such things as @code{BSF_WEAK} or +@code{BSF_INDIRECT}. The section is a section in the object +file, or something like @code{bfd_und_section_ptr} for an undefined +symbol or @code{bfd_com_section_ptr} for a common symbol. + +If the @code{_bfd_final_link} routine is also going to need to +read the symbol information, the @code{_bfd_link_add_symbols} +routine should save it somewhere attached to the object file +BFD. However, the information should only be saved if the +@code{keep_memory} field of the @code{info} argument is TRUE, so +that the @code{-no-keep-memory} linker switch is effective. + +The a.out function which adds symbols from an object file is +@code{aout_link_add_object_symbols}, and most of the interesting +work is in @code{aout_link_add_symbols}. The latter saves +pointers to the hash tables entries created by +@code{_bfd_generic_link_add_one_symbol} indexed by symbol number, +so that the @code{_bfd_final_link} routine does not have to call +the hash table lookup routine to locate the entry. + +@node Adding symbols from an archive, , Adding symbols from an object file, Adding Symbols to the Hash Table +@subsubsection Adding symbols from an archive +When the @code{_bfd_link_add_symbols} routine is passed an +archive, it must look through the symbols defined by the +archive and decide which elements of the archive should be +included in the link. For each such element it must call the +@code{add_archive_element} linker callback, and it must add the +symbols from the object file to the linker hash table. (The +callback may in fact indicate that a replacement BFD should be +used, in which case the symbols from that BFD should be added +to the linker hash table instead.) + +@findex _bfd_generic_link_add_archive_symbols +In most cases the work of looking through the symbols in the +archive should be done by the +@code{_bfd_generic_link_add_archive_symbols} function. +@code{_bfd_generic_link_add_archive_symbols} is passed a function +to call to make the final decision about adding an archive +element to the link and to do the actual work of adding the +symbols to the linker hash table. If the element is to +be included, the @code{add_archive_element} linker callback +routine must be called with the element as an argument, and +the element's symbols must be added to the linker hash table +just as though the element had itself been passed to the +@code{_bfd_link_add_symbols} function. + +When the a.out @code{_bfd_link_add_symbols} function receives an +archive, it calls @code{_bfd_generic_link_add_archive_symbols} +passing @code{aout_link_check_archive_element} as the function +argument. @code{aout_link_check_archive_element} calls +@code{aout_link_check_ar_symbols}. If the latter decides to add +the element (an element is only added if it provides a real, +non-common, definition for a previously undefined or common +symbol) it calls the @code{add_archive_element} callback and then +@code{aout_link_check_archive_element} calls +@code{aout_link_add_symbols} to actually add the symbols to the +linker hash table - possibly those of a substitute BFD, if the +@code{add_archive_element} callback avails itself of that option. + +The ECOFF back end is unusual in that it does not normally +call @code{_bfd_generic_link_add_archive_symbols}, because ECOFF +archives already contain a hash table of symbols. The ECOFF +back end searches the archive itself to avoid the overhead of +creating a new hash table. + +@node Performing the Final Link, , Adding Symbols to the Hash Table, Linker Functions +@subsection Performing the final link +@cindex _bfd_link_final_link in target vector +@cindex target vector (_bfd_final_link) +When all the input files have been processed, the linker calls +the @code{_bfd_final_link} entry point of the output BFD. This +routine is responsible for producing the final output file, +which has several aspects. It must relocate the contents of +the input sections and copy the data into the output sections. +It must build an output symbol table including any local +symbols from the input files and the global symbols from the +hash table. When producing relocatable output, it must +modify the input relocs and write them into the output file. +There may also be object format dependent work to be done. + +The linker will also call the @code{write_object_contents} entry +point when the BFD is closed. The two entry points must work +together in order to produce the correct output file. + +The details of how this works are inevitably dependent upon +the specific object file format. The a.out +@code{_bfd_final_link} routine is @code{NAME(aout,final_link)}. + +@menu +* Information provided by the linker:: +* Relocating the section contents:: +* Writing the symbol table:: +@end menu + +@node Information provided by the linker, Relocating the section contents, Performing the Final Link, Performing the Final Link +@subsubsection Information provided by the linker +Before the linker calls the @code{_bfd_final_link} entry point, +it sets up some data structures for the function to use. + +The @code{input_bfds} field of the @code{bfd_link_info} structure +will point to a list of all the input files included in the +link. These files are linked through the @code{link.next} field +of the @code{bfd} structure. + +Each section in the output file will have a list of +@code{link_order} structures attached to the @code{map_head.link_order} +field (the @code{link_order} structure is defined in +@code{bfdlink.h}). These structures describe how to create the +contents of the output section in terms of the contents of +various input sections, fill constants, and, eventually, other +types of information. They also describe relocs that must be +created by the BFD backend, but do not correspond to any input +file; this is used to support -Ur, which builds constructors +while generating a relocatable object file. + +@node Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link +@subsubsection Relocating the section contents +The @code{_bfd_final_link} function should look through the +@code{link_order} structures attached to each section of the +output file. Each @code{link_order} structure should either be +handled specially, or it should be passed to the function +@code{_bfd_default_link_order} which will do the right thing +(@code{_bfd_default_link_order} is defined in @code{linker.c}). + +For efficiency, a @code{link_order} of type +@code{bfd_indirect_link_order} whose associated section belongs +to a BFD of the same format as the output BFD must be handled +specially. This type of @code{link_order} describes part of an +output section in terms of a section belonging to one of the +input files. The @code{_bfd_final_link} function should read the +contents of the section and any associated relocs, apply the +relocs to the section contents, and write out the modified +section contents. If performing a relocatable link, the +relocs themselves must also be modified and written out. + +@findex _bfd_relocate_contents +@findex _bfd_final_link_relocate +The functions @code{_bfd_relocate_contents} and +@code{_bfd_final_link_relocate} provide some general support for +performing the actual relocations, notably overflow checking. +Their arguments include information about the symbol the +relocation is against and a @code{reloc_howto_type} argument +which describes the relocation to perform. These functions +are defined in @code{reloc.c}. + +The a.out function which handles reading, relocating, and +writing section contents is @code{aout_link_input_section}. The +actual relocation is done in @code{aout_link_input_section_std} +and @code{aout_link_input_section_ext}. + +@node Writing the symbol table, , Relocating the section contents, Performing the Final Link +@subsubsection Writing the symbol table +The @code{_bfd_final_link} function must gather all the symbols +in the input files and write them out. It must also write out +all the symbols in the global hash table. This must be +controlled by the @code{strip} and @code{discard} fields of the +@code{bfd_link_info} structure. + +The local symbols of the input files will not have been +entered into the linker hash table. The @code{_bfd_final_link} +routine must consider each input file and include the symbols +in the output file. It may be convenient to do this when +looking through the @code{link_order} structures, or it may be +done by stepping through the @code{input_bfds} list. + +The @code{_bfd_final_link} routine must also traverse the global +hash table to gather all the externally visible symbols. It +is possible that most of the externally visible symbols may be +written out when considering the symbols of each input file, +but it is still necessary to traverse the hash table since the +linker script may have defined some symbols that are not in +any of the input files. + +The @code{strip} field of the @code{bfd_link_info} structure +controls which symbols are written out. The possible values +are listed in @code{bfdlink.h}. If the value is @code{strip_some}, +then the @code{keep_hash} field of the @code{bfd_link_info} +structure is a hash table of symbols to keep; each symbol +should be looked up in this hash table, and only symbols which +are present should be included in the output file. + +If the @code{strip} field of the @code{bfd_link_info} structure +permits local symbols to be written out, the @code{discard} field +is used to further controls which local symbols are included +in the output file. If the value is @code{discard_l}, then all +local symbols which begin with a certain prefix are discarded; +this is controlled by the @code{bfd_is_local_label_name} entry point. + +The a.out backend handles symbols by calling +@code{aout_link_write_symbols} on each input BFD and then +traversing the global hash table with the function +@code{aout_link_write_other_symbol}. It builds a string table +while writing out the symbols, which is written to the output +file at the end of @code{NAME(aout,final_link)}. + +@findex bfd_link_split_section +@subsubsection @code{bfd_link_split_section} +@strong{Synopsis} +@example +bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec); +@end example +@strong{Description}@* +Return nonzero if @var{sec} should be split during a +reloceatable or final link. +@example +#define bfd_link_split_section(abfd, sec) \ + BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec)) + +@end example + +@findex bfd_section_already_linked +@subsubsection @code{bfd_section_already_linked} +@strong{Synopsis} +@example +bfd_boolean bfd_section_already_linked (bfd *abfd, + asection *sec, + struct bfd_link_info *info); +@end example +@strong{Description}@* +Check if @var{data} has been already linked during a reloceatable +or final link. Return TRUE if it has. +@example +#define bfd_section_already_linked(abfd, sec, info) \ + BFD_SEND (abfd, _section_already_linked, (abfd, sec, info)) + +@end example + +@findex bfd_generic_define_common_symbol +@subsubsection @code{bfd_generic_define_common_symbol} +@strong{Synopsis} +@example +bfd_boolean bfd_generic_define_common_symbol + (bfd *output_bfd, struct bfd_link_info *info, + struct bfd_link_hash_entry *h); +@end example +@strong{Description}@* +Convert common symbol @var{h} into a defined symbol. +Return TRUE on success and FALSE on failure. +@example +#define bfd_define_common_symbol(output_bfd, info, h) \ + BFD_SEND (output_bfd, _bfd_define_common_symbol, (output_bfd, info, h)) + +@end example + +@findex _bfd_generic_link_hide_symbol +@subsubsection @code{_bfd_generic_link_hide_symbol} +@strong{Synopsis} +@example +void _bfd_generic_link_hide_symbol + (bfd *output_bfd, struct bfd_link_info *info, + struct bfd_link_hash_entry *h); +@end example +@strong{Description}@* +Hide symbol @var{h}. +This is an internal function. It should not be called from +outside the BFD library. +@example +#define bfd_link_hide_symbol(output_bfd, info, h) \ + BFD_SEND (output_bfd, _bfd_link_hide_symbol, (output_bfd, info, h)) + +@end example + +@findex bfd_generic_define_start_stop +@subsubsection @code{bfd_generic_define_start_stop} +@strong{Synopsis} +@example +struct bfd_link_hash_entry *bfd_generic_define_start_stop + (struct bfd_link_info *info, + const char *symbol, asection *sec); +@end example +@strong{Description}@* +Define a __start, __stop, .startof. or .sizeof. symbol. +Return the symbol or NULL if no such undefined symbol exists. +@example +#define bfd_define_start_stop(output_bfd, info, symbol, sec) \ + BFD_SEND (output_bfd, _bfd_define_start_stop, (info, symbol, sec)) + +@end example + +@findex bfd_find_version_for_sym +@subsubsection @code{bfd_find_version_for_sym} +@strong{Synopsis} +@example +struct bfd_elf_version_tree * bfd_find_version_for_sym + (struct bfd_elf_version_tree *verdefs, + const char *sym_name, bfd_boolean *hide); +@end example +@strong{Description}@* +Search an elf version script tree for symbol versioning +info and export / don't-export status for a given symbol. +Return non-NULL on success and NULL on failure; also sets +the output @samp{hide} boolean parameter. + +@findex bfd_hide_sym_by_version +@subsubsection @code{bfd_hide_sym_by_version} +@strong{Synopsis} +@example +bfd_boolean bfd_hide_sym_by_version + (struct bfd_elf_version_tree *verdefs, const char *sym_name); +@end example +@strong{Description}@* +Search an elf version script tree for symbol versioning +info for a given symbol. Return TRUE if the symbol is hidden. + +@findex bfd_link_check_relocs +@subsubsection @code{bfd_link_check_relocs} +@strong{Synopsis} +@example +bfd_boolean bfd_link_check_relocs + (bfd *abfd, struct bfd_link_info *info); +@end example +@strong{Description}@* +Checks the relocs in ABFD for validity. +Does not execute the relocs. +Return TRUE if everything is OK, FALSE otherwise. +This is the external entry point to this code. + +@findex _bfd_generic_link_check_relocs +@subsubsection @code{_bfd_generic_link_check_relocs} +@strong{Synopsis} +@example +bfd_boolean _bfd_generic_link_check_relocs + (bfd *abfd, struct bfd_link_info *info); +@end example +@strong{Description}@* +Stub function for targets that do not implement reloc checking. +Return TRUE. +This is an internal function. It should not be called from +outside the BFD library. + +@findex bfd_merge_private_bfd_data +@subsubsection @code{bfd_merge_private_bfd_data} +@strong{Synopsis} +@example +bfd_boolean bfd_merge_private_bfd_data + (bfd *ibfd, struct bfd_link_info *info); +@end example +@strong{Description}@* +Merge private BFD information from the BFD @var{ibfd} to the +the output file BFD when linking. Return @code{TRUE} on success, +@code{FALSE} on error. Possible error returns are: + +@itemize @bullet + +@item +@code{bfd_error_no_memory} - +Not enough memory exists to create private data for @var{obfd}. +@end itemize +@example +#define bfd_merge_private_bfd_data(ibfd, info) \ + BFD_SEND ((info)->output_bfd, _bfd_merge_private_bfd_data, \ + (ibfd, info)) +@end example + +@findex _bfd_generic_verify_endian_match +@subsubsection @code{_bfd_generic_verify_endian_match} +@strong{Synopsis} +@example +bfd_boolean _bfd_generic_verify_endian_match + (bfd *ibfd, struct bfd_link_info *info); +@end example +@strong{Description}@* +Can be used from / for bfd_merge_private_bfd_data to check that +endianness matches between input and output file. Returns +TRUE for a match, otherwise returns FALSE and emits an error. + diff --git a/gdb-8.3.1/bfd/doc/mmo.texi b/gdb-8.3.1/bfd/doc/mmo.texi new file mode 100644 index 0000000000000000000000000000000000000000..f9c23582d6eee4a524d31df56f250dcbea600406 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/mmo.texi @@ -0,0 +1,369 @@ +@section mmo backend +The mmo object format is used exclusively together with Professor +Donald E.@: Knuth's educational 64-bit processor MMIX. The simulator +@command{mmix} which is available at +@url{http://mmix.cs.hm.edu/src/index.html} +understands this format. That package also includes a combined +assembler and linker called @command{mmixal}. The mmo format has +no advantages feature-wise compared to e.g. ELF. It is a simple +non-relocatable object format with no support for archives or +debugging information, except for symbol value information and +line numbers (which is not yet implemented in BFD). See +@url{http://mmix.cs.hm.edu/} for more +information about MMIX. The ELF format is used for intermediate +object files in the BFD implementation. + +@c We want to xref the symbol table node. A feature in "chew" +@c requires that "commands" do not contain spaces in the +@c arguments. Hence the hyphen in "Symbol-table". +@menu +* File layout:: +* Symbol-table:: +* mmo section mapping:: +@end menu + +@node File layout, Symbol-table, mmo, mmo +@subsection File layout +The mmo file contents is not partitioned into named sections as +with e.g.@: ELF. Memory areas is formed by specifying the +location of the data that follows. Only the memory area +@samp{0x0000@dots{}00} to @samp{0x01ff@dots{}ff} is executable, so +it is used for code (and constants) and the area +@samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} is used for +writable data. @xref{mmo section mapping}. + +There is provision for specifying ``special data'' of 65536 +different types. We use type 80 (decimal), arbitrarily chosen the +same as the ELF @code{e_machine} number for MMIX, filling it with +section information normally found in ELF objects. @xref{mmo +section mapping}. + +Contents is entered as 32-bit words, xor:ed over previous +contents, always zero-initialized. A word that starts with the +byte @samp{0x98} forms a command called a @samp{lopcode}, where +the next byte distinguished between the thirteen lopcodes. The +two remaining bytes, called the @samp{Y} and @samp{Z} fields, or +the @samp{YZ} field (a 16-bit big-endian number), are used for +various purposes different for each lopcode. As documented in +@url{http://mmix.cs.hm.edu/doc/mmixal.pdf}, +the lopcodes are: + +@table @code +@item lop_quote +0x98000001. The next word is contents, regardless of whether it +starts with 0x98 or not. + +@item lop_loc +0x9801YYZZ, where @samp{Z} is 1 or 2. This is a location +directive, setting the location for the next data to the next +32-bit word (for @math{Z = 1}) or 64-bit word (for @math{Z = 2}), +plus @math{Y * 2^56}. Normally @samp{Y} is 0 for the text segment +and 2 for the data segment. Beware that the low bits of non- +tetrabyte-aligned values are silently discarded when being +automatically incremented and when storing contents (in contrast +to e.g. its use as current location when followed by lop_fixo +et al before the next possibly-quoted tetrabyte contents). + +@item lop_skip +0x9802YYZZ. Increase the current location by @samp{YZ} bytes. + +@item lop_fixo +0x9803YYZZ, where @samp{Z} is 1 or 2. Store the current location +as 64 bits into the location pointed to by the next 32-bit +(@math{Z = 1}) or 64-bit (@math{Z = 2}) word, plus @math{Y * +2^56}. + +@item lop_fixr +0x9804YYZZ. @samp{YZ} is stored into the current location plus +@math{2 - 4 * YZ}. + +@item lop_fixrx +0x980500ZZ. @samp{Z} is 16 or 24. A value @samp{L} derived from +the following 32-bit word are used in a manner similar to +@samp{YZ} in lop_fixr: it is xor:ed into the current location +minus @math{4 * L}. The first byte of the word is 0 or 1. If it +is 1, then @math{L = (@var{lowest 24 bits of word}) - 2^Z}, if 0, +then @math{L = (@var{lowest 24 bits of word})}. + +@item lop_file +0x9806YYZZ. @samp{Y} is the file number, @samp{Z} is count of +32-bit words. Set the file number to @samp{Y} and the line +counter to 0. The next @math{Z * 4} bytes contain the file name, +padded with zeros if the count is not a multiple of four. The +same @samp{Y} may occur multiple times, but @samp{Z} must be 0 for +all but the first occurrence. + +@item lop_line +0x9807YYZZ. @samp{YZ} is the line number. Together with +lop_file, it forms the source location for the next 32-bit word. +Note that for each non-lopcode 32-bit word, line numbers are +assumed incremented by one. + +@item lop_spec +0x9808YYZZ. @samp{YZ} is the type number. Data until the next +lopcode other than lop_quote forms special data of type @samp{YZ}. +@xref{mmo section mapping}. + +Other types than 80, (or type 80 with a content that does not +parse) is stored in sections named @code{.MMIX.spec_data.@var{n}} +where @var{n} is the @samp{YZ}-type. The flags for such a +sections say not to allocate or load the data. The vma is 0. +Contents of multiple occurrences of special data @var{n} is +concatenated to the data of the previous lop_spec @var{n}s. The +location in data or code at which the lop_spec occurred is lost. + +@item lop_pre +0x980901ZZ. The first lopcode in a file. The @samp{Z} field forms the +length of header information in 32-bit words, where the first word +tells the time in seconds since @samp{00:00:00 GMT Jan 1 1970}. + +@item lop_post +0x980a00ZZ. @math{Z > 32}. This lopcode follows after all +content-generating lopcodes in a program. The @samp{Z} field +denotes the value of @samp{rG} at the beginning of the program. +The following @math{256 - Z} big-endian 64-bit words are loaded +into global registers @samp{$G} @dots{} @samp{$255}. + +@item lop_stab +0x980b0000. The next-to-last lopcode in a program. Must follow +immediately after the lop_post lopcode and its data. After this +lopcode follows all symbols in a compressed format +(@pxref{Symbol-table}). + +@item lop_end +0x980cYYZZ. The last lopcode in a program. It must follow the +lop_stab lopcode and its data. The @samp{YZ} field contains the +number of 32-bit words of symbol table information after the +preceding lop_stab lopcode. +@end table + +Note that the lopcode "fixups"; @code{lop_fixr}, @code{lop_fixrx} and +@code{lop_fixo} are not generated by BFD, but are handled. They are +generated by @code{mmixal}. + +This trivial one-label, one-instruction file: + +@example + :Main TRAP 1,2,3 +@end example + +can be represented this way in mmo: + +@example + 0x98090101 - lop_pre, one 32-bit word with timestamp. + + 0x98010002 - lop_loc, text segment, using a 64-bit address. + Note that mmixal does not emit this for the file above. + 0x00000000 - Address, high 32 bits. + 0x00000000 - Address, low 32 bits. + 0x98060002 - lop_file, 2 32-bit words for file-name. + 0x74657374 - "test" + 0x2e730000 - ".s\0\0" + 0x98070001 - lop_line, line 1. + 0x00010203 - TRAP 1,2,3 + 0x980a00ff - lop_post, setting $255 to 0. + 0x00000000 + 0x00000000 + 0x980b0000 - lop_stab for ":Main" = 0, serial 1. + 0x203a4040 @xref{Symbol-table}. + 0x10404020 + 0x4d206120 + 0x69016e00 + 0x81000000 + 0x980c0005 - lop_end; symbol table contained five 32-bit words. +@end example +@node Symbol-table, mmo section mapping, File layout, mmo +@subsection Symbol table format +From mmixal.w (or really, the generated mmixal.tex) in the +MMIXware package which also contains the @command{mmix} simulator: +``Symbols are stored and retrieved by means of a @samp{ternary +search trie}, following ideas of Bentley and Sedgewick. (See +ACM--SIAM Symp.@: on Discrete Algorithms @samp{8} (1997), 360--369; +R.@:Sedgewick, @samp{Algorithms in C} (Reading, Mass.@: +Addison--Wesley, 1998), @samp{15.4}.) Each trie node stores a +character, and there are branches to subtries for the cases where +a given character is less than, equal to, or greater than the +character in the trie. There also is a pointer to a symbol table +entry if a symbol ends at the current node.'' + +So it's a tree encoded as a stream of bytes. The stream of bytes +acts on a single virtual global symbol, adding and removing +characters and signalling complete symbol points. Here, we read +the stream and create symbols at the completion points. + +First, there's a control byte @code{m}. If any of the listed bits +in @code{m} is nonzero, we execute what stands at the right, in +the listed order: + +@example + (MMO3_LEFT) + 0x40 - Traverse left trie. + (Read a new command byte and recurse.) + + (MMO3_SYMBITS) + 0x2f - Read the next byte as a character and store it in the + current character position; increment character position. + Test the bits of @code{m}: + + (MMO3_WCHAR) + 0x80 - The character is 16-bit (so read another byte, + merge into current character. + + (MMO3_TYPEBITS) + 0xf - We have a complete symbol; parse the type, value + and serial number and do what should be done + with a symbol. The type and length information + is in j = (m & 0xf). + + (MMO3_REGQUAL_BITS) + j == 0xf: A register variable. The following + byte tells which register. + j <= 8: An absolute symbol. Read j bytes as the + big-endian number the symbol equals. + A j = 2 with two zero bytes denotes an + unknown symbol. + j > 8: As with j <= 8, but add (0x20 << 56) + to the value in the following j - 8 + bytes. + + Then comes the serial number, as a variant of + uleb128, but better named ubeb128: + Read bytes and shift the previous value left 7 + (multiply by 128). Add in the new byte, repeat + until a byte has bit 7 set. The serial number + is the computed value minus 128. + + (MMO3_MIDDLE) + 0x20 - Traverse middle trie. (Read a new command byte + and recurse.) Decrement character position. + + (MMO3_RIGHT) + 0x10 - Traverse right trie. (Read a new command byte and + recurse.) +@end example + +Let's look again at the @code{lop_stab} for the trivial file +(@pxref{File layout}). + +@example + 0x980b0000 - lop_stab for ":Main" = 0, serial 1. + 0x203a4040 + 0x10404020 + 0x4d206120 + 0x69016e00 + 0x81000000 +@end example + +This forms the trivial trie (note that the path between ``:'' and +``M'' is redundant): + +@example + 203a ":" + 40 / + 40 / + 10 \ + 40 / + 40 / + 204d "M" + 2061 "a" + 2069 "i" + 016e "n" is the last character in a full symbol, and + with a value represented in one byte. + 00 The value is 0. + 81 The serial number is 1. +@end example + +@node mmo section mapping, , Symbol-table, mmo +@subsection mmo section mapping +The implementation in BFD uses special data type 80 (decimal) to +encapsulate and describe named sections, containing e.g.@: debug +information. If needed, any datum in the encapsulation will be +quoted using lop_quote. First comes a 32-bit word holding the +number of 32-bit words containing the zero-terminated zero-padded +segment name. After the name there's a 32-bit word holding flags +describing the section type. Then comes a 64-bit big-endian word +with the section length (in bytes), then another with the section +start address. Depending on the type of section, the contents +might follow, zero-padded to 32-bit boundary. For a loadable +section (such as data or code), the contents might follow at some +later point, not necessarily immediately, as a lop_loc with the +same start address as in the section description, followed by the +contents. This in effect forms a descriptor that must be emitted +before the actual contents. Sections described this way must not +overlap. + +For areas that don't have such descriptors, synthetic sections are +formed by BFD. Consecutive contents in the two memory areas +@samp{0x0000@dots{}00} to @samp{0x01ff@dots{}ff} and +@samp{0x2000@dots{}00} to @samp{0x20ff@dots{}ff} are entered in +sections named @code{.text} and @code{.data} respectively. If an area +is not otherwise described, but would together with a neighboring +lower area be less than @samp{0x40000000} bytes long, it is joined +with the lower area and the gap is zero-filled. For other cases, +a new section is formed, named @code{.MMIX.sec.@var{n}}. Here, +@var{n} is a number, a running count through the mmo file, +starting at 0. + +A loadable section specified as: + +@example + .section secname,"ax" + TETRA 1,2,3,4,-1,-2009 + BYTE 80 +@end example + +and linked to address @samp{0x4}, is represented by the sequence: + +@example + 0x98080050 - lop_spec 80 + 0x00000002 - two 32-bit words for the section name + 0x7365636e - "secn" + 0x616d6500 - "ame\0" + 0x00000033 - flags CODE, READONLY, LOAD, ALLOC + 0x00000000 - high 32 bits of section length + 0x0000001c - section length is 28 bytes; 6 * 4 + 1 + alignment to 32 bits + 0x00000000 - high 32 bits of section address + 0x00000004 - section address is 4 + 0x98010002 - 64 bits with address of following data + 0x00000000 - high 32 bits of address + 0x00000004 - low 32 bits: data starts at address 4 + 0x00000001 - 1 + 0x00000002 - 2 + 0x00000003 - 3 + 0x00000004 - 4 + 0xffffffff - -1 + 0xfffff827 - -2009 + 0x50000000 - 80 as a byte, padded with zeros. +@end example + +Note that the lop_spec wrapping does not include the section +contents. Compare this to a non-loaded section specified as: + +@example + .section thirdsec + TETRA 200001,100002 + BYTE 38,40 +@end example + +This, when linked to address @samp{0x200000000000001c}, is +represented by: + +@example + 0x98080050 - lop_spec 80 + 0x00000002 - two 32-bit words for the section name + 0x7365636e - "thir" + 0x616d6500 - "dsec" + 0x00000010 - flag READONLY + 0x00000000 - high 32 bits of section length + 0x0000000c - section length is 12 bytes; 2 * 4 + 2 + alignment to 32 bits + 0x20000000 - high 32 bits of address + 0x0000001c - low 32 bits of address 0x200000000000001c + 0x00030d41 - 200001 + 0x000186a2 - 100002 + 0x26280000 - 38, 40 as bytes, padded with zeros +@end example + +For the latter example, the section contents must not be +loaded in memory, and is therefore specified as part of the +special data. The address is usually unimportant but might +provide information for e.g.@: the DWARF 2 debugging format. diff --git a/gdb-8.3.1/bfd/doc/opncls.texi b/gdb-8.3.1/bfd/doc/opncls.texi new file mode 100644 index 0000000000000000000000000000000000000000..e3f5b995bfeefbbde89b47f404ca14a6b8a5ea24 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/opncls.texi @@ -0,0 +1,576 @@ + +@example +/* Set to N to open the next N BFDs using an alternate id space. */ +extern unsigned int bfd_use_reserved_id; +@end example +@section Opening and closing BFDs + + +@subsection Functions for opening and closing + + +@findex bfd_fopen +@subsubsection @code{bfd_fopen} +@strong{Synopsis} +@example +bfd *bfd_fopen (const char *filename, const char *target, + const char *mode, int fd); +@end example +@strong{Description}@* +Open the file @var{filename} with the target @var{target}. +Return a pointer to the created BFD. If @var{fd} is not -1, +then @code{fdopen} is used to open the file; otherwise, @code{fopen} +is used. @var{mode} is passed directly to @code{fopen} or +@code{fdopen}. + +Calls @code{bfd_find_target}, so @var{target} is interpreted as by +that function. + +The new BFD is marked as cacheable iff @var{fd} is -1. + +If @code{NULL} is returned then an error has occured. Possible errors +are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or +@code{system_call} error. + +On error, @var{fd} is always closed. + +A copy of the @var{filename} argument is stored in the newly created +BFD. It can be accessed via the bfd_get_filename() macro. + +@findex bfd_openr +@subsubsection @code{bfd_openr} +@strong{Synopsis} +@example +bfd *bfd_openr (const char *filename, const char *target); +@end example +@strong{Description}@* +Open the file @var{filename} (using @code{fopen}) with the target +@var{target}. Return a pointer to the created BFD. + +Calls @code{bfd_find_target}, so @var{target} is interpreted as by +that function. + +If @code{NULL} is returned then an error has occured. Possible errors +are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or +@code{system_call} error. + +A copy of the @var{filename} argument is stored in the newly created +BFD. It can be accessed via the bfd_get_filename() macro. + +@findex bfd_fdopenr +@subsubsection @code{bfd_fdopenr} +@strong{Synopsis} +@example +bfd *bfd_fdopenr (const char *filename, const char *target, int fd); +@end example +@strong{Description}@* +@code{bfd_fdopenr} is to @code{bfd_fopenr} much like @code{fdopen} is to +@code{fopen}. It opens a BFD on a file already described by the +@var{fd} supplied. + +When the file is later @code{bfd_close}d, the file descriptor will +be closed. If the caller desires that this file descriptor be +cached by BFD (opened as needed, closed as needed to free +descriptors for other opens), with the supplied @var{fd} used as +an initial file descriptor (but subject to closure at any time), +call bfd_set_cacheable(bfd, 1) on the returned BFD. The default +is to assume no caching; the file descriptor will remain open +until @code{bfd_close}, and will not be affected by BFD operations +on other files. + +Possible errors are @code{bfd_error_no_memory}, +@code{bfd_error_invalid_target} and @code{bfd_error_system_call}. + +On error, @var{fd} is closed. + +A copy of the @var{filename} argument is stored in the newly created +BFD. It can be accessed via the bfd_get_filename() macro. + +@findex bfd_openstreamr +@subsubsection @code{bfd_openstreamr} +@strong{Synopsis} +@example +bfd *bfd_openstreamr (const char * filename, const char * target, + void * stream); +@end example +@strong{Description}@* +Open a BFD for read access on an existing stdio stream. When +the BFD is passed to @code{bfd_close}, the stream will be closed. + +A copy of the @var{filename} argument is stored in the newly created +BFD. It can be accessed via the bfd_get_filename() macro. + +@findex bfd_openr_iovec +@subsubsection @code{bfd_openr_iovec} +@strong{Synopsis} +@example +bfd *bfd_openr_iovec (const char *filename, const char *target, + void *(*open_func) (struct bfd *nbfd, + void *open_closure), + void *open_closure, + file_ptr (*pread_func) (struct bfd *nbfd, + void *stream, + void *buf, + file_ptr nbytes, + file_ptr offset), + int (*close_func) (struct bfd *nbfd, + void *stream), + int (*stat_func) (struct bfd *abfd, + void *stream, + struct stat *sb)); +@end example +@strong{Description}@* +Create and return a BFD backed by a read-only @var{stream}. +The @var{stream} is created using @var{open_func}, accessed using +@var{pread_func} and destroyed using @var{close_func}. + +Calls @code{bfd_find_target}, so @var{target} is interpreted as by +that function. + +Calls @var{open_func} (which can call @code{bfd_zalloc} and +@code{bfd_get_filename}) to obtain the read-only stream backing +the BFD. @var{open_func} either succeeds returning the +non-@code{NULL} @var{stream}, or fails returning @code{NULL} +(setting @code{bfd_error}). + +Calls @var{pread_func} to request @var{nbytes} of data from +@var{stream} starting at @var{offset} (e.g., via a call to +@code{bfd_read}). @var{pread_func} either succeeds returning the +number of bytes read (which can be less than @var{nbytes} when +end-of-file), or fails returning -1 (setting @code{bfd_error}). + +Calls @var{close_func} when the BFD is later closed using +@code{bfd_close}. @var{close_func} either succeeds returning 0, or +fails returning -1 (setting @code{bfd_error}). + +Calls @var{stat_func} to fill in a stat structure for bfd_stat, +bfd_get_size, and bfd_get_mtime calls. @var{stat_func} returns 0 +on success, or returns -1 on failure (setting @code{bfd_error}). + +If @code{bfd_openr_iovec} returns @code{NULL} then an error has +occurred. Possible errors are @code{bfd_error_no_memory}, +@code{bfd_error_invalid_target} and @code{bfd_error_system_call}. + +A copy of the @var{filename} argument is stored in the newly created +BFD. It can be accessed via the bfd_get_filename() macro. + +@findex bfd_openw +@subsubsection @code{bfd_openw} +@strong{Synopsis} +@example +bfd *bfd_openw (const char *filename, const char *target); +@end example +@strong{Description}@* +Create a BFD, associated with file @var{filename}, using the +file format @var{target}, and return a pointer to it. + +Possible errors are @code{bfd_error_system_call}, @code{bfd_error_no_memory}, +@code{bfd_error_invalid_target}. + +A copy of the @var{filename} argument is stored in the newly created +BFD. It can be accessed via the bfd_get_filename() macro. + +@findex bfd_close +@subsubsection @code{bfd_close} +@strong{Synopsis} +@example +bfd_boolean bfd_close (bfd *abfd); +@end example +@strong{Description}@* +Close a BFD. If the BFD was open for writing, then pending +operations are completed and the file written out and closed. +If the created file is executable, then @code{chmod} is called +to mark it as such. + +All memory attached to the BFD is released. + +The file descriptor associated with the BFD is closed (even +if it was passed in to BFD by @code{bfd_fdopenr}). + +@strong{Returns}@* +@code{TRUE} is returned if all is ok, otherwise @code{FALSE}. + +@findex bfd_close_all_done +@subsubsection @code{bfd_close_all_done} +@strong{Synopsis} +@example +bfd_boolean bfd_close_all_done (bfd *); +@end example +@strong{Description}@* +Close a BFD. Differs from @code{bfd_close} since it does not +complete any pending operations. This routine would be used +if the application had just used BFD for swapping and didn't +want to use any of the writing code. + +If the created file is executable, then @code{chmod} is called +to mark it as such. + +All memory attached to the BFD is released. + +@strong{Returns}@* +@code{TRUE} is returned if all is ok, otherwise @code{FALSE}. + +@findex bfd_create +@subsubsection @code{bfd_create} +@strong{Synopsis} +@example +bfd *bfd_create (const char *filename, bfd *templ); +@end example +@strong{Description}@* +Create a new BFD in the manner of @code{bfd_openw}, but without +opening a file. The new BFD takes the target from the target +used by @var{templ}. The format is always set to @code{bfd_object}. + +A copy of the @var{filename} argument is stored in the newly created +BFD. It can be accessed via the bfd_get_filename() macro. + +@findex bfd_make_writable +@subsubsection @code{bfd_make_writable} +@strong{Synopsis} +@example +bfd_boolean bfd_make_writable (bfd *abfd); +@end example +@strong{Description}@* +Takes a BFD as created by @code{bfd_create} and converts it +into one like as returned by @code{bfd_openw}. It does this +by converting the BFD to BFD_IN_MEMORY. It's assumed that +you will call @code{bfd_make_readable} on this bfd later. + +@strong{Returns}@* +@code{TRUE} is returned if all is ok, otherwise @code{FALSE}. + +@findex bfd_make_readable +@subsubsection @code{bfd_make_readable} +@strong{Synopsis} +@example +bfd_boolean bfd_make_readable (bfd *abfd); +@end example +@strong{Description}@* +Takes a BFD as created by @code{bfd_create} and +@code{bfd_make_writable} and converts it into one like as +returned by @code{bfd_openr}. It does this by writing the +contents out to the memory buffer, then reversing the +direction. + +@strong{Returns}@* +@code{TRUE} is returned if all is ok, otherwise @code{FALSE}. + +@findex bfd_alloc +@subsubsection @code{bfd_alloc} +@strong{Synopsis} +@example +void *bfd_alloc (bfd *abfd, bfd_size_type wanted); +@end example +@strong{Description}@* +Allocate a block of @var{wanted} bytes of memory attached to +@code{abfd} and return a pointer to it. + +@findex bfd_alloc2 +@subsubsection @code{bfd_alloc2} +@strong{Synopsis} +@example +void *bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size); +@end example +@strong{Description}@* +Allocate a block of @var{nmemb} elements of @var{size} bytes each +of memory attached to @code{abfd} and return a pointer to it. + +@findex bfd_zalloc +@subsubsection @code{bfd_zalloc} +@strong{Synopsis} +@example +void *bfd_zalloc (bfd *abfd, bfd_size_type wanted); +@end example +@strong{Description}@* +Allocate a block of @var{wanted} bytes of zeroed memory +attached to @code{abfd} and return a pointer to it. + +@findex bfd_zalloc2 +@subsubsection @code{bfd_zalloc2} +@strong{Synopsis} +@example +void *bfd_zalloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size); +@end example +@strong{Description}@* +Allocate a block of @var{nmemb} elements of @var{size} bytes each +of zeroed memory attached to @code{abfd} and return a pointer to it. + +@findex bfd_calc_gnu_debuglink_crc32 +@subsubsection @code{bfd_calc_gnu_debuglink_crc32} +@strong{Synopsis} +@example +unsigned long bfd_calc_gnu_debuglink_crc32 + (unsigned long crc, const unsigned char *buf, bfd_size_type len); +@end example +@strong{Description}@* +Computes a CRC value as used in the .gnu_debuglink section. +Advances the previously computed @var{crc} value by computing +and adding in the crc32 for @var{len} bytes of @var{buf}. + +@strong{Returns}@* +Return the updated CRC32 value. + +@findex bfd_get_debug_link_info_1 +@subsubsection @code{bfd_get_debug_link_info_1} +@strong{Synopsis} +@example +char *bfd_get_debug_link_info_1 (bfd *abfd, void *crc32_out); +@end example +@strong{Description}@* +Extracts the filename and CRC32 value for any separate debug +information file associated with @var{abfd}. + +The @var{crc32_out} parameter is an untyped pointer because +this routine is used as a @code{get_func_type} function, but it +is expected to be an unsigned long pointer. + +@strong{Returns}@* +The filename of the associated debug information file, or NULL +if there is no such file. If the filename was found then the +contents of @var{crc32_out} are updated to hold the corresponding +CRC32 value for the file. + +The returned filename is allocated with @code{malloc}; freeing +it is the responsibility of the caller. + +@findex bfd_get_debug_link_info +@subsubsection @code{bfd_get_debug_link_info} +@strong{Synopsis} +@example +char *bfd_get_debug_link_info (bfd *abfd, unsigned long *crc32_out); +@end example +@strong{Description}@* +Extracts the filename and CRC32 value for any separate debug +information file associated with @var{abfd}. + +@strong{Returns}@* +The filename of the associated debug information file, or NULL +if there is no such file. If the filename was found then the +contents of @var{crc32_out} are updated to hold the corresponding +CRC32 value for the file. + +The returned filename is allocated with @code{malloc}; freeing +it is the responsibility of the caller. + +@findex bfd_get_alt_debug_link_info +@subsubsection @code{bfd_get_alt_debug_link_info} +@strong{Synopsis} +@example +char *bfd_get_alt_debug_link_info (bfd * abfd, + bfd_size_type *buildid_len, + bfd_byte **buildid_out); +@end example +@strong{Description}@* +Fetch the filename and BuildID value for any alternate debuginfo +associated with @var{abfd}. Return NULL if no such info found, +otherwise return filename and update @var{buildid_len} and +@var{buildid_out}. The returned filename and build_id are +allocated with @code{malloc}; freeing them is the responsibility +of the caller. + +@findex separate_debug_file_exists +@subsubsection @code{separate_debug_file_exists} +@strong{Synopsis} +@example +bfd_boolean separate_debug_file_exists + (char *name, void *crc32_p); +@end example +@strong{Description}@* +Checks to see if @var{name} is a file and if its contents +match @var{crc32}, which is a pointer to an @code{unsigned +long} containing a CRC32. + +The @var{crc32_p} parameter is an untyped pointer because +this routine is used as a @code{check_func_type} function. + +@findex separate_alt_debug_file_exists +@subsubsection @code{separate_alt_debug_file_exists} +@strong{Synopsis} +@example +bfd_boolean separate_alt_debug_file_exists + (char *name, void *unused); +@end example +@strong{Description}@* +Checks to see if @var{name} is a file. + +@findex find_separate_debug_file +@subsubsection @code{find_separate_debug_file} +@strong{Synopsis} +@example +char *find_separate_debug_file + (bfd *abfd, const char *dir, bfd_boolean include_dirs, + get_func_type get, check_func_type check, void *data); +@end example +@strong{Description}@* +Searches for a debug information file corresponding to @var{abfd}. + +The name of the separate debug info file is returned by the +@var{get} function. This function scans various fixed locations +in the filesystem, including the file tree rooted at @var{dir}. +If the @var{include_dirs} parameter is true then the directory +components of @var{abfd}'s filename will be included in the +searched locations. + +@var{data} is passed unmodified to the @var{get} and @var{check} +functions. It is generally used to implement build-id-like +matching in the callback functions. + +@strong{Returns}@* +Returns the filename of the first file to be found which +receives a TRUE result from the @var{check} function. +Returns NULL if no valid file could be found. + +@findex bfd_follow_gnu_debuglink +@subsubsection @code{bfd_follow_gnu_debuglink} +@strong{Synopsis} +@example +char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir); +@end example +@strong{Description}@* +Takes a BFD and searches it for a .gnu_debuglink section. If this +section is found, it examines the section for the name and checksum +of a '.debug' file containing auxiliary debugging information. It +then searches the filesystem for this .debug file in some standard +locations, including the directory tree rooted at @var{dir}, and if +found returns the full filename. + +If @var{dir} is NULL, the search will take place starting at +the current directory. + +@strong{Returns}@* +@code{NULL} on any errors or failure to locate the .debug file, +otherwise a pointer to a heap-allocated string containing the +filename. The caller is responsible for freeing this string. + +@findex bfd_follow_gnu_debugaltlink +@subsubsection @code{bfd_follow_gnu_debugaltlink} +@strong{Synopsis} +@example +char *bfd_follow_gnu_debugaltlink (bfd *abfd, const char *dir); +@end example +@strong{Description}@* +Takes a BFD and searches it for a .gnu_debugaltlink section. If this +section is found, it examines the section for the name of a file +containing auxiliary debugging information. It then searches the +filesystem for this file in a set of standard locations, including +the directory tree rooted at @var{dir}, and if found returns the +full filename. + +If @var{dir} is NULL, the search will take place starting at +the current directory. + +@strong{Returns}@* +@code{NULL} on any errors or failure to locate the debug file, +otherwise a pointer to a heap-allocated string containing the +filename. The caller is responsible for freeing this string. + +@findex bfd_create_gnu_debuglink_section +@subsubsection @code{bfd_create_gnu_debuglink_section} +@strong{Synopsis} +@example +struct bfd_section *bfd_create_gnu_debuglink_section + (bfd *abfd, const char *filename); +@end example +@strong{Description}@* +Takes a @var{BFD} and adds a .gnu_debuglink section to it. The +section is sized to be big enough to contain a link to the specified +@var{filename}. + +@strong{Returns}@* +A pointer to the new section is returned if all is ok. Otherwise +@code{NULL} is returned and bfd_error is set. + +@findex bfd_fill_in_gnu_debuglink_section +@subsubsection @code{bfd_fill_in_gnu_debuglink_section} +@strong{Synopsis} +@example +bfd_boolean bfd_fill_in_gnu_debuglink_section + (bfd *abfd, struct bfd_section *sect, const char *filename); +@end example +@strong{Description}@* +Takes a @var{BFD} and containing a .gnu_debuglink section @var{SECT} +and fills in the contents of the section to contain a link to the +specified @var{filename}. The filename should be relative to the +current directory. + +@strong{Returns}@* +@code{TRUE} is returned if all is ok. Otherwise @code{FALSE} is returned +and bfd_error is set. + +@findex get_build_id +@subsubsection @code{get_build_id} +@strong{Synopsis} +@example +struct bfd_build_id * get_build_id (bfd *abfd); +@end example +@strong{Description}@* +Finds the build-id associated with @var{abfd}. If the build-id is +extracted from the note section then a build-id structure is built +for it, using memory allocated to @var{abfd}, and this is then +attached to the @var{abfd}. + +@strong{Returns}@* +Returns a pointer to the build-id structure if a build-id could be +found. If no build-id is found NULL is returned and error code is +set. + +@findex get_build_id_name +@subsubsection @code{get_build_id_name} +@strong{Synopsis} +@example +char * get_build_id_name (bfd *abfd, void *build_id_out_p) +@end example +@strong{Description}@* +Searches @var{abfd} for a build-id, and then constructs a pathname +from it. The path is computed as .build-id/NN/NN+NN.debug where +NNNN+NN is the build-id value as a hexadecimal string. + +@strong{Returns}@* +Returns the constructed filename or NULL upon error. +It is the caller's responsibility to free the memory used to hold the +filename. +If a filename is returned then the @var{build_id_out_p} +parameter (which points to a @code{struct bfd_build_id} +pointer) is set to a pointer to the build_id structure. + +@findex check_build_id_file +@subsubsection @code{check_build_id_file} +@strong{Synopsis} +@example +bfd_boolean check_build_id_file (char *name, void *buildid_p); +@end example +@strong{Description}@* +Checks to see if @var{name} is a readable file and if its build-id +matches @var{buildid}. + +@strong{Returns}@* +Returns TRUE if the file exists, is readable, and contains a +build-id which matches the build-id pointed at by +@var{build_id_p} (which is really a @code{struct bfd_build_id **}). + +@findex bfd_follow_build_id_debuglink +@subsubsection @code{bfd_follow_build_id_debuglink} +@strong{Synopsis} +@example +char *bfd_follow_build_id_debuglink (bfd *abfd, const char *dir); +@end example +@strong{Description}@* +Takes @var{abfd} and searches it for a .note.gnu.build-id section. +If this section is found, it extracts the value of the NT_GNU_BUILD_ID +note, which should be a hexadecimal value @var{NNNN+NN} (for +32+ hex digits). It then searches the filesystem for a file named +@var{.build-id/NN/NN+NN.debug} in a set of standard locations, +including the directory tree rooted at @var{dir}. The filename +of the first matching file to be found is returned. A matching +file should contain a .note.gnu.build-id section with the same +@var{NNNN+NN} note as @var{abfd}, although this check is currently +not implemented. + +If @var{dir} is NULL, the search will take place starting at +the current directory. + +@strong{Returns}@* +@code{NULL} on any errors or failure to locate the debug file, +otherwise a pointer to a heap-allocated string containing the +filename. The caller is responsible for freeing this string. + diff --git a/gdb-8.3.1/bfd/doc/reloc.texi b/gdb-8.3.1/bfd/doc/reloc.texi new file mode 100644 index 0000000000000000000000000000000000000000..a765828ee4c1c37f7997a78b6104c853693d47b7 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/reloc.texi @@ -0,0 +1,4600 @@ +@section Relocations +BFD maintains relocations in much the same way it maintains +symbols: they are left alone until required, then read in +en-masse and translated into an internal form. A common +routine @code{bfd_perform_relocation} acts upon the +canonical form to do the fixup. + +Relocations are maintained on a per section basis, +while symbols are maintained on a per BFD basis. + +All that a back end has to do to fit the BFD interface is to create +a @code{struct reloc_cache_entry} for each relocation +in a particular section, and fill in the right bits of the structures. + +@menu +* typedef arelent:: +* howto manager:: +@end menu + + +@node typedef arelent, howto manager, Relocations, Relocations +@subsection typedef arelent +This is the structure of a relocation entry: + + +@example + +typedef enum bfd_reloc_status +@{ + /* No errors detected. Note - the value 2 is used so that it + will not be mistaken for the boolean TRUE or FALSE values. */ + bfd_reloc_ok = 2, + + /* The relocation was performed, but there was an overflow. */ + bfd_reloc_overflow, + + /* The address to relocate was not within the section supplied. */ + bfd_reloc_outofrange, + + /* Used by special functions. */ + bfd_reloc_continue, + + /* Unsupported relocation size requested. */ + bfd_reloc_notsupported, + + /* Unused. */ + bfd_reloc_other, + + /* The symbol to relocate against was undefined. */ + bfd_reloc_undefined, + + /* The relocation was performed, but may not be ok. If this type is + returned, the error_message argument to bfd_perform_relocation + will be set. */ + bfd_reloc_dangerous + @} + bfd_reloc_status_type; + +typedef const struct reloc_howto_struct reloc_howto_type; + +typedef struct reloc_cache_entry +@{ + /* A pointer into the canonical table of pointers. */ + struct bfd_symbol **sym_ptr_ptr; + + /* offset in section. */ + bfd_size_type address; + + /* addend for relocation value. */ + bfd_vma addend; + + /* Pointer to how to perform the required relocation. */ + reloc_howto_type *howto; + +@} +arelent; + +@end example +@strong{Description}@* +Here is a description of each of the fields within an @code{arelent}: + +@itemize @bullet + +@item +@code{sym_ptr_ptr} +@end itemize +The symbol table pointer points to a pointer to the symbol +associated with the relocation request. It is the pointer +into the table returned by the back end's +@code{canonicalize_symtab} action. @xref{Symbols}. The symbol is +referenced through a pointer to a pointer so that tools like +the linker can fix up all the symbols of the same name by +modifying only one pointer. The relocation routine looks in +the symbol and uses the base of the section the symbol is +attached to and the value of the symbol as the initial +relocation offset. If the symbol pointer is zero, then the +section provided is looked up. + +@itemize @bullet + +@item +@code{address} +@end itemize +The @code{address} field gives the offset in bytes from the base of +the section data which owns the relocation record to the first +byte of relocatable information. The actual data relocated +will be relative to this point; for example, a relocation +type which modifies the bottom two bytes of a four byte word +would not touch the first byte pointed to in a big endian +world. + +@itemize @bullet + +@item +@code{addend} +@end itemize +The @code{addend} is a value provided by the back end to be added (!) +to the relocation offset. Its interpretation is dependent upon +the howto. For example, on the 68k the code: + +@example + char foo[]; + main() + @{ + return foo[0x12345678]; + @} +@end example + +Could be compiled into: + +@example + linkw fp,#-4 + moveb @@#12345678,d0 + extbl d0 + unlk fp + rts +@end example + +This could create a reloc pointing to @code{foo}, but leave the +offset in the data, something like: + +@example +RELOCATION RECORDS FOR [.text]: +offset type value +00000006 32 _foo + +00000000 4e56 fffc ; linkw fp,#-4 +00000004 1039 1234 5678 ; moveb @@#12345678,d0 +0000000a 49c0 ; extbl d0 +0000000c 4e5e ; unlk fp +0000000e 4e75 ; rts +@end example + +Using coff and an 88k, some instructions don't have enough +space in them to represent the full address range, and +pointers have to be loaded in two parts. So you'd get something like: + +@example + or.u r13,r0,hi16(_foo+0x12345678) + ld.b r2,r13,lo16(_foo+0x12345678) + jmp r1 +@end example + +This should create two relocs, both pointing to @code{_foo}, and with +0x12340000 in their addend field. The data would consist of: + +@example +RELOCATION RECORDS FOR [.text]: +offset type value +00000002 HVRT16 _foo+0x12340000 +00000006 LVRT16 _foo+0x12340000 + +00000000 5da05678 ; or.u r13,r0,0x5678 +00000004 1c4d5678 ; ld.b r2,r13,0x5678 +00000008 f400c001 ; jmp r1 +@end example + +The relocation routine digs out the value from the data, adds +it to the addend to get the original offset, and then adds the +value of @code{_foo}. Note that all 32 bits have to be kept around +somewhere, to cope with carry from bit 15 to bit 16. + +One further example is the sparc and the a.out format. The +sparc has a similar problem to the 88k, in that some +instructions don't have room for an entire offset, but on the +sparc the parts are created in odd sized lumps. The designers of +the a.out format chose to not use the data within the section +for storing part of the offset; all the offset is kept within +the reloc. Anything in the data should be ignored. + +@example + save %sp,-112,%sp + sethi %hi(_foo+0x12345678),%g2 + ldsb [%g2+%lo(_foo+0x12345678)],%i0 + ret + restore +@end example + +Both relocs contain a pointer to @code{foo}, and the offsets +contain junk. + +@example +RELOCATION RECORDS FOR [.text]: +offset type value +00000004 HI22 _foo+0x12345678 +00000008 LO10 _foo+0x12345678 + +00000000 9de3bf90 ; save %sp,-112,%sp +00000004 05000000 ; sethi %hi(_foo+0),%g2 +00000008 f048a000 ; ldsb [%g2+%lo(_foo+0)],%i0 +0000000c 81c7e008 ; ret +00000010 81e80000 ; restore +@end example + +@itemize @bullet + +@item +@code{howto} +@end itemize +The @code{howto} field can be imagined as a +relocation instruction. It is a pointer to a structure which +contains information on what to do with all of the other +information in the reloc record and data section. A back end +would normally have a relocation instruction set and turn +relocations into pointers to the correct structure on input - +but it would be possible to create each howto field on demand. + +@subsubsection @code{enum complain_overflow} +Indicates what sort of overflow checking should be done when +performing a relocation. + + +@example + +enum complain_overflow +@{ + /* Do not complain on overflow. */ + complain_overflow_dont, + + /* Complain if the value overflows when considered as a signed + number one bit larger than the field. ie. A bitfield of N bits + is allowed to represent -2**n to 2**n-1. */ + complain_overflow_bitfield, + + /* Complain if the value overflows when considered as a signed + number. */ + complain_overflow_signed, + + /* Complain if the value overflows when considered as an + unsigned number. */ + complain_overflow_unsigned +@}; +@end example +@subsubsection @code{reloc_howto_type} +The @code{reloc_howto_type} is a structure which contains all the +information that libbfd needs to know to tie up a back end's data. + + +@example +struct reloc_howto_struct +@{ + /* The type field has mainly a documentary use - the back end can + do what it wants with it, though normally the back end's idea of + an external reloc number is stored in this field. */ + unsigned int type; + + /* The encoded size of the item to be relocated. This is *not* a + power-of-two measure. Use bfd_get_reloc_size to find the size + of the item in bytes. */ + unsigned int size:3; + + /* The number of bits in the field to be relocated. This is used + when doing overflow checking. */ + unsigned int bitsize:7; + + /* The value the final relocation is shifted right by. This drops + unwanted data from the relocation. */ + unsigned int rightshift:6; + + /* The bit position of the reloc value in the destination. + The relocated value is left shifted by this amount. */ + unsigned int bitpos:6; + + /* What type of overflow error should be checked for when + relocating. */ + ENUM_BITFIELD (complain_overflow) complain_on_overflow:2; + + /* The relocation value should be negated before applying. */ + unsigned int negate:1; + + /* The relocation is relative to the item being relocated. */ + unsigned int pc_relative:1; + + /* Some formats record a relocation addend in the section contents + rather than with the relocation. For ELF formats this is the + distinction between USE_REL and USE_RELA (though the code checks + for USE_REL == 1/0). The value of this field is TRUE if the + addend is recorded with the section contents; when performing a + partial link (ld -r) the section contents (the data) will be + modified. The value of this field is FALSE if addends are + recorded with the relocation (in arelent.addend); when performing + a partial link the relocation will be modified. + All relocations for all ELF USE_RELA targets should set this field + to FALSE (values of TRUE should be looked on with suspicion). + However, the converse is not true: not all relocations of all ELF + USE_REL targets set this field to TRUE. Why this is so is peculiar + to each particular target. For relocs that aren't used in partial + links (e.g. GOT stuff) it doesn't matter what this is set to. */ + unsigned int partial_inplace:1; + + /* When some formats create PC relative instructions, they leave + the value of the pc of the place being relocated in the offset + slot of the instruction, so that a PC relative relocation can + be made just by adding in an ordinary offset (e.g., sun3 a.out). + Some formats leave the displacement part of an instruction + empty (e.g., ELF); this flag signals the fact. */ + unsigned int pcrel_offset:1; + + /* src_mask selects the part of the instruction (or data) to be used + in the relocation sum. If the target relocations don't have an + addend in the reloc, eg. ELF USE_REL, src_mask will normally equal + dst_mask to extract the addend from the section contents. If + relocations do have an addend in the reloc, eg. ELF USE_RELA, this + field should normally be zero. Non-zero values for ELF USE_RELA + targets should be viewed with suspicion as normally the value in + the dst_mask part of the section contents should be ignored. */ + bfd_vma src_mask; + + /* dst_mask selects which parts of the instruction (or data) are + replaced with a relocated value. */ + bfd_vma dst_mask; + + /* If this field is non null, then the supplied function is + called rather than the normal function. This allows really + strange relocation methods to be accommodated. */ + bfd_reloc_status_type (*special_function) + (bfd *, arelent *, struct bfd_symbol *, void *, asection *, + bfd *, char **); + + /* The textual name of the relocation type. */ + char *name; +@}; + +@end example +@findex The HOWTO Macro +@subsubsection @code{The HOWTO Macro} +@strong{Description}@* +The HOWTO macro fills in a reloc_howto_type (a typedef for +const struct reloc_howto_struct). +@example +#define HOWTO(type, right, size, bits, pcrel, left, ovf, func, name, \ + inplace, src_mask, dst_mask, pcrel_off) \ + @{ (unsigned) type, size < 0 ? -size : size, bits, right, left, ovf, \ + size < 0, pcrel, inplace, pcrel_off, src_mask, dst_mask, func, name @} +@end example + +@strong{Description}@* +This is used to fill in an empty howto entry in an array. +@example +#define EMPTY_HOWTO(C) \ + HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \ + NULL, FALSE, 0, 0, FALSE) + +@end example + +@findex bfd_get_reloc_size +@subsubsection @code{bfd_get_reloc_size} +@strong{Synopsis} +@example +unsigned int bfd_get_reloc_size (reloc_howto_type *); +@end example +@strong{Description}@* +For a reloc_howto_type that operates on a fixed number of bytes, +this returns the number of bytes operated on. + +@findex arelent_chain +@subsubsection @code{arelent_chain} +@strong{Description}@* +How relocs are tied together in an @code{asection}: +@example +typedef struct relent_chain +@{ + arelent relent; + struct relent_chain *next; +@} +arelent_chain; + +@end example + +@findex bfd_check_overflow +@subsubsection @code{bfd_check_overflow} +@strong{Synopsis} +@example +bfd_reloc_status_type bfd_check_overflow + (enum complain_overflow how, + unsigned int bitsize, + unsigned int rightshift, + unsigned int addrsize, + bfd_vma relocation); +@end example +@strong{Description}@* +Perform overflow checking on @var{relocation} which has +@var{bitsize} significant bits and will be shifted right by +@var{rightshift} bits, on a machine with addresses containing +@var{addrsize} significant bits. The result is either of +@code{bfd_reloc_ok} or @code{bfd_reloc_overflow}. + +@findex bfd_reloc_offset_in_range +@subsubsection @code{bfd_reloc_offset_in_range} +@strong{Synopsis} +@example +bfd_boolean bfd_reloc_offset_in_range + (reloc_howto_type *howto, + bfd *abfd, + asection *section, + bfd_size_type offset); +@end example +@strong{Description}@* +Returns TRUE if the reloc described by @var{HOWTO} can be +applied at @var{OFFSET} octets in @var{SECTION}. + +@findex bfd_perform_relocation +@subsubsection @code{bfd_perform_relocation} +@strong{Synopsis} +@example +bfd_reloc_status_type bfd_perform_relocation + (bfd *abfd, + arelent *reloc_entry, + void *data, + asection *input_section, + bfd *output_bfd, + char **error_message); +@end example +@strong{Description}@* +If @var{output_bfd} is supplied to this function, the +generated image will be relocatable; the relocations are +copied to the output file after they have been changed to +reflect the new state of the world. There are two ways of +reflecting the results of partial linkage in an output file: +by modifying the output data in place, and by modifying the +relocation record. Some native formats (e.g., basic a.out and +basic coff) have no way of specifying an addend in the +relocation type, so the addend has to go in the output data. +This is no big deal since in these formats the output data +slot will always be big enough for the addend. Complex reloc +types with addends were invented to solve just this problem. +The @var{error_message} argument is set to an error message if +this return @code{bfd_reloc_dangerous}. + +@findex bfd_install_relocation +@subsubsection @code{bfd_install_relocation} +@strong{Synopsis} +@example +bfd_reloc_status_type bfd_install_relocation + (bfd *abfd, + arelent *reloc_entry, + void *data, bfd_vma data_start, + asection *input_section, + char **error_message); +@end example +@strong{Description}@* +This looks remarkably like @code{bfd_perform_relocation}, except it +does not expect that the section contents have been filled in. +I.e., it's suitable for use when creating, rather than applying +a relocation. + +For now, this function should be considered reserved for the +assembler. + + +@node howto manager, , typedef arelent, Relocations +@subsection The howto manager +When an application wants to create a relocation, but doesn't +know what the target machine might call it, it can find out by +using this bit of code. + +@findex bfd_reloc_code_type +@subsubsection @code{bfd_reloc_code_type} +@strong{Description}@* +The insides of a reloc code. The idea is that, eventually, there +will be one enumerator for every type of relocation we ever do. +Pass one of these values to @code{bfd_reloc_type_lookup}, and it'll +return a howto pointer. + +This does mean that the application must determine the correct +enumerator value; you can't get a howto pointer from a random set +of attributes. + +Here are the possible values for @code{enum bfd_reloc_code_real}: + +@deffn {} BFD_RELOC_64 +@deffnx {} BFD_RELOC_32 +@deffnx {} BFD_RELOC_26 +@deffnx {} BFD_RELOC_24 +@deffnx {} BFD_RELOC_16 +@deffnx {} BFD_RELOC_14 +@deffnx {} BFD_RELOC_8 +Basic absolute relocations of N bits. +@end deffn +@deffn {} BFD_RELOC_64_PCREL +@deffnx {} BFD_RELOC_32_PCREL +@deffnx {} BFD_RELOC_24_PCREL +@deffnx {} BFD_RELOC_16_PCREL +@deffnx {} BFD_RELOC_12_PCREL +@deffnx {} BFD_RELOC_8_PCREL +PC-relative relocations. Sometimes these are relative to the address +of the relocation itself; sometimes they are relative to the start of +the section containing the relocation. It depends on the specific target. +@end deffn +@deffn {} BFD_RELOC_32_SECREL +Section relative relocations. Some targets need this for DWARF2. +@end deffn +@deffn {} BFD_RELOC_32_GOT_PCREL +@deffnx {} BFD_RELOC_16_GOT_PCREL +@deffnx {} BFD_RELOC_8_GOT_PCREL +@deffnx {} BFD_RELOC_32_GOTOFF +@deffnx {} BFD_RELOC_16_GOTOFF +@deffnx {} BFD_RELOC_LO16_GOTOFF +@deffnx {} BFD_RELOC_HI16_GOTOFF +@deffnx {} BFD_RELOC_HI16_S_GOTOFF +@deffnx {} BFD_RELOC_8_GOTOFF +@deffnx {} BFD_RELOC_64_PLT_PCREL +@deffnx {} BFD_RELOC_32_PLT_PCREL +@deffnx {} BFD_RELOC_24_PLT_PCREL +@deffnx {} BFD_RELOC_16_PLT_PCREL +@deffnx {} BFD_RELOC_8_PLT_PCREL +@deffnx {} BFD_RELOC_64_PLTOFF +@deffnx {} BFD_RELOC_32_PLTOFF +@deffnx {} BFD_RELOC_16_PLTOFF +@deffnx {} BFD_RELOC_LO16_PLTOFF +@deffnx {} BFD_RELOC_HI16_PLTOFF +@deffnx {} BFD_RELOC_HI16_S_PLTOFF +@deffnx {} BFD_RELOC_8_PLTOFF +For ELF. +@end deffn +@deffn {} BFD_RELOC_SIZE32 +@deffnx {} BFD_RELOC_SIZE64 +Size relocations. +@end deffn +@deffn {} BFD_RELOC_68K_GLOB_DAT +@deffnx {} BFD_RELOC_68K_JMP_SLOT +@deffnx {} BFD_RELOC_68K_RELATIVE +@deffnx {} BFD_RELOC_68K_TLS_GD32 +@deffnx {} BFD_RELOC_68K_TLS_GD16 +@deffnx {} BFD_RELOC_68K_TLS_GD8 +@deffnx {} BFD_RELOC_68K_TLS_LDM32 +@deffnx {} BFD_RELOC_68K_TLS_LDM16 +@deffnx {} BFD_RELOC_68K_TLS_LDM8 +@deffnx {} BFD_RELOC_68K_TLS_LDO32 +@deffnx {} BFD_RELOC_68K_TLS_LDO16 +@deffnx {} BFD_RELOC_68K_TLS_LDO8 +@deffnx {} BFD_RELOC_68K_TLS_IE32 +@deffnx {} BFD_RELOC_68K_TLS_IE16 +@deffnx {} BFD_RELOC_68K_TLS_IE8 +@deffnx {} BFD_RELOC_68K_TLS_LE32 +@deffnx {} BFD_RELOC_68K_TLS_LE16 +@deffnx {} BFD_RELOC_68K_TLS_LE8 +Relocations used by 68K ELF. +@end deffn +@deffn {} BFD_RELOC_32_BASEREL +@deffnx {} BFD_RELOC_16_BASEREL +@deffnx {} BFD_RELOC_LO16_BASEREL +@deffnx {} BFD_RELOC_HI16_BASEREL +@deffnx {} BFD_RELOC_HI16_S_BASEREL +@deffnx {} BFD_RELOC_8_BASEREL +@deffnx {} BFD_RELOC_RVA +Linkage-table relative. +@end deffn +@deffn {} BFD_RELOC_8_FFnn +Absolute 8-bit relocation, but used to form an address like 0xFFnn. +@end deffn +@deffn {} BFD_RELOC_32_PCREL_S2 +@deffnx {} BFD_RELOC_16_PCREL_S2 +@deffnx {} BFD_RELOC_23_PCREL_S2 +These PC-relative relocations are stored as word displacements -- +i.e., byte displacements shifted right two bits. The 30-bit word +displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the +SPARC. (SPARC tools generally refer to this as <>.) The +signed 16-bit displacement is used on the MIPS, and the 23-bit +displacement is used on the Alpha. +@end deffn +@deffn {} BFD_RELOC_HI22 +@deffnx {} BFD_RELOC_LO10 +High 22 bits and low 10 bits of 32-bit value, placed into lower bits of +the target word. These are used on the SPARC. +@end deffn +@deffn {} BFD_RELOC_GPREL16 +@deffnx {} BFD_RELOC_GPREL32 +For systems that allocate a Global Pointer register, these are +displacements off that register. These relocation types are +handled specially, because the value the register will have is +decided relatively late. +@end deffn +@deffn {} BFD_RELOC_NONE +@deffnx {} BFD_RELOC_SPARC_WDISP22 +@deffnx {} BFD_RELOC_SPARC22 +@deffnx {} BFD_RELOC_SPARC13 +@deffnx {} BFD_RELOC_SPARC_GOT10 +@deffnx {} BFD_RELOC_SPARC_GOT13 +@deffnx {} BFD_RELOC_SPARC_GOT22 +@deffnx {} BFD_RELOC_SPARC_PC10 +@deffnx {} BFD_RELOC_SPARC_PC22 +@deffnx {} BFD_RELOC_SPARC_WPLT30 +@deffnx {} BFD_RELOC_SPARC_COPY +@deffnx {} BFD_RELOC_SPARC_GLOB_DAT +@deffnx {} BFD_RELOC_SPARC_JMP_SLOT +@deffnx {} BFD_RELOC_SPARC_RELATIVE +@deffnx {} BFD_RELOC_SPARC_UA16 +@deffnx {} BFD_RELOC_SPARC_UA32 +@deffnx {} BFD_RELOC_SPARC_UA64 +@deffnx {} BFD_RELOC_SPARC_GOTDATA_HIX22 +@deffnx {} BFD_RELOC_SPARC_GOTDATA_LOX10 +@deffnx {} BFD_RELOC_SPARC_GOTDATA_OP_HIX22 +@deffnx {} BFD_RELOC_SPARC_GOTDATA_OP_LOX10 +@deffnx {} BFD_RELOC_SPARC_GOTDATA_OP +@deffnx {} BFD_RELOC_SPARC_JMP_IREL +@deffnx {} BFD_RELOC_SPARC_IRELATIVE +SPARC ELF relocations. There is probably some overlap with other +relocation types already defined. +@end deffn +@deffn {} BFD_RELOC_SPARC_BASE13 +@deffnx {} BFD_RELOC_SPARC_BASE22 +I think these are specific to SPARC a.out (e.g., Sun 4). +@end deffn +@deffn {} BFD_RELOC_SPARC_64 +@deffnx {} BFD_RELOC_SPARC_10 +@deffnx {} BFD_RELOC_SPARC_11 +@deffnx {} BFD_RELOC_SPARC_OLO10 +@deffnx {} BFD_RELOC_SPARC_HH22 +@deffnx {} BFD_RELOC_SPARC_HM10 +@deffnx {} BFD_RELOC_SPARC_LM22 +@deffnx {} BFD_RELOC_SPARC_PC_HH22 +@deffnx {} BFD_RELOC_SPARC_PC_HM10 +@deffnx {} BFD_RELOC_SPARC_PC_LM22 +@deffnx {} BFD_RELOC_SPARC_WDISP16 +@deffnx {} BFD_RELOC_SPARC_WDISP19 +@deffnx {} BFD_RELOC_SPARC_7 +@deffnx {} BFD_RELOC_SPARC_6 +@deffnx {} BFD_RELOC_SPARC_5 +@deffnx {} BFD_RELOC_SPARC_DISP64 +@deffnx {} BFD_RELOC_SPARC_PLT32 +@deffnx {} BFD_RELOC_SPARC_PLT64 +@deffnx {} BFD_RELOC_SPARC_HIX22 +@deffnx {} BFD_RELOC_SPARC_LOX10 +@deffnx {} BFD_RELOC_SPARC_H44 +@deffnx {} BFD_RELOC_SPARC_M44 +@deffnx {} BFD_RELOC_SPARC_L44 +@deffnx {} BFD_RELOC_SPARC_REGISTER +@deffnx {} BFD_RELOC_SPARC_H34 +@deffnx {} BFD_RELOC_SPARC_SIZE32 +@deffnx {} BFD_RELOC_SPARC_SIZE64 +@deffnx {} BFD_RELOC_SPARC_WDISP10 +SPARC64 relocations +@end deffn +@deffn {} BFD_RELOC_SPARC_REV32 +SPARC little endian relocation +@end deffn +@deffn {} BFD_RELOC_SPARC_TLS_GD_HI22 +@deffnx {} BFD_RELOC_SPARC_TLS_GD_LO10 +@deffnx {} BFD_RELOC_SPARC_TLS_GD_ADD +@deffnx {} BFD_RELOC_SPARC_TLS_GD_CALL +@deffnx {} BFD_RELOC_SPARC_TLS_LDM_HI22 +@deffnx {} BFD_RELOC_SPARC_TLS_LDM_LO10 +@deffnx {} BFD_RELOC_SPARC_TLS_LDM_ADD +@deffnx {} BFD_RELOC_SPARC_TLS_LDM_CALL +@deffnx {} BFD_RELOC_SPARC_TLS_LDO_HIX22 +@deffnx {} BFD_RELOC_SPARC_TLS_LDO_LOX10 +@deffnx {} BFD_RELOC_SPARC_TLS_LDO_ADD +@deffnx {} BFD_RELOC_SPARC_TLS_IE_HI22 +@deffnx {} BFD_RELOC_SPARC_TLS_IE_LO10 +@deffnx {} BFD_RELOC_SPARC_TLS_IE_LD +@deffnx {} BFD_RELOC_SPARC_TLS_IE_LDX +@deffnx {} BFD_RELOC_SPARC_TLS_IE_ADD +@deffnx {} BFD_RELOC_SPARC_TLS_LE_HIX22 +@deffnx {} BFD_RELOC_SPARC_TLS_LE_LOX10 +@deffnx {} BFD_RELOC_SPARC_TLS_DTPMOD32 +@deffnx {} BFD_RELOC_SPARC_TLS_DTPMOD64 +@deffnx {} BFD_RELOC_SPARC_TLS_DTPOFF32 +@deffnx {} BFD_RELOC_SPARC_TLS_DTPOFF64 +@deffnx {} BFD_RELOC_SPARC_TLS_TPOFF32 +@deffnx {} BFD_RELOC_SPARC_TLS_TPOFF64 +SPARC TLS relocations +@end deffn +@deffn {} BFD_RELOC_SPU_IMM7 +@deffnx {} BFD_RELOC_SPU_IMM8 +@deffnx {} BFD_RELOC_SPU_IMM10 +@deffnx {} BFD_RELOC_SPU_IMM10W +@deffnx {} BFD_RELOC_SPU_IMM16 +@deffnx {} BFD_RELOC_SPU_IMM16W +@deffnx {} BFD_RELOC_SPU_IMM18 +@deffnx {} BFD_RELOC_SPU_PCREL9a +@deffnx {} BFD_RELOC_SPU_PCREL9b +@deffnx {} BFD_RELOC_SPU_PCREL16 +@deffnx {} BFD_RELOC_SPU_LO16 +@deffnx {} BFD_RELOC_SPU_HI16 +@deffnx {} BFD_RELOC_SPU_PPU32 +@deffnx {} BFD_RELOC_SPU_PPU64 +@deffnx {} BFD_RELOC_SPU_ADD_PIC +SPU Relocations. +@end deffn +@deffn {} BFD_RELOC_ALPHA_GPDISP_HI16 +Alpha ECOFF and ELF relocations. Some of these treat the symbol or +"addend" in some special way. +For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when +writing; when reading, it will be the absolute section symbol. The +addend is the displacement in bytes of the "lda" instruction from +the "ldah" instruction (which is at the address of this reloc). +@end deffn +@deffn {} BFD_RELOC_ALPHA_GPDISP_LO16 +For GPDISP_LO16 ("ignore") relocations, the symbol is handled as +with GPDISP_HI16 relocs. The addend is ignored when writing the +relocations out, and is filled in with the file's GP value on +reading, for convenience. +@end deffn +@deffn {} BFD_RELOC_ALPHA_GPDISP +The ELF GPDISP relocation is exactly the same as the GPDISP_HI16 +relocation except that there is no accompanying GPDISP_LO16 +relocation. +@end deffn +@deffn {} BFD_RELOC_ALPHA_LITERAL +@deffnx {} BFD_RELOC_ALPHA_ELF_LITERAL +@deffnx {} BFD_RELOC_ALPHA_LITUSE +The Alpha LITERAL/LITUSE relocs are produced by a symbol reference; +the assembler turns it into a LDQ instruction to load the address of +the symbol, and then fills in a register in the real instruction. + +The LITERAL reloc, at the LDQ instruction, refers to the .lita +section symbol. The addend is ignored when writing, but is filled +in with the file's GP value on reading, for convenience, as with the +GPDISP_LO16 reloc. + +The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16. +It should refer to the symbol to be referenced, as with 16_GOTOFF, +but it generates output not based on the position within the .got +section, but relative to the GP value chosen for the file during the +final link stage. + +The LITUSE reloc, on the instruction using the loaded address, gives +information to the linker that it might be able to use to optimize +away some literal section references. The symbol is ignored (read +as the absolute section symbol), and the "addend" indicates the type +of instruction using the register: +1 - "memory" fmt insn +2 - byte-manipulation (byte offset reg) +3 - jsr (target of branch) +@end deffn +@deffn {} BFD_RELOC_ALPHA_HINT +The HINT relocation indicates a value that should be filled into the +"hint" field of a jmp/jsr/ret instruction, for possible branch- +prediction logic which may be provided on some processors. +@end deffn +@deffn {} BFD_RELOC_ALPHA_LINKAGE +The LINKAGE relocation outputs a linkage pair in the object file, +which is filled by the linker. +@end deffn +@deffn {} BFD_RELOC_ALPHA_CODEADDR +The CODEADDR relocation outputs a STO_CA in the object file, +which is filled by the linker. +@end deffn +@deffn {} BFD_RELOC_ALPHA_GPREL_HI16 +@deffnx {} BFD_RELOC_ALPHA_GPREL_LO16 +The GPREL_HI/LO relocations together form a 32-bit offset from the +GP register. +@end deffn +@deffn {} BFD_RELOC_ALPHA_BRSGP +Like BFD_RELOC_23_PCREL_S2, except that the source and target must +share a common GP, and the target address is adjusted for +STO_ALPHA_STD_GPLOAD. +@end deffn +@deffn {} BFD_RELOC_ALPHA_NOP +The NOP relocation outputs a NOP if the longword displacement +between two procedure entry points is < 2^21. +@end deffn +@deffn {} BFD_RELOC_ALPHA_BSR +The BSR relocation outputs a BSR if the longword displacement +between two procedure entry points is < 2^21. +@end deffn +@deffn {} BFD_RELOC_ALPHA_LDA +The LDA relocation outputs a LDA if the longword displacement +between two procedure entry points is < 2^16. +@end deffn +@deffn {} BFD_RELOC_ALPHA_BOH +The BOH relocation outputs a BSR if the longword displacement +between two procedure entry points is < 2^21, or else a hint. +@end deffn +@deffn {} BFD_RELOC_ALPHA_TLSGD +@deffnx {} BFD_RELOC_ALPHA_TLSLDM +@deffnx {} BFD_RELOC_ALPHA_DTPMOD64 +@deffnx {} BFD_RELOC_ALPHA_GOTDTPREL16 +@deffnx {} BFD_RELOC_ALPHA_DTPREL64 +@deffnx {} BFD_RELOC_ALPHA_DTPREL_HI16 +@deffnx {} BFD_RELOC_ALPHA_DTPREL_LO16 +@deffnx {} BFD_RELOC_ALPHA_DTPREL16 +@deffnx {} BFD_RELOC_ALPHA_GOTTPREL16 +@deffnx {} BFD_RELOC_ALPHA_TPREL64 +@deffnx {} BFD_RELOC_ALPHA_TPREL_HI16 +@deffnx {} BFD_RELOC_ALPHA_TPREL_LO16 +@deffnx {} BFD_RELOC_ALPHA_TPREL16 +Alpha thread-local storage relocations. +@end deffn +@deffn {} BFD_RELOC_MIPS_JMP +@deffnx {} BFD_RELOC_MICROMIPS_JMP +The MIPS jump instruction. +@end deffn +@deffn {} BFD_RELOC_MIPS16_JMP +The MIPS16 jump instruction. +@end deffn +@deffn {} BFD_RELOC_MIPS16_GPREL +MIPS16 GP relative reloc. +@end deffn +@deffn {} BFD_RELOC_HI16 +High 16 bits of 32-bit value; simple reloc. +@end deffn +@deffn {} BFD_RELOC_HI16_S +High 16 bits of 32-bit value but the low 16 bits will be sign +extended and added to form the final result. If the low 16 +bits form a negative number, we need to add one to the high value +to compensate for the borrow when the low bits are added. +@end deffn +@deffn {} BFD_RELOC_LO16 +Low 16 bits. +@end deffn +@deffn {} BFD_RELOC_HI16_PCREL +High 16 bits of 32-bit pc-relative value +@end deffn +@deffn {} BFD_RELOC_HI16_S_PCREL +High 16 bits of 32-bit pc-relative value, adjusted +@end deffn +@deffn {} BFD_RELOC_LO16_PCREL +Low 16 bits of pc-relative value +@end deffn +@deffn {} BFD_RELOC_MIPS16_GOT16 +@deffnx {} BFD_RELOC_MIPS16_CALL16 +Equivalent of BFD_RELOC_MIPS_*, but with the MIPS16 layout of +16-bit immediate fields +@end deffn +@deffn {} BFD_RELOC_MIPS16_HI16 +MIPS16 high 16 bits of 32-bit value. +@end deffn +@deffn {} BFD_RELOC_MIPS16_HI16_S +MIPS16 high 16 bits of 32-bit value but the low 16 bits will be sign +extended and added to form the final result. If the low 16 +bits form a negative number, we need to add one to the high value +to compensate for the borrow when the low bits are added. +@end deffn +@deffn {} BFD_RELOC_MIPS16_LO16 +MIPS16 low 16 bits. +@end deffn +@deffn {} BFD_RELOC_MIPS16_TLS_GD +@deffnx {} BFD_RELOC_MIPS16_TLS_LDM +@deffnx {} BFD_RELOC_MIPS16_TLS_DTPREL_HI16 +@deffnx {} BFD_RELOC_MIPS16_TLS_DTPREL_LO16 +@deffnx {} BFD_RELOC_MIPS16_TLS_GOTTPREL +@deffnx {} BFD_RELOC_MIPS16_TLS_TPREL_HI16 +@deffnx {} BFD_RELOC_MIPS16_TLS_TPREL_LO16 +MIPS16 TLS relocations +@end deffn +@deffn {} BFD_RELOC_MIPS_LITERAL +@deffnx {} BFD_RELOC_MICROMIPS_LITERAL +Relocation against a MIPS literal section. +@end deffn +@deffn {} BFD_RELOC_MICROMIPS_7_PCREL_S1 +@deffnx {} BFD_RELOC_MICROMIPS_10_PCREL_S1 +@deffnx {} BFD_RELOC_MICROMIPS_16_PCREL_S1 +microMIPS PC-relative relocations. +@end deffn +@deffn {} BFD_RELOC_MIPS16_16_PCREL_S1 +MIPS16 PC-relative relocation. +@end deffn +@deffn {} BFD_RELOC_MIPS_21_PCREL_S2 +@deffnx {} BFD_RELOC_MIPS_26_PCREL_S2 +@deffnx {} BFD_RELOC_MIPS_18_PCREL_S3 +@deffnx {} BFD_RELOC_MIPS_19_PCREL_S2 +MIPS PC-relative relocations. +@end deffn +@deffn {} BFD_RELOC_MICROMIPS_GPREL16 +@deffnx {} BFD_RELOC_MICROMIPS_HI16 +@deffnx {} BFD_RELOC_MICROMIPS_HI16_S +@deffnx {} BFD_RELOC_MICROMIPS_LO16 +microMIPS versions of generic BFD relocs. +@end deffn +@deffn {} BFD_RELOC_MIPS_GOT16 +@deffnx {} BFD_RELOC_MICROMIPS_GOT16 +@deffnx {} BFD_RELOC_MIPS_CALL16 +@deffnx {} BFD_RELOC_MICROMIPS_CALL16 +@deffnx {} BFD_RELOC_MIPS_GOT_HI16 +@deffnx {} BFD_RELOC_MICROMIPS_GOT_HI16 +@deffnx {} BFD_RELOC_MIPS_GOT_LO16 +@deffnx {} BFD_RELOC_MICROMIPS_GOT_LO16 +@deffnx {} BFD_RELOC_MIPS_CALL_HI16 +@deffnx {} BFD_RELOC_MICROMIPS_CALL_HI16 +@deffnx {} BFD_RELOC_MIPS_CALL_LO16 +@deffnx {} BFD_RELOC_MICROMIPS_CALL_LO16 +@deffnx {} BFD_RELOC_MIPS_SUB +@deffnx {} BFD_RELOC_MICROMIPS_SUB +@deffnx {} BFD_RELOC_MIPS_GOT_PAGE +@deffnx {} BFD_RELOC_MICROMIPS_GOT_PAGE +@deffnx {} BFD_RELOC_MIPS_GOT_OFST +@deffnx {} BFD_RELOC_MICROMIPS_GOT_OFST +@deffnx {} BFD_RELOC_MIPS_GOT_DISP +@deffnx {} BFD_RELOC_MICROMIPS_GOT_DISP +@deffnx {} BFD_RELOC_MIPS_SHIFT5 +@deffnx {} BFD_RELOC_MIPS_SHIFT6 +@deffnx {} BFD_RELOC_MIPS_INSERT_A +@deffnx {} BFD_RELOC_MIPS_INSERT_B +@deffnx {} BFD_RELOC_MIPS_DELETE +@deffnx {} BFD_RELOC_MIPS_HIGHEST +@deffnx {} BFD_RELOC_MICROMIPS_HIGHEST +@deffnx {} BFD_RELOC_MIPS_HIGHER +@deffnx {} BFD_RELOC_MICROMIPS_HIGHER +@deffnx {} BFD_RELOC_MIPS_SCN_DISP +@deffnx {} BFD_RELOC_MICROMIPS_SCN_DISP +@deffnx {} BFD_RELOC_MIPS_REL16 +@deffnx {} BFD_RELOC_MIPS_RELGOT +@deffnx {} BFD_RELOC_MIPS_JALR +@deffnx {} BFD_RELOC_MICROMIPS_JALR +@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD32 +@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL32 +@deffnx {} BFD_RELOC_MIPS_TLS_DTPMOD64 +@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL64 +@deffnx {} BFD_RELOC_MIPS_TLS_GD +@deffnx {} BFD_RELOC_MICROMIPS_TLS_GD +@deffnx {} BFD_RELOC_MIPS_TLS_LDM +@deffnx {} BFD_RELOC_MICROMIPS_TLS_LDM +@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_HI16 +@deffnx {} BFD_RELOC_MICROMIPS_TLS_DTPREL_HI16 +@deffnx {} BFD_RELOC_MIPS_TLS_DTPREL_LO16 +@deffnx {} BFD_RELOC_MICROMIPS_TLS_DTPREL_LO16 +@deffnx {} BFD_RELOC_MIPS_TLS_GOTTPREL +@deffnx {} BFD_RELOC_MICROMIPS_TLS_GOTTPREL +@deffnx {} BFD_RELOC_MIPS_TLS_TPREL32 +@deffnx {} BFD_RELOC_MIPS_TLS_TPREL64 +@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_HI16 +@deffnx {} BFD_RELOC_MICROMIPS_TLS_TPREL_HI16 +@deffnx {} BFD_RELOC_MIPS_TLS_TPREL_LO16 +@deffnx {} BFD_RELOC_MICROMIPS_TLS_TPREL_LO16 +@deffnx {} BFD_RELOC_MIPS_EH +MIPS ELF relocations. +@end deffn +@deffn {} BFD_RELOC_MIPS_COPY +@deffnx {} BFD_RELOC_MIPS_JUMP_SLOT +MIPS ELF relocations (VxWorks and PLT extensions). +@end deffn +@deffn {} BFD_RELOC_MOXIE_10_PCREL +Moxie ELF relocations. +@end deffn +@deffn {} BFD_RELOC_FT32_10 +@deffnx {} BFD_RELOC_FT32_20 +@deffnx {} BFD_RELOC_FT32_17 +@deffnx {} BFD_RELOC_FT32_18 +@deffnx {} BFD_RELOC_FT32_RELAX +@deffnx {} BFD_RELOC_FT32_SC0 +@deffnx {} BFD_RELOC_FT32_SC1 +@deffnx {} BFD_RELOC_FT32_15 +@deffnx {} BFD_RELOC_FT32_DIFF32 +FT32 ELF relocations. +@end deffn +@deffn {} BFD_RELOC_FRV_LABEL16 +@deffnx {} BFD_RELOC_FRV_LABEL24 +@deffnx {} BFD_RELOC_FRV_LO16 +@deffnx {} BFD_RELOC_FRV_HI16 +@deffnx {} BFD_RELOC_FRV_GPREL12 +@deffnx {} BFD_RELOC_FRV_GPRELU12 +@deffnx {} BFD_RELOC_FRV_GPREL32 +@deffnx {} BFD_RELOC_FRV_GPRELHI +@deffnx {} BFD_RELOC_FRV_GPRELLO +@deffnx {} BFD_RELOC_FRV_GOT12 +@deffnx {} BFD_RELOC_FRV_GOTHI +@deffnx {} BFD_RELOC_FRV_GOTLO +@deffnx {} BFD_RELOC_FRV_FUNCDESC +@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOT12 +@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTHI +@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTLO +@deffnx {} BFD_RELOC_FRV_FUNCDESC_VALUE +@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFF12 +@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFFHI +@deffnx {} BFD_RELOC_FRV_FUNCDESC_GOTOFFLO +@deffnx {} BFD_RELOC_FRV_GOTOFF12 +@deffnx {} BFD_RELOC_FRV_GOTOFFHI +@deffnx {} BFD_RELOC_FRV_GOTOFFLO +@deffnx {} BFD_RELOC_FRV_GETTLSOFF +@deffnx {} BFD_RELOC_FRV_TLSDESC_VALUE +@deffnx {} BFD_RELOC_FRV_GOTTLSDESC12 +@deffnx {} BFD_RELOC_FRV_GOTTLSDESCHI +@deffnx {} BFD_RELOC_FRV_GOTTLSDESCLO +@deffnx {} BFD_RELOC_FRV_TLSMOFF12 +@deffnx {} BFD_RELOC_FRV_TLSMOFFHI +@deffnx {} BFD_RELOC_FRV_TLSMOFFLO +@deffnx {} BFD_RELOC_FRV_GOTTLSOFF12 +@deffnx {} BFD_RELOC_FRV_GOTTLSOFFHI +@deffnx {} BFD_RELOC_FRV_GOTTLSOFFLO +@deffnx {} BFD_RELOC_FRV_TLSOFF +@deffnx {} BFD_RELOC_FRV_TLSDESC_RELAX +@deffnx {} BFD_RELOC_FRV_GETTLSOFF_RELAX +@deffnx {} BFD_RELOC_FRV_TLSOFF_RELAX +@deffnx {} BFD_RELOC_FRV_TLSMOFF +Fujitsu Frv Relocations. +@end deffn +@deffn {} BFD_RELOC_MN10300_GOTOFF24 +This is a 24bit GOT-relative reloc for the mn10300. +@end deffn +@deffn {} BFD_RELOC_MN10300_GOT32 +This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes +in the instruction. +@end deffn +@deffn {} BFD_RELOC_MN10300_GOT24 +This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes +in the instruction. +@end deffn +@deffn {} BFD_RELOC_MN10300_GOT16 +This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes +in the instruction. +@end deffn +@deffn {} BFD_RELOC_MN10300_COPY +Copy symbol at runtime. +@end deffn +@deffn {} BFD_RELOC_MN10300_GLOB_DAT +Create GOT entry. +@end deffn +@deffn {} BFD_RELOC_MN10300_JMP_SLOT +Create PLT entry. +@end deffn +@deffn {} BFD_RELOC_MN10300_RELATIVE +Adjust by program base. +@end deffn +@deffn {} BFD_RELOC_MN10300_SYM_DIFF +Together with another reloc targeted at the same location, +allows for a value that is the difference of two symbols +in the same section. +@end deffn +@deffn {} BFD_RELOC_MN10300_ALIGN +The addend of this reloc is an alignment power that must +be honoured at the offset's location, regardless of linker +relaxation. +@end deffn +@deffn {} BFD_RELOC_MN10300_TLS_GD +@deffnx {} BFD_RELOC_MN10300_TLS_LD +@deffnx {} BFD_RELOC_MN10300_TLS_LDO +@deffnx {} BFD_RELOC_MN10300_TLS_GOTIE +@deffnx {} BFD_RELOC_MN10300_TLS_IE +@deffnx {} BFD_RELOC_MN10300_TLS_LE +@deffnx {} BFD_RELOC_MN10300_TLS_DTPMOD +@deffnx {} BFD_RELOC_MN10300_TLS_DTPOFF +@deffnx {} BFD_RELOC_MN10300_TLS_TPOFF +Various TLS-related relocations. +@end deffn +@deffn {} BFD_RELOC_MN10300_32_PCREL +This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the +instruction. +@end deffn +@deffn {} BFD_RELOC_MN10300_16_PCREL +This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the +instruction. +@end deffn +@deffn {} BFD_RELOC_386_GOT32 +@deffnx {} BFD_RELOC_386_PLT32 +@deffnx {} BFD_RELOC_386_COPY +@deffnx {} BFD_RELOC_386_GLOB_DAT +@deffnx {} BFD_RELOC_386_JUMP_SLOT +@deffnx {} BFD_RELOC_386_RELATIVE +@deffnx {} BFD_RELOC_386_GOTOFF +@deffnx {} BFD_RELOC_386_GOTPC +@deffnx {} BFD_RELOC_386_TLS_TPOFF +@deffnx {} BFD_RELOC_386_TLS_IE +@deffnx {} BFD_RELOC_386_TLS_GOTIE +@deffnx {} BFD_RELOC_386_TLS_LE +@deffnx {} BFD_RELOC_386_TLS_GD +@deffnx {} BFD_RELOC_386_TLS_LDM +@deffnx {} BFD_RELOC_386_TLS_LDO_32 +@deffnx {} BFD_RELOC_386_TLS_IE_32 +@deffnx {} BFD_RELOC_386_TLS_LE_32 +@deffnx {} BFD_RELOC_386_TLS_DTPMOD32 +@deffnx {} BFD_RELOC_386_TLS_DTPOFF32 +@deffnx {} BFD_RELOC_386_TLS_TPOFF32 +@deffnx {} BFD_RELOC_386_TLS_GOTDESC +@deffnx {} BFD_RELOC_386_TLS_DESC_CALL +@deffnx {} BFD_RELOC_386_TLS_DESC +@deffnx {} BFD_RELOC_386_IRELATIVE +@deffnx {} BFD_RELOC_386_GOT32X +i386/elf relocations +@end deffn +@deffn {} BFD_RELOC_X86_64_GOT32 +@deffnx {} BFD_RELOC_X86_64_PLT32 +@deffnx {} BFD_RELOC_X86_64_COPY +@deffnx {} BFD_RELOC_X86_64_GLOB_DAT +@deffnx {} BFD_RELOC_X86_64_JUMP_SLOT +@deffnx {} BFD_RELOC_X86_64_RELATIVE +@deffnx {} BFD_RELOC_X86_64_GOTPCREL +@deffnx {} BFD_RELOC_X86_64_32S +@deffnx {} BFD_RELOC_X86_64_DTPMOD64 +@deffnx {} BFD_RELOC_X86_64_DTPOFF64 +@deffnx {} BFD_RELOC_X86_64_TPOFF64 +@deffnx {} BFD_RELOC_X86_64_TLSGD +@deffnx {} BFD_RELOC_X86_64_TLSLD +@deffnx {} BFD_RELOC_X86_64_DTPOFF32 +@deffnx {} BFD_RELOC_X86_64_GOTTPOFF +@deffnx {} BFD_RELOC_X86_64_TPOFF32 +@deffnx {} BFD_RELOC_X86_64_GOTOFF64 +@deffnx {} BFD_RELOC_X86_64_GOTPC32 +@deffnx {} BFD_RELOC_X86_64_GOT64 +@deffnx {} BFD_RELOC_X86_64_GOTPCREL64 +@deffnx {} BFD_RELOC_X86_64_GOTPC64 +@deffnx {} BFD_RELOC_X86_64_GOTPLT64 +@deffnx {} BFD_RELOC_X86_64_PLTOFF64 +@deffnx {} BFD_RELOC_X86_64_GOTPC32_TLSDESC +@deffnx {} BFD_RELOC_X86_64_TLSDESC_CALL +@deffnx {} BFD_RELOC_X86_64_TLSDESC +@deffnx {} BFD_RELOC_X86_64_IRELATIVE +@deffnx {} BFD_RELOC_X86_64_PC32_BND +@deffnx {} BFD_RELOC_X86_64_PLT32_BND +@deffnx {} BFD_RELOC_X86_64_GOTPCRELX +@deffnx {} BFD_RELOC_X86_64_REX_GOTPCRELX +x86-64/elf relocations +@end deffn +@deffn {} BFD_RELOC_NS32K_IMM_8 +@deffnx {} BFD_RELOC_NS32K_IMM_16 +@deffnx {} BFD_RELOC_NS32K_IMM_32 +@deffnx {} BFD_RELOC_NS32K_IMM_8_PCREL +@deffnx {} BFD_RELOC_NS32K_IMM_16_PCREL +@deffnx {} BFD_RELOC_NS32K_IMM_32_PCREL +@deffnx {} BFD_RELOC_NS32K_DISP_8 +@deffnx {} BFD_RELOC_NS32K_DISP_16 +@deffnx {} BFD_RELOC_NS32K_DISP_32 +@deffnx {} BFD_RELOC_NS32K_DISP_8_PCREL +@deffnx {} BFD_RELOC_NS32K_DISP_16_PCREL +@deffnx {} BFD_RELOC_NS32K_DISP_32_PCREL +ns32k relocations +@end deffn +@deffn {} BFD_RELOC_PDP11_DISP_8_PCREL +@deffnx {} BFD_RELOC_PDP11_DISP_6_PCREL +PDP11 relocations +@end deffn +@deffn {} BFD_RELOC_PJ_CODE_HI16 +@deffnx {} BFD_RELOC_PJ_CODE_LO16 +@deffnx {} BFD_RELOC_PJ_CODE_DIR16 +@deffnx {} BFD_RELOC_PJ_CODE_DIR32 +@deffnx {} BFD_RELOC_PJ_CODE_REL16 +@deffnx {} BFD_RELOC_PJ_CODE_REL32 +Picojava relocs. Not all of these appear in object files. +@end deffn +@deffn {} BFD_RELOC_PPC_B26 +@deffnx {} BFD_RELOC_PPC_BA26 +@deffnx {} BFD_RELOC_PPC_TOC16 +@deffnx {} BFD_RELOC_PPC_B16 +@deffnx {} BFD_RELOC_PPC_B16_BRTAKEN +@deffnx {} BFD_RELOC_PPC_B16_BRNTAKEN +@deffnx {} BFD_RELOC_PPC_BA16 +@deffnx {} BFD_RELOC_PPC_BA16_BRTAKEN +@deffnx {} BFD_RELOC_PPC_BA16_BRNTAKEN +@deffnx {} BFD_RELOC_PPC_COPY +@deffnx {} BFD_RELOC_PPC_GLOB_DAT +@deffnx {} BFD_RELOC_PPC_JMP_SLOT +@deffnx {} BFD_RELOC_PPC_RELATIVE +@deffnx {} BFD_RELOC_PPC_LOCAL24PC +@deffnx {} BFD_RELOC_PPC_EMB_NADDR32 +@deffnx {} BFD_RELOC_PPC_EMB_NADDR16 +@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_LO +@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HI +@deffnx {} BFD_RELOC_PPC_EMB_NADDR16_HA +@deffnx {} BFD_RELOC_PPC_EMB_SDAI16 +@deffnx {} BFD_RELOC_PPC_EMB_SDA2I16 +@deffnx {} BFD_RELOC_PPC_EMB_SDA2REL +@deffnx {} BFD_RELOC_PPC_EMB_SDA21 +@deffnx {} BFD_RELOC_PPC_EMB_MRKREF +@deffnx {} BFD_RELOC_PPC_EMB_RELSEC16 +@deffnx {} BFD_RELOC_PPC_EMB_RELST_LO +@deffnx {} BFD_RELOC_PPC_EMB_RELST_HI +@deffnx {} BFD_RELOC_PPC_EMB_RELST_HA +@deffnx {} BFD_RELOC_PPC_EMB_BIT_FLD +@deffnx {} BFD_RELOC_PPC_EMB_RELSDA +@deffnx {} BFD_RELOC_PPC_VLE_REL8 +@deffnx {} BFD_RELOC_PPC_VLE_REL15 +@deffnx {} BFD_RELOC_PPC_VLE_REL24 +@deffnx {} BFD_RELOC_PPC_VLE_LO16A +@deffnx {} BFD_RELOC_PPC_VLE_LO16D +@deffnx {} BFD_RELOC_PPC_VLE_HI16A +@deffnx {} BFD_RELOC_PPC_VLE_HI16D +@deffnx {} BFD_RELOC_PPC_VLE_HA16A +@deffnx {} BFD_RELOC_PPC_VLE_HA16D +@deffnx {} BFD_RELOC_PPC_VLE_SDA21 +@deffnx {} BFD_RELOC_PPC_VLE_SDA21_LO +@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_LO16A +@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_LO16D +@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_HI16A +@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_HI16D +@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_HA16A +@deffnx {} BFD_RELOC_PPC_VLE_SDAREL_HA16D +@deffnx {} BFD_RELOC_PPC_16DX_HA +@deffnx {} BFD_RELOC_PPC_REL16DX_HA +@deffnx {} BFD_RELOC_PPC64_HIGHER +@deffnx {} BFD_RELOC_PPC64_HIGHER_S +@deffnx {} BFD_RELOC_PPC64_HIGHEST +@deffnx {} BFD_RELOC_PPC64_HIGHEST_S +@deffnx {} BFD_RELOC_PPC64_TOC16_LO +@deffnx {} BFD_RELOC_PPC64_TOC16_HI +@deffnx {} BFD_RELOC_PPC64_TOC16_HA +@deffnx {} BFD_RELOC_PPC64_TOC +@deffnx {} BFD_RELOC_PPC64_PLTGOT16 +@deffnx {} BFD_RELOC_PPC64_PLTGOT16_LO +@deffnx {} BFD_RELOC_PPC64_PLTGOT16_HI +@deffnx {} BFD_RELOC_PPC64_PLTGOT16_HA +@deffnx {} BFD_RELOC_PPC64_ADDR16_DS +@deffnx {} BFD_RELOC_PPC64_ADDR16_LO_DS +@deffnx {} BFD_RELOC_PPC64_GOT16_DS +@deffnx {} BFD_RELOC_PPC64_GOT16_LO_DS +@deffnx {} BFD_RELOC_PPC64_PLT16_LO_DS +@deffnx {} BFD_RELOC_PPC64_SECTOFF_DS +@deffnx {} BFD_RELOC_PPC64_SECTOFF_LO_DS +@deffnx {} BFD_RELOC_PPC64_TOC16_DS +@deffnx {} BFD_RELOC_PPC64_TOC16_LO_DS +@deffnx {} BFD_RELOC_PPC64_PLTGOT16_DS +@deffnx {} BFD_RELOC_PPC64_PLTGOT16_LO_DS +@deffnx {} BFD_RELOC_PPC64_ADDR16_HIGH +@deffnx {} BFD_RELOC_PPC64_ADDR16_HIGHA +@deffnx {} BFD_RELOC_PPC64_REL16_HIGH +@deffnx {} BFD_RELOC_PPC64_REL16_HIGHA +@deffnx {} BFD_RELOC_PPC64_REL16_HIGHER +@deffnx {} BFD_RELOC_PPC64_REL16_HIGHERA +@deffnx {} BFD_RELOC_PPC64_REL16_HIGHEST +@deffnx {} BFD_RELOC_PPC64_REL16_HIGHESTA +@deffnx {} BFD_RELOC_PPC64_ADDR64_LOCAL +@deffnx {} BFD_RELOC_PPC64_ENTRY +@deffnx {} BFD_RELOC_PPC64_REL24_NOTOC +Power(rs6000) and PowerPC relocations. +@end deffn +@deffn {} BFD_RELOC_PPC_TLS +@deffnx {} BFD_RELOC_PPC_TLSGD +@deffnx {} BFD_RELOC_PPC_TLSLD +@deffnx {} BFD_RELOC_PPC_DTPMOD +@deffnx {} BFD_RELOC_PPC_TPREL16 +@deffnx {} BFD_RELOC_PPC_TPREL16_LO +@deffnx {} BFD_RELOC_PPC_TPREL16_HI +@deffnx {} BFD_RELOC_PPC_TPREL16_HA +@deffnx {} BFD_RELOC_PPC_TPREL +@deffnx {} BFD_RELOC_PPC_DTPREL16 +@deffnx {} BFD_RELOC_PPC_DTPREL16_LO +@deffnx {} BFD_RELOC_PPC_DTPREL16_HI +@deffnx {} BFD_RELOC_PPC_DTPREL16_HA +@deffnx {} BFD_RELOC_PPC_DTPREL +@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16 +@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_LO +@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_HI +@deffnx {} BFD_RELOC_PPC_GOT_TLSGD16_HA +@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16 +@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_LO +@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_HI +@deffnx {} BFD_RELOC_PPC_GOT_TLSLD16_HA +@deffnx {} BFD_RELOC_PPC_GOT_TPREL16 +@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_LO +@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_HI +@deffnx {} BFD_RELOC_PPC_GOT_TPREL16_HA +@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16 +@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_LO +@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_HI +@deffnx {} BFD_RELOC_PPC_GOT_DTPREL16_HA +@deffnx {} BFD_RELOC_PPC64_TPREL16_DS +@deffnx {} BFD_RELOC_PPC64_TPREL16_LO_DS +@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHER +@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHERA +@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHEST +@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHESTA +@deffnx {} BFD_RELOC_PPC64_DTPREL16_DS +@deffnx {} BFD_RELOC_PPC64_DTPREL16_LO_DS +@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHER +@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHERA +@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHEST +@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHESTA +@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGH +@deffnx {} BFD_RELOC_PPC64_TPREL16_HIGHA +@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGH +@deffnx {} BFD_RELOC_PPC64_DTPREL16_HIGHA +PowerPC and PowerPC64 thread-local storage relocations. +@end deffn +@deffn {} BFD_RELOC_I370_D12 +IBM 370/390 relocations +@end deffn +@deffn {} BFD_RELOC_CTOR +The type of reloc used to build a constructor table - at the moment +probably a 32 bit wide absolute relocation, but the target can choose. +It generally does map to one of the other relocation types. +@end deffn +@deffn {} BFD_RELOC_ARM_PCREL_BRANCH +ARM 26 bit pc-relative branch. The lowest two bits must be zero and are +not stored in the instruction. +@end deffn +@deffn {} BFD_RELOC_ARM_PCREL_BLX +ARM 26 bit pc-relative branch. The lowest bit must be zero and is +not stored in the instruction. The 2nd lowest bit comes from a 1 bit +field in the instruction. +@end deffn +@deffn {} BFD_RELOC_THUMB_PCREL_BLX +Thumb 22 bit pc-relative branch. The lowest bit must be zero and is +not stored in the instruction. The 2nd lowest bit comes from a 1 bit +field in the instruction. +@end deffn +@deffn {} BFD_RELOC_ARM_PCREL_CALL +ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction. +@end deffn +@deffn {} BFD_RELOC_ARM_PCREL_JUMP +ARM 26-bit pc-relative branch for B or conditional BL instruction. +@end deffn +@deffn {} BFD_RELOC_THUMB_PCREL_BRANCH7 +@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH9 +@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH12 +@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH20 +@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH23 +@deffnx {} BFD_RELOC_THUMB_PCREL_BRANCH25 +Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches. +The lowest bit must be zero and is not stored in the instruction. +Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an +"nn" one smaller in all cases. Note further that BRANCH23 +corresponds to R_ARM_THM_CALL. +@end deffn +@deffn {} BFD_RELOC_ARM_OFFSET_IMM +12-bit immediate offset, used in ARM-format ldr and str instructions. +@end deffn +@deffn {} BFD_RELOC_ARM_THUMB_OFFSET +5-bit immediate offset, used in Thumb-format ldr and str instructions. +@end deffn +@deffn {} BFD_RELOC_ARM_TARGET1 +Pc-relative or absolute relocation depending on target. Used for +entries in .init_array sections. +@end deffn +@deffn {} BFD_RELOC_ARM_ROSEGREL32 +Read-only segment base relative address. +@end deffn +@deffn {} BFD_RELOC_ARM_SBREL32 +Data segment base relative address. +@end deffn +@deffn {} BFD_RELOC_ARM_TARGET2 +This reloc is used for references to RTTI data from exception handling +tables. The actual definition depends on the target. It may be a +pc-relative or some form of GOT-indirect relocation. +@end deffn +@deffn {} BFD_RELOC_ARM_PREL31 +31-bit PC relative address. +@end deffn +@deffn {} BFD_RELOC_ARM_MOVW +@deffnx {} BFD_RELOC_ARM_MOVT +@deffnx {} BFD_RELOC_ARM_MOVW_PCREL +@deffnx {} BFD_RELOC_ARM_MOVT_PCREL +@deffnx {} BFD_RELOC_ARM_THUMB_MOVW +@deffnx {} BFD_RELOC_ARM_THUMB_MOVT +@deffnx {} BFD_RELOC_ARM_THUMB_MOVW_PCREL +@deffnx {} BFD_RELOC_ARM_THUMB_MOVT_PCREL +Low and High halfword relocations for MOVW and MOVT instructions. +@end deffn +@deffn {} BFD_RELOC_ARM_GOTFUNCDESC +@deffnx {} BFD_RELOC_ARM_GOTOFFFUNCDESC +@deffnx {} BFD_RELOC_ARM_FUNCDESC +@deffnx {} BFD_RELOC_ARM_FUNCDESC_VALUE +@deffnx {} BFD_RELOC_ARM_TLS_GD32_FDPIC +@deffnx {} BFD_RELOC_ARM_TLS_LDM32_FDPIC +@deffnx {} BFD_RELOC_ARM_TLS_IE32_FDPIC +ARM FDPIC specific relocations. +@end deffn +@deffn {} BFD_RELOC_ARM_JUMP_SLOT +@deffnx {} BFD_RELOC_ARM_GLOB_DAT +@deffnx {} BFD_RELOC_ARM_GOT32 +@deffnx {} BFD_RELOC_ARM_PLT32 +@deffnx {} BFD_RELOC_ARM_RELATIVE +@deffnx {} BFD_RELOC_ARM_GOTOFF +@deffnx {} BFD_RELOC_ARM_GOTPC +@deffnx {} BFD_RELOC_ARM_GOT_PREL +Relocations for setting up GOTs and PLTs for shared libraries. +@end deffn +@deffn {} BFD_RELOC_ARM_TLS_GD32 +@deffnx {} BFD_RELOC_ARM_TLS_LDO32 +@deffnx {} BFD_RELOC_ARM_TLS_LDM32 +@deffnx {} BFD_RELOC_ARM_TLS_DTPOFF32 +@deffnx {} BFD_RELOC_ARM_TLS_DTPMOD32 +@deffnx {} BFD_RELOC_ARM_TLS_TPOFF32 +@deffnx {} BFD_RELOC_ARM_TLS_IE32 +@deffnx {} BFD_RELOC_ARM_TLS_LE32 +@deffnx {} BFD_RELOC_ARM_TLS_GOTDESC +@deffnx {} BFD_RELOC_ARM_TLS_CALL +@deffnx {} BFD_RELOC_ARM_THM_TLS_CALL +@deffnx {} BFD_RELOC_ARM_TLS_DESCSEQ +@deffnx {} BFD_RELOC_ARM_THM_TLS_DESCSEQ +@deffnx {} BFD_RELOC_ARM_TLS_DESC +ARM thread-local storage relocations. +@end deffn +@deffn {} BFD_RELOC_ARM_ALU_PC_G0_NC +@deffnx {} BFD_RELOC_ARM_ALU_PC_G0 +@deffnx {} BFD_RELOC_ARM_ALU_PC_G1_NC +@deffnx {} BFD_RELOC_ARM_ALU_PC_G1 +@deffnx {} BFD_RELOC_ARM_ALU_PC_G2 +@deffnx {} BFD_RELOC_ARM_LDR_PC_G0 +@deffnx {} BFD_RELOC_ARM_LDR_PC_G1 +@deffnx {} BFD_RELOC_ARM_LDR_PC_G2 +@deffnx {} BFD_RELOC_ARM_LDRS_PC_G0 +@deffnx {} BFD_RELOC_ARM_LDRS_PC_G1 +@deffnx {} BFD_RELOC_ARM_LDRS_PC_G2 +@deffnx {} BFD_RELOC_ARM_LDC_PC_G0 +@deffnx {} BFD_RELOC_ARM_LDC_PC_G1 +@deffnx {} BFD_RELOC_ARM_LDC_PC_G2 +@deffnx {} BFD_RELOC_ARM_ALU_SB_G0_NC +@deffnx {} BFD_RELOC_ARM_ALU_SB_G0 +@deffnx {} BFD_RELOC_ARM_ALU_SB_G1_NC +@deffnx {} BFD_RELOC_ARM_ALU_SB_G1 +@deffnx {} BFD_RELOC_ARM_ALU_SB_G2 +@deffnx {} BFD_RELOC_ARM_LDR_SB_G0 +@deffnx {} BFD_RELOC_ARM_LDR_SB_G1 +@deffnx {} BFD_RELOC_ARM_LDR_SB_G2 +@deffnx {} BFD_RELOC_ARM_LDRS_SB_G0 +@deffnx {} BFD_RELOC_ARM_LDRS_SB_G1 +@deffnx {} BFD_RELOC_ARM_LDRS_SB_G2 +@deffnx {} BFD_RELOC_ARM_LDC_SB_G0 +@deffnx {} BFD_RELOC_ARM_LDC_SB_G1 +@deffnx {} BFD_RELOC_ARM_LDC_SB_G2 +ARM group relocations. +@end deffn +@deffn {} BFD_RELOC_ARM_V4BX +Annotation of BX instructions. +@end deffn +@deffn {} BFD_RELOC_ARM_IRELATIVE +ARM support for STT_GNU_IFUNC. +@end deffn +@deffn {} BFD_RELOC_ARM_THUMB_ALU_ABS_G0_NC +@deffnx {} BFD_RELOC_ARM_THUMB_ALU_ABS_G1_NC +@deffnx {} BFD_RELOC_ARM_THUMB_ALU_ABS_G2_NC +@deffnx {} BFD_RELOC_ARM_THUMB_ALU_ABS_G3_NC +Thumb1 relocations to support execute-only code. +@end deffn +@deffn {} BFD_RELOC_ARM_IMMEDIATE +@deffnx {} BFD_RELOC_ARM_ADRL_IMMEDIATE +@deffnx {} BFD_RELOC_ARM_T32_IMMEDIATE +@deffnx {} BFD_RELOC_ARM_T32_ADD_IMM +@deffnx {} BFD_RELOC_ARM_T32_IMM12 +@deffnx {} BFD_RELOC_ARM_T32_ADD_PC12 +@deffnx {} BFD_RELOC_ARM_SHIFT_IMM +@deffnx {} BFD_RELOC_ARM_SMC +@deffnx {} BFD_RELOC_ARM_HVC +@deffnx {} BFD_RELOC_ARM_SWI +@deffnx {} BFD_RELOC_ARM_MULTI +@deffnx {} BFD_RELOC_ARM_CP_OFF_IMM +@deffnx {} BFD_RELOC_ARM_CP_OFF_IMM_S2 +@deffnx {} BFD_RELOC_ARM_T32_CP_OFF_IMM +@deffnx {} BFD_RELOC_ARM_T32_CP_OFF_IMM_S2 +@deffnx {} BFD_RELOC_ARM_ADR_IMM +@deffnx {} BFD_RELOC_ARM_LDR_IMM +@deffnx {} BFD_RELOC_ARM_LITERAL +@deffnx {} BFD_RELOC_ARM_IN_POOL +@deffnx {} BFD_RELOC_ARM_OFFSET_IMM8 +@deffnx {} BFD_RELOC_ARM_T32_OFFSET_U8 +@deffnx {} BFD_RELOC_ARM_T32_OFFSET_IMM +@deffnx {} BFD_RELOC_ARM_HWLITERAL +@deffnx {} BFD_RELOC_ARM_THUMB_ADD +@deffnx {} BFD_RELOC_ARM_THUMB_IMM +@deffnx {} BFD_RELOC_ARM_THUMB_SHIFT +These relocs are only used within the ARM assembler. They are not +(at present) written to any object files. +@end deffn +@deffn {} BFD_RELOC_SH_PCDISP8BY2 +@deffnx {} BFD_RELOC_SH_PCDISP12BY2 +@deffnx {} BFD_RELOC_SH_IMM3 +@deffnx {} BFD_RELOC_SH_IMM3U +@deffnx {} BFD_RELOC_SH_DISP12 +@deffnx {} BFD_RELOC_SH_DISP12BY2 +@deffnx {} BFD_RELOC_SH_DISP12BY4 +@deffnx {} BFD_RELOC_SH_DISP12BY8 +@deffnx {} BFD_RELOC_SH_DISP20 +@deffnx {} BFD_RELOC_SH_DISP20BY8 +@deffnx {} BFD_RELOC_SH_IMM4 +@deffnx {} BFD_RELOC_SH_IMM4BY2 +@deffnx {} BFD_RELOC_SH_IMM4BY4 +@deffnx {} BFD_RELOC_SH_IMM8 +@deffnx {} BFD_RELOC_SH_IMM8BY2 +@deffnx {} BFD_RELOC_SH_IMM8BY4 +@deffnx {} BFD_RELOC_SH_PCRELIMM8BY2 +@deffnx {} BFD_RELOC_SH_PCRELIMM8BY4 +@deffnx {} BFD_RELOC_SH_SWITCH16 +@deffnx {} BFD_RELOC_SH_SWITCH32 +@deffnx {} BFD_RELOC_SH_USES +@deffnx {} BFD_RELOC_SH_COUNT +@deffnx {} BFD_RELOC_SH_ALIGN +@deffnx {} BFD_RELOC_SH_CODE +@deffnx {} BFD_RELOC_SH_DATA +@deffnx {} BFD_RELOC_SH_LABEL +@deffnx {} BFD_RELOC_SH_LOOP_START +@deffnx {} BFD_RELOC_SH_LOOP_END +@deffnx {} BFD_RELOC_SH_COPY +@deffnx {} BFD_RELOC_SH_GLOB_DAT +@deffnx {} BFD_RELOC_SH_JMP_SLOT +@deffnx {} BFD_RELOC_SH_RELATIVE +@deffnx {} BFD_RELOC_SH_GOTPC +@deffnx {} BFD_RELOC_SH_GOT_LOW16 +@deffnx {} BFD_RELOC_SH_GOT_MEDLOW16 +@deffnx {} BFD_RELOC_SH_GOT_MEDHI16 +@deffnx {} BFD_RELOC_SH_GOT_HI16 +@deffnx {} BFD_RELOC_SH_GOTPLT_LOW16 +@deffnx {} BFD_RELOC_SH_GOTPLT_MEDLOW16 +@deffnx {} BFD_RELOC_SH_GOTPLT_MEDHI16 +@deffnx {} BFD_RELOC_SH_GOTPLT_HI16 +@deffnx {} BFD_RELOC_SH_PLT_LOW16 +@deffnx {} BFD_RELOC_SH_PLT_MEDLOW16 +@deffnx {} BFD_RELOC_SH_PLT_MEDHI16 +@deffnx {} BFD_RELOC_SH_PLT_HI16 +@deffnx {} BFD_RELOC_SH_GOTOFF_LOW16 +@deffnx {} BFD_RELOC_SH_GOTOFF_MEDLOW16 +@deffnx {} BFD_RELOC_SH_GOTOFF_MEDHI16 +@deffnx {} BFD_RELOC_SH_GOTOFF_HI16 +@deffnx {} BFD_RELOC_SH_GOTPC_LOW16 +@deffnx {} BFD_RELOC_SH_GOTPC_MEDLOW16 +@deffnx {} BFD_RELOC_SH_GOTPC_MEDHI16 +@deffnx {} BFD_RELOC_SH_GOTPC_HI16 +@deffnx {} BFD_RELOC_SH_COPY64 +@deffnx {} BFD_RELOC_SH_GLOB_DAT64 +@deffnx {} BFD_RELOC_SH_JMP_SLOT64 +@deffnx {} BFD_RELOC_SH_RELATIVE64 +@deffnx {} BFD_RELOC_SH_GOT10BY4 +@deffnx {} BFD_RELOC_SH_GOT10BY8 +@deffnx {} BFD_RELOC_SH_GOTPLT10BY4 +@deffnx {} BFD_RELOC_SH_GOTPLT10BY8 +@deffnx {} BFD_RELOC_SH_GOTPLT32 +@deffnx {} BFD_RELOC_SH_SHMEDIA_CODE +@deffnx {} BFD_RELOC_SH_IMMU5 +@deffnx {} BFD_RELOC_SH_IMMS6 +@deffnx {} BFD_RELOC_SH_IMMS6BY32 +@deffnx {} BFD_RELOC_SH_IMMU6 +@deffnx {} BFD_RELOC_SH_IMMS10 +@deffnx {} BFD_RELOC_SH_IMMS10BY2 +@deffnx {} BFD_RELOC_SH_IMMS10BY4 +@deffnx {} BFD_RELOC_SH_IMMS10BY8 +@deffnx {} BFD_RELOC_SH_IMMS16 +@deffnx {} BFD_RELOC_SH_IMMU16 +@deffnx {} BFD_RELOC_SH_IMM_LOW16 +@deffnx {} BFD_RELOC_SH_IMM_LOW16_PCREL +@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16 +@deffnx {} BFD_RELOC_SH_IMM_MEDLOW16_PCREL +@deffnx {} BFD_RELOC_SH_IMM_MEDHI16 +@deffnx {} BFD_RELOC_SH_IMM_MEDHI16_PCREL +@deffnx {} BFD_RELOC_SH_IMM_HI16 +@deffnx {} BFD_RELOC_SH_IMM_HI16_PCREL +@deffnx {} BFD_RELOC_SH_PT_16 +@deffnx {} BFD_RELOC_SH_TLS_GD_32 +@deffnx {} BFD_RELOC_SH_TLS_LD_32 +@deffnx {} BFD_RELOC_SH_TLS_LDO_32 +@deffnx {} BFD_RELOC_SH_TLS_IE_32 +@deffnx {} BFD_RELOC_SH_TLS_LE_32 +@deffnx {} BFD_RELOC_SH_TLS_DTPMOD32 +@deffnx {} BFD_RELOC_SH_TLS_DTPOFF32 +@deffnx {} BFD_RELOC_SH_TLS_TPOFF32 +@deffnx {} BFD_RELOC_SH_GOT20 +@deffnx {} BFD_RELOC_SH_GOTOFF20 +@deffnx {} BFD_RELOC_SH_GOTFUNCDESC +@deffnx {} BFD_RELOC_SH_GOTFUNCDESC20 +@deffnx {} BFD_RELOC_SH_GOTOFFFUNCDESC +@deffnx {} BFD_RELOC_SH_GOTOFFFUNCDESC20 +@deffnx {} BFD_RELOC_SH_FUNCDESC +Renesas / SuperH SH relocs. Not all of these appear in object files. +@end deffn +@deffn {} BFD_RELOC_ARC_NONE +@deffnx {} BFD_RELOC_ARC_8 +@deffnx {} BFD_RELOC_ARC_16 +@deffnx {} BFD_RELOC_ARC_24 +@deffnx {} BFD_RELOC_ARC_32 +@deffnx {} BFD_RELOC_ARC_N8 +@deffnx {} BFD_RELOC_ARC_N16 +@deffnx {} BFD_RELOC_ARC_N24 +@deffnx {} BFD_RELOC_ARC_N32 +@deffnx {} BFD_RELOC_ARC_SDA +@deffnx {} BFD_RELOC_ARC_SECTOFF +@deffnx {} BFD_RELOC_ARC_S21H_PCREL +@deffnx {} BFD_RELOC_ARC_S21W_PCREL +@deffnx {} BFD_RELOC_ARC_S25H_PCREL +@deffnx {} BFD_RELOC_ARC_S25W_PCREL +@deffnx {} BFD_RELOC_ARC_SDA32 +@deffnx {} BFD_RELOC_ARC_SDA_LDST +@deffnx {} BFD_RELOC_ARC_SDA_LDST1 +@deffnx {} BFD_RELOC_ARC_SDA_LDST2 +@deffnx {} BFD_RELOC_ARC_SDA16_LD +@deffnx {} BFD_RELOC_ARC_SDA16_LD1 +@deffnx {} BFD_RELOC_ARC_SDA16_LD2 +@deffnx {} BFD_RELOC_ARC_S13_PCREL +@deffnx {} BFD_RELOC_ARC_W +@deffnx {} BFD_RELOC_ARC_32_ME +@deffnx {} BFD_RELOC_ARC_32_ME_S +@deffnx {} BFD_RELOC_ARC_N32_ME +@deffnx {} BFD_RELOC_ARC_SECTOFF_ME +@deffnx {} BFD_RELOC_ARC_SDA32_ME +@deffnx {} BFD_RELOC_ARC_W_ME +@deffnx {} BFD_RELOC_AC_SECTOFF_U8 +@deffnx {} BFD_RELOC_AC_SECTOFF_U8_1 +@deffnx {} BFD_RELOC_AC_SECTOFF_U8_2 +@deffnx {} BFD_RELOC_AC_SECTOFF_S9 +@deffnx {} BFD_RELOC_AC_SECTOFF_S9_1 +@deffnx {} BFD_RELOC_AC_SECTOFF_S9_2 +@deffnx {} BFD_RELOC_ARC_SECTOFF_ME_1 +@deffnx {} BFD_RELOC_ARC_SECTOFF_ME_2 +@deffnx {} BFD_RELOC_ARC_SECTOFF_1 +@deffnx {} BFD_RELOC_ARC_SECTOFF_2 +@deffnx {} BFD_RELOC_ARC_SDA_12 +@deffnx {} BFD_RELOC_ARC_SDA16_ST2 +@deffnx {} BFD_RELOC_ARC_32_PCREL +@deffnx {} BFD_RELOC_ARC_PC32 +@deffnx {} BFD_RELOC_ARC_GOT32 +@deffnx {} BFD_RELOC_ARC_GOTPC32 +@deffnx {} BFD_RELOC_ARC_PLT32 +@deffnx {} BFD_RELOC_ARC_COPY +@deffnx {} BFD_RELOC_ARC_GLOB_DAT +@deffnx {} BFD_RELOC_ARC_JMP_SLOT +@deffnx {} BFD_RELOC_ARC_RELATIVE +@deffnx {} BFD_RELOC_ARC_GOTOFF +@deffnx {} BFD_RELOC_ARC_GOTPC +@deffnx {} BFD_RELOC_ARC_S21W_PCREL_PLT +@deffnx {} BFD_RELOC_ARC_S25H_PCREL_PLT +@deffnx {} BFD_RELOC_ARC_TLS_DTPMOD +@deffnx {} BFD_RELOC_ARC_TLS_TPOFF +@deffnx {} BFD_RELOC_ARC_TLS_GD_GOT +@deffnx {} BFD_RELOC_ARC_TLS_GD_LD +@deffnx {} BFD_RELOC_ARC_TLS_GD_CALL +@deffnx {} BFD_RELOC_ARC_TLS_IE_GOT +@deffnx {} BFD_RELOC_ARC_TLS_DTPOFF +@deffnx {} BFD_RELOC_ARC_TLS_DTPOFF_S9 +@deffnx {} BFD_RELOC_ARC_TLS_LE_S9 +@deffnx {} BFD_RELOC_ARC_TLS_LE_32 +@deffnx {} BFD_RELOC_ARC_S25W_PCREL_PLT +@deffnx {} BFD_RELOC_ARC_S21H_PCREL_PLT +@deffnx {} BFD_RELOC_ARC_NPS_CMEM16 +@deffnx {} BFD_RELOC_ARC_JLI_SECTOFF +ARC relocs. +@end deffn +@deffn {} BFD_RELOC_BFIN_16_IMM +ADI Blackfin 16 bit immediate absolute reloc. +@end deffn +@deffn {} BFD_RELOC_BFIN_16_HIGH +ADI Blackfin 16 bit immediate absolute reloc higher 16 bits. +@end deffn +@deffn {} BFD_RELOC_BFIN_4_PCREL +ADI Blackfin 'a' part of LSETUP. +@end deffn +@deffn {} BFD_RELOC_BFIN_5_PCREL +ADI Blackfin. +@end deffn +@deffn {} BFD_RELOC_BFIN_16_LOW +ADI Blackfin 16 bit immediate absolute reloc lower 16 bits. +@end deffn +@deffn {} BFD_RELOC_BFIN_10_PCREL +ADI Blackfin. +@end deffn +@deffn {} BFD_RELOC_BFIN_11_PCREL +ADI Blackfin 'b' part of LSETUP. +@end deffn +@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP +ADI Blackfin. +@end deffn +@deffn {} BFD_RELOC_BFIN_12_PCREL_JUMP_S +ADI Blackfin Short jump, pcrel. +@end deffn +@deffn {} BFD_RELOC_BFIN_24_PCREL_CALL_X +ADI Blackfin Call.x not implemented. +@end deffn +@deffn {} BFD_RELOC_BFIN_24_PCREL_JUMP_L +ADI Blackfin Long Jump pcrel. +@end deffn +@deffn {} BFD_RELOC_BFIN_GOT17M4 +@deffnx {} BFD_RELOC_BFIN_GOTHI +@deffnx {} BFD_RELOC_BFIN_GOTLO +@deffnx {} BFD_RELOC_BFIN_FUNCDESC +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOT17M4 +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTHI +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTLO +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_VALUE +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4 +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI +@deffnx {} BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO +@deffnx {} BFD_RELOC_BFIN_GOTOFF17M4 +@deffnx {} BFD_RELOC_BFIN_GOTOFFHI +@deffnx {} BFD_RELOC_BFIN_GOTOFFLO +ADI Blackfin FD-PIC relocations. +@end deffn +@deffn {} BFD_RELOC_BFIN_GOT +ADI Blackfin GOT relocation. +@end deffn +@deffn {} BFD_RELOC_BFIN_PLTPC +ADI Blackfin PLTPC relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_PUSH +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_CONST +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_ADD +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_SUB +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_MULT +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_DIV +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_MOD +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_LSHIFT +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_RSHIFT +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_AND +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_OR +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_XOR +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_LAND +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_LOR +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_LEN +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_NEG +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_COMP +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_PAGE +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_HWPAGE +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_ARELOC_BFIN_ADDR +ADI Blackfin arithmetic relocation. +@end deffn +@deffn {} BFD_RELOC_D10V_10_PCREL_R +Mitsubishi D10V relocs. +This is a 10-bit reloc with the right 2 bits +assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_D10V_10_PCREL_L +Mitsubishi D10V relocs. +This is a 10-bit reloc with the right 2 bits +assumed to be 0. This is the same as the previous reloc +except it is in the left container, i.e., +shifted left 15 bits. +@end deffn +@deffn {} BFD_RELOC_D10V_18 +This is an 18-bit reloc with the right 2 bits +assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_D10V_18_PCREL +This is an 18-bit reloc with the right 2 bits +assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_D30V_6 +Mitsubishi D30V relocs. +This is a 6-bit absolute reloc. +@end deffn +@deffn {} BFD_RELOC_D30V_9_PCREL +This is a 6-bit pc-relative reloc with +the right 3 bits assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_D30V_9_PCREL_R +This is a 6-bit pc-relative reloc with +the right 3 bits assumed to be 0. Same +as the previous reloc but on the right side +of the container. +@end deffn +@deffn {} BFD_RELOC_D30V_15 +This is a 12-bit absolute reloc with the +right 3 bitsassumed to be 0. +@end deffn +@deffn {} BFD_RELOC_D30V_15_PCREL +This is a 12-bit pc-relative reloc with +the right 3 bits assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_D30V_15_PCREL_R +This is a 12-bit pc-relative reloc with +the right 3 bits assumed to be 0. Same +as the previous reloc but on the right side +of the container. +@end deffn +@deffn {} BFD_RELOC_D30V_21 +This is an 18-bit absolute reloc with +the right 3 bits assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_D30V_21_PCREL +This is an 18-bit pc-relative reloc with +the right 3 bits assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_D30V_21_PCREL_R +This is an 18-bit pc-relative reloc with +the right 3 bits assumed to be 0. Same +as the previous reloc but on the right side +of the container. +@end deffn +@deffn {} BFD_RELOC_D30V_32 +This is a 32-bit absolute reloc. +@end deffn +@deffn {} BFD_RELOC_D30V_32_PCREL +This is a 32-bit pc-relative reloc. +@end deffn +@deffn {} BFD_RELOC_DLX_HI16_S +DLX relocs +@end deffn +@deffn {} BFD_RELOC_DLX_LO16 +DLX relocs +@end deffn +@deffn {} BFD_RELOC_DLX_JMP26 +DLX relocs +@end deffn +@deffn {} BFD_RELOC_M32C_HI8 +@deffnx {} BFD_RELOC_M32C_RL_JUMP +@deffnx {} BFD_RELOC_M32C_RL_1ADDR +@deffnx {} BFD_RELOC_M32C_RL_2ADDR +Renesas M16C/M32C Relocations. +@end deffn +@deffn {} BFD_RELOC_M32R_24 +Renesas M32R (formerly Mitsubishi M32R) relocs. +This is a 24 bit absolute address. +@end deffn +@deffn {} BFD_RELOC_M32R_10_PCREL +This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_M32R_18_PCREL +This is an 18-bit reloc with the right 2 bits assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_M32R_26_PCREL +This is a 26-bit reloc with the right 2 bits assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_M32R_HI16_ULO +This is a 16-bit reloc containing the high 16 bits of an address +used when the lower 16 bits are treated as unsigned. +@end deffn +@deffn {} BFD_RELOC_M32R_HI16_SLO +This is a 16-bit reloc containing the high 16 bits of an address +used when the lower 16 bits are treated as signed. +@end deffn +@deffn {} BFD_RELOC_M32R_LO16 +This is a 16-bit reloc containing the lower 16 bits of an address. +@end deffn +@deffn {} BFD_RELOC_M32R_SDA16 +This is a 16-bit reloc containing the small data area offset for use in +add3, load, and store instructions. +@end deffn +@deffn {} BFD_RELOC_M32R_GOT24 +@deffnx {} BFD_RELOC_M32R_26_PLTREL +@deffnx {} BFD_RELOC_M32R_COPY +@deffnx {} BFD_RELOC_M32R_GLOB_DAT +@deffnx {} BFD_RELOC_M32R_JMP_SLOT +@deffnx {} BFD_RELOC_M32R_RELATIVE +@deffnx {} BFD_RELOC_M32R_GOTOFF +@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_ULO +@deffnx {} BFD_RELOC_M32R_GOTOFF_HI_SLO +@deffnx {} BFD_RELOC_M32R_GOTOFF_LO +@deffnx {} BFD_RELOC_M32R_GOTPC24 +@deffnx {} BFD_RELOC_M32R_GOT16_HI_ULO +@deffnx {} BFD_RELOC_M32R_GOT16_HI_SLO +@deffnx {} BFD_RELOC_M32R_GOT16_LO +@deffnx {} BFD_RELOC_M32R_GOTPC_HI_ULO +@deffnx {} BFD_RELOC_M32R_GOTPC_HI_SLO +@deffnx {} BFD_RELOC_M32R_GOTPC_LO +For PIC. +@end deffn +@deffn {} BFD_RELOC_NDS32_20 +NDS32 relocs. +This is a 20 bit absolute address. +@end deffn +@deffn {} BFD_RELOC_NDS32_9_PCREL +This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_NDS32_WORD_9_PCREL +This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_NDS32_15_PCREL +This is an 15-bit reloc with the right 1 bit assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_NDS32_17_PCREL +This is an 17-bit reloc with the right 1 bit assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_NDS32_25_PCREL +This is a 25-bit reloc with the right 1 bit assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_NDS32_HI20 +This is a 20-bit reloc containing the high 20 bits of an address +used with the lower 12 bits +@end deffn +@deffn {} BFD_RELOC_NDS32_LO12S3 +This is a 12-bit reloc containing the lower 12 bits of an address +then shift right by 3. This is used with ldi,sdi... +@end deffn +@deffn {} BFD_RELOC_NDS32_LO12S2 +This is a 12-bit reloc containing the lower 12 bits of an address +then shift left by 2. This is used with lwi,swi... +@end deffn +@deffn {} BFD_RELOC_NDS32_LO12S1 +This is a 12-bit reloc containing the lower 12 bits of an address +then shift left by 1. This is used with lhi,shi... +@end deffn +@deffn {} BFD_RELOC_NDS32_LO12S0 +This is a 12-bit reloc containing the lower 12 bits of an address +then shift left by 0. This is used with lbisbi... +@end deffn +@deffn {} BFD_RELOC_NDS32_LO12S0_ORI +This is a 12-bit reloc containing the lower 12 bits of an address +then shift left by 0. This is only used with branch relaxations +@end deffn +@deffn {} BFD_RELOC_NDS32_SDA15S3 +This is a 15-bit reloc containing the small data area 18-bit signed offset +and shift left by 3 for use in ldi, sdi... +@end deffn +@deffn {} BFD_RELOC_NDS32_SDA15S2 +This is a 15-bit reloc containing the small data area 17-bit signed offset +and shift left by 2 for use in lwi, swi... +@end deffn +@deffn {} BFD_RELOC_NDS32_SDA15S1 +This is a 15-bit reloc containing the small data area 16-bit signed offset +and shift left by 1 for use in lhi, shi... +@end deffn +@deffn {} BFD_RELOC_NDS32_SDA15S0 +This is a 15-bit reloc containing the small data area 15-bit signed offset +and shift left by 0 for use in lbi, sbi... +@end deffn +@deffn {} BFD_RELOC_NDS32_SDA16S3 +This is a 16-bit reloc containing the small data area 16-bit signed offset +and shift left by 3 +@end deffn +@deffn {} BFD_RELOC_NDS32_SDA17S2 +This is a 17-bit reloc containing the small data area 17-bit signed offset +and shift left by 2 for use in lwi.gp, swi.gp... +@end deffn +@deffn {} BFD_RELOC_NDS32_SDA18S1 +This is a 18-bit reloc containing the small data area 18-bit signed offset +and shift left by 1 for use in lhi.gp, shi.gp... +@end deffn +@deffn {} BFD_RELOC_NDS32_SDA19S0 +This is a 19-bit reloc containing the small data area 19-bit signed offset +and shift left by 0 for use in lbi.gp, sbi.gp... +@end deffn +@deffn {} BFD_RELOC_NDS32_GOT20 +@deffnx {} BFD_RELOC_NDS32_9_PLTREL +@deffnx {} BFD_RELOC_NDS32_25_PLTREL +@deffnx {} BFD_RELOC_NDS32_COPY +@deffnx {} BFD_RELOC_NDS32_GLOB_DAT +@deffnx {} BFD_RELOC_NDS32_JMP_SLOT +@deffnx {} BFD_RELOC_NDS32_RELATIVE +@deffnx {} BFD_RELOC_NDS32_GOTOFF +@deffnx {} BFD_RELOC_NDS32_GOTOFF_HI20 +@deffnx {} BFD_RELOC_NDS32_GOTOFF_LO12 +@deffnx {} BFD_RELOC_NDS32_GOTPC20 +@deffnx {} BFD_RELOC_NDS32_GOT_HI20 +@deffnx {} BFD_RELOC_NDS32_GOT_LO12 +@deffnx {} BFD_RELOC_NDS32_GOTPC_HI20 +@deffnx {} BFD_RELOC_NDS32_GOTPC_LO12 +for PIC +@end deffn +@deffn {} BFD_RELOC_NDS32_INSN16 +@deffnx {} BFD_RELOC_NDS32_LABEL +@deffnx {} BFD_RELOC_NDS32_LONGCALL1 +@deffnx {} BFD_RELOC_NDS32_LONGCALL2 +@deffnx {} BFD_RELOC_NDS32_LONGCALL3 +@deffnx {} BFD_RELOC_NDS32_LONGJUMP1 +@deffnx {} BFD_RELOC_NDS32_LONGJUMP2 +@deffnx {} BFD_RELOC_NDS32_LONGJUMP3 +@deffnx {} BFD_RELOC_NDS32_LOADSTORE +@deffnx {} BFD_RELOC_NDS32_9_FIXED +@deffnx {} BFD_RELOC_NDS32_15_FIXED +@deffnx {} BFD_RELOC_NDS32_17_FIXED +@deffnx {} BFD_RELOC_NDS32_25_FIXED +@deffnx {} BFD_RELOC_NDS32_LONGCALL4 +@deffnx {} BFD_RELOC_NDS32_LONGCALL5 +@deffnx {} BFD_RELOC_NDS32_LONGCALL6 +@deffnx {} BFD_RELOC_NDS32_LONGJUMP4 +@deffnx {} BFD_RELOC_NDS32_LONGJUMP5 +@deffnx {} BFD_RELOC_NDS32_LONGJUMP6 +@deffnx {} BFD_RELOC_NDS32_LONGJUMP7 +for relax +@end deffn +@deffn {} BFD_RELOC_NDS32_PLTREL_HI20 +@deffnx {} BFD_RELOC_NDS32_PLTREL_LO12 +@deffnx {} BFD_RELOC_NDS32_PLT_GOTREL_HI20 +@deffnx {} BFD_RELOC_NDS32_PLT_GOTREL_LO12 +for PIC +@end deffn +@deffn {} BFD_RELOC_NDS32_SDA12S2_DP +@deffnx {} BFD_RELOC_NDS32_SDA12S2_SP +@deffnx {} BFD_RELOC_NDS32_LO12S2_DP +@deffnx {} BFD_RELOC_NDS32_LO12S2_SP +for floating point +@end deffn +@deffn {} BFD_RELOC_NDS32_DWARF2_OP1 +@deffnx {} BFD_RELOC_NDS32_DWARF2_OP2 +@deffnx {} BFD_RELOC_NDS32_DWARF2_LEB +for dwarf2 debug_line. +@end deffn +@deffn {} BFD_RELOC_NDS32_UPDATE_TA +for eliminate 16-bit instructions +@end deffn +@deffn {} BFD_RELOC_NDS32_PLT_GOTREL_LO20 +@deffnx {} BFD_RELOC_NDS32_PLT_GOTREL_LO15 +@deffnx {} BFD_RELOC_NDS32_PLT_GOTREL_LO19 +@deffnx {} BFD_RELOC_NDS32_GOT_LO15 +@deffnx {} BFD_RELOC_NDS32_GOT_LO19 +@deffnx {} BFD_RELOC_NDS32_GOTOFF_LO15 +@deffnx {} BFD_RELOC_NDS32_GOTOFF_LO19 +@deffnx {} BFD_RELOC_NDS32_GOT15S2 +@deffnx {} BFD_RELOC_NDS32_GOT17S2 +for PIC object relaxation +@end deffn +@deffn {} BFD_RELOC_NDS32_5 +NDS32 relocs. +This is a 5 bit absolute address. +@end deffn +@deffn {} BFD_RELOC_NDS32_10_UPCREL +This is a 10-bit unsigned pc-relative reloc with the right 1 bit assumed to be 0. +@end deffn +@deffn {} BFD_RELOC_NDS32_SDA_FP7U2_RELA +If fp were omitted, fp can used as another gp. +@end deffn +@deffn {} BFD_RELOC_NDS32_RELAX_ENTRY +@deffnx {} BFD_RELOC_NDS32_GOT_SUFF +@deffnx {} BFD_RELOC_NDS32_GOTOFF_SUFF +@deffnx {} BFD_RELOC_NDS32_PLT_GOT_SUFF +@deffnx {} BFD_RELOC_NDS32_MULCALL_SUFF +@deffnx {} BFD_RELOC_NDS32_PTR +@deffnx {} BFD_RELOC_NDS32_PTR_COUNT +@deffnx {} BFD_RELOC_NDS32_PTR_RESOLVED +@deffnx {} BFD_RELOC_NDS32_PLTBLOCK +@deffnx {} BFD_RELOC_NDS32_RELAX_REGION_BEGIN +@deffnx {} BFD_RELOC_NDS32_RELAX_REGION_END +@deffnx {} BFD_RELOC_NDS32_MINUEND +@deffnx {} BFD_RELOC_NDS32_SUBTRAHEND +@deffnx {} BFD_RELOC_NDS32_DIFF8 +@deffnx {} BFD_RELOC_NDS32_DIFF16 +@deffnx {} BFD_RELOC_NDS32_DIFF32 +@deffnx {} BFD_RELOC_NDS32_DIFF_ULEB128 +@deffnx {} BFD_RELOC_NDS32_EMPTY +relaxation relative relocation types +@end deffn +@deffn {} BFD_RELOC_NDS32_25_ABS +This is a 25 bit absolute address. +@end deffn +@deffn {} BFD_RELOC_NDS32_DATA +@deffnx {} BFD_RELOC_NDS32_TRAN +@deffnx {} BFD_RELOC_NDS32_17IFC_PCREL +@deffnx {} BFD_RELOC_NDS32_10IFCU_PCREL +For ex9 and ifc using. +@end deffn +@deffn {} BFD_RELOC_NDS32_TPOFF +@deffnx {} BFD_RELOC_NDS32_GOTTPOFF +@deffnx {} BFD_RELOC_NDS32_TLS_LE_HI20 +@deffnx {} BFD_RELOC_NDS32_TLS_LE_LO12 +@deffnx {} BFD_RELOC_NDS32_TLS_LE_20 +@deffnx {} BFD_RELOC_NDS32_TLS_LE_15S0 +@deffnx {} BFD_RELOC_NDS32_TLS_LE_15S1 +@deffnx {} BFD_RELOC_NDS32_TLS_LE_15S2 +@deffnx {} BFD_RELOC_NDS32_TLS_LE_ADD +@deffnx {} BFD_RELOC_NDS32_TLS_LE_LS +@deffnx {} BFD_RELOC_NDS32_TLS_IE_HI20 +@deffnx {} BFD_RELOC_NDS32_TLS_IE_LO12 +@deffnx {} BFD_RELOC_NDS32_TLS_IE_LO12S2 +@deffnx {} BFD_RELOC_NDS32_TLS_IEGP_HI20 +@deffnx {} BFD_RELOC_NDS32_TLS_IEGP_LO12 +@deffnx {} BFD_RELOC_NDS32_TLS_IEGP_LO12S2 +@deffnx {} BFD_RELOC_NDS32_TLS_IEGP_LW +@deffnx {} BFD_RELOC_NDS32_TLS_DESC +@deffnx {} BFD_RELOC_NDS32_TLS_DESC_HI20 +@deffnx {} BFD_RELOC_NDS32_TLS_DESC_LO12 +@deffnx {} BFD_RELOC_NDS32_TLS_DESC_20 +@deffnx {} BFD_RELOC_NDS32_TLS_DESC_SDA17S2 +@deffnx {} BFD_RELOC_NDS32_TLS_DESC_ADD +@deffnx {} BFD_RELOC_NDS32_TLS_DESC_FUNC +@deffnx {} BFD_RELOC_NDS32_TLS_DESC_CALL +@deffnx {} BFD_RELOC_NDS32_TLS_DESC_MEM +@deffnx {} BFD_RELOC_NDS32_REMOVE +@deffnx {} BFD_RELOC_NDS32_GROUP +For TLS. +@end deffn +@deffn {} BFD_RELOC_NDS32_LSI +For floating load store relaxation. +@end deffn +@deffn {} BFD_RELOC_V850_9_PCREL +This is a 9-bit reloc +@end deffn +@deffn {} BFD_RELOC_V850_22_PCREL +This is a 22-bit reloc +@end deffn +@deffn {} BFD_RELOC_V850_SDA_16_16_OFFSET +This is a 16 bit offset from the short data area pointer. +@end deffn +@deffn {} BFD_RELOC_V850_SDA_15_16_OFFSET +This is a 16 bit offset (of which only 15 bits are used) from the +short data area pointer. +@end deffn +@deffn {} BFD_RELOC_V850_ZDA_16_16_OFFSET +This is a 16 bit offset from the zero data area pointer. +@end deffn +@deffn {} BFD_RELOC_V850_ZDA_15_16_OFFSET +This is a 16 bit offset (of which only 15 bits are used) from the +zero data area pointer. +@end deffn +@deffn {} BFD_RELOC_V850_TDA_6_8_OFFSET +This is an 8 bit offset (of which only 6 bits are used) from the +tiny data area pointer. +@end deffn +@deffn {} BFD_RELOC_V850_TDA_7_8_OFFSET +This is an 8bit offset (of which only 7 bits are used) from the tiny +data area pointer. +@end deffn +@deffn {} BFD_RELOC_V850_TDA_7_7_OFFSET +This is a 7 bit offset from the tiny data area pointer. +@end deffn +@deffn {} BFD_RELOC_V850_TDA_16_16_OFFSET +This is a 16 bit offset from the tiny data area pointer. +@end deffn +@deffn {} BFD_RELOC_V850_TDA_4_5_OFFSET +This is a 5 bit offset (of which only 4 bits are used) from the tiny +data area pointer. +@end deffn +@deffn {} BFD_RELOC_V850_TDA_4_4_OFFSET +This is a 4 bit offset from the tiny data area pointer. +@end deffn +@deffn {} BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET +This is a 16 bit offset from the short data area pointer, with the +bits placed non-contiguously in the instruction. +@end deffn +@deffn {} BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET +This is a 16 bit offset from the zero data area pointer, with the +bits placed non-contiguously in the instruction. +@end deffn +@deffn {} BFD_RELOC_V850_CALLT_6_7_OFFSET +This is a 6 bit offset from the call table base pointer. +@end deffn +@deffn {} BFD_RELOC_V850_CALLT_16_16_OFFSET +This is a 16 bit offset from the call table base pointer. +@end deffn +@deffn {} BFD_RELOC_V850_LONGCALL +Used for relaxing indirect function calls. +@end deffn +@deffn {} BFD_RELOC_V850_LONGJUMP +Used for relaxing indirect jumps. +@end deffn +@deffn {} BFD_RELOC_V850_ALIGN +Used to maintain alignment whilst relaxing. +@end deffn +@deffn {} BFD_RELOC_V850_LO16_SPLIT_OFFSET +This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu +instructions. +@end deffn +@deffn {} BFD_RELOC_V850_16_PCREL +This is a 16-bit reloc. +@end deffn +@deffn {} BFD_RELOC_V850_17_PCREL +This is a 17-bit reloc. +@end deffn +@deffn {} BFD_RELOC_V850_23 +This is a 23-bit reloc. +@end deffn +@deffn {} BFD_RELOC_V850_32_PCREL +This is a 32-bit reloc. +@end deffn +@deffn {} BFD_RELOC_V850_32_ABS +This is a 32-bit reloc. +@end deffn +@deffn {} BFD_RELOC_V850_16_SPLIT_OFFSET +This is a 16-bit reloc. +@end deffn +@deffn {} BFD_RELOC_V850_16_S1 +This is a 16-bit reloc. +@end deffn +@deffn {} BFD_RELOC_V850_LO16_S1 +Low 16 bits. 16 bit shifted by 1. +@end deffn +@deffn {} BFD_RELOC_V850_CALLT_15_16_OFFSET +This is a 16 bit offset from the call table base pointer. +@end deffn +@deffn {} BFD_RELOC_V850_32_GOTPCREL +DSO relocations. +@end deffn +@deffn {} BFD_RELOC_V850_16_GOT +DSO relocations. +@end deffn +@deffn {} BFD_RELOC_V850_32_GOT +DSO relocations. +@end deffn +@deffn {} BFD_RELOC_V850_22_PLT_PCREL +DSO relocations. +@end deffn +@deffn {} BFD_RELOC_V850_32_PLT_PCREL +DSO relocations. +@end deffn +@deffn {} BFD_RELOC_V850_COPY +DSO relocations. +@end deffn +@deffn {} BFD_RELOC_V850_GLOB_DAT +DSO relocations. +@end deffn +@deffn {} BFD_RELOC_V850_JMP_SLOT +DSO relocations. +@end deffn +@deffn {} BFD_RELOC_V850_RELATIVE +DSO relocations. +@end deffn +@deffn {} BFD_RELOC_V850_16_GOTOFF +DSO relocations. +@end deffn +@deffn {} BFD_RELOC_V850_32_GOTOFF +DSO relocations. +@end deffn +@deffn {} BFD_RELOC_V850_CODE +start code. +@end deffn +@deffn {} BFD_RELOC_V850_DATA +start data in text. +@end deffn +@deffn {} BFD_RELOC_TIC30_LDP +This is a 8bit DP reloc for the tms320c30, where the most +significant 8 bits of a 24 bit word are placed into the least +significant 8 bits of the opcode. +@end deffn +@deffn {} BFD_RELOC_TIC54X_PARTLS7 +This is a 7bit reloc for the tms320c54x, where the least +significant 7 bits of a 16 bit word are placed into the least +significant 7 bits of the opcode. +@end deffn +@deffn {} BFD_RELOC_TIC54X_PARTMS9 +This is a 9bit DP reloc for the tms320c54x, where the most +significant 9 bits of a 16 bit word are placed into the least +significant 9 bits of the opcode. +@end deffn +@deffn {} BFD_RELOC_TIC54X_23 +This is an extended address 23-bit reloc for the tms320c54x. +@end deffn +@deffn {} BFD_RELOC_TIC54X_16_OF_23 +This is a 16-bit reloc for the tms320c54x, where the least +significant 16 bits of a 23-bit extended address are placed into +the opcode. +@end deffn +@deffn {} BFD_RELOC_TIC54X_MS7_OF_23 +This is a reloc for the tms320c54x, where the most +significant 7 bits of a 23-bit extended address are placed into +the opcode. +@end deffn +@deffn {} BFD_RELOC_C6000_PCR_S21 +@deffnx {} BFD_RELOC_C6000_PCR_S12 +@deffnx {} BFD_RELOC_C6000_PCR_S10 +@deffnx {} BFD_RELOC_C6000_PCR_S7 +@deffnx {} BFD_RELOC_C6000_ABS_S16 +@deffnx {} BFD_RELOC_C6000_ABS_L16 +@deffnx {} BFD_RELOC_C6000_ABS_H16 +@deffnx {} BFD_RELOC_C6000_SBR_U15_B +@deffnx {} BFD_RELOC_C6000_SBR_U15_H +@deffnx {} BFD_RELOC_C6000_SBR_U15_W +@deffnx {} BFD_RELOC_C6000_SBR_S16 +@deffnx {} BFD_RELOC_C6000_SBR_L16_B +@deffnx {} BFD_RELOC_C6000_SBR_L16_H +@deffnx {} BFD_RELOC_C6000_SBR_L16_W +@deffnx {} BFD_RELOC_C6000_SBR_H16_B +@deffnx {} BFD_RELOC_C6000_SBR_H16_H +@deffnx {} BFD_RELOC_C6000_SBR_H16_W +@deffnx {} BFD_RELOC_C6000_SBR_GOT_U15_W +@deffnx {} BFD_RELOC_C6000_SBR_GOT_L16_W +@deffnx {} BFD_RELOC_C6000_SBR_GOT_H16_W +@deffnx {} BFD_RELOC_C6000_DSBT_INDEX +@deffnx {} BFD_RELOC_C6000_PREL31 +@deffnx {} BFD_RELOC_C6000_COPY +@deffnx {} BFD_RELOC_C6000_JUMP_SLOT +@deffnx {} BFD_RELOC_C6000_EHTYPE +@deffnx {} BFD_RELOC_C6000_PCR_H16 +@deffnx {} BFD_RELOC_C6000_PCR_L16 +@deffnx {} BFD_RELOC_C6000_ALIGN +@deffnx {} BFD_RELOC_C6000_FPHEAD +@deffnx {} BFD_RELOC_C6000_NOCMP +TMS320C6000 relocations. +@end deffn +@deffn {} BFD_RELOC_FR30_48 +This is a 48 bit reloc for the FR30 that stores 32 bits. +@end deffn +@deffn {} BFD_RELOC_FR30_20 +This is a 32 bit reloc for the FR30 that stores 20 bits split up into +two sections. +@end deffn +@deffn {} BFD_RELOC_FR30_6_IN_4 +This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in +4 bits. +@end deffn +@deffn {} BFD_RELOC_FR30_8_IN_8 +This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset +into 8 bits. +@end deffn +@deffn {} BFD_RELOC_FR30_9_IN_8 +This is a 16 bit reloc for the FR30 that stores a 9 bit short offset +into 8 bits. +@end deffn +@deffn {} BFD_RELOC_FR30_10_IN_8 +This is a 16 bit reloc for the FR30 that stores a 10 bit word offset +into 8 bits. +@end deffn +@deffn {} BFD_RELOC_FR30_9_PCREL +This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative +short offset into 8 bits. +@end deffn +@deffn {} BFD_RELOC_FR30_12_PCREL +This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative +short offset into 11 bits. +@end deffn +@deffn {} BFD_RELOC_MCORE_PCREL_IMM8BY4 +@deffnx {} BFD_RELOC_MCORE_PCREL_IMM11BY2 +@deffnx {} BFD_RELOC_MCORE_PCREL_IMM4BY2 +@deffnx {} BFD_RELOC_MCORE_PCREL_32 +@deffnx {} BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2 +@deffnx {} BFD_RELOC_MCORE_RVA +Motorola Mcore relocations. +@end deffn +@deffn {} BFD_RELOC_MEP_8 +@deffnx {} BFD_RELOC_MEP_16 +@deffnx {} BFD_RELOC_MEP_32 +@deffnx {} BFD_RELOC_MEP_PCREL8A2 +@deffnx {} BFD_RELOC_MEP_PCREL12A2 +@deffnx {} BFD_RELOC_MEP_PCREL17A2 +@deffnx {} BFD_RELOC_MEP_PCREL24A2 +@deffnx {} BFD_RELOC_MEP_PCABS24A2 +@deffnx {} BFD_RELOC_MEP_LOW16 +@deffnx {} BFD_RELOC_MEP_HI16U +@deffnx {} BFD_RELOC_MEP_HI16S +@deffnx {} BFD_RELOC_MEP_GPREL +@deffnx {} BFD_RELOC_MEP_TPREL +@deffnx {} BFD_RELOC_MEP_TPREL7 +@deffnx {} BFD_RELOC_MEP_TPREL7A2 +@deffnx {} BFD_RELOC_MEP_TPREL7A4 +@deffnx {} BFD_RELOC_MEP_UIMM24 +@deffnx {} BFD_RELOC_MEP_ADDR24A4 +@deffnx {} BFD_RELOC_MEP_GNU_VTINHERIT +@deffnx {} BFD_RELOC_MEP_GNU_VTENTRY +Toshiba Media Processor Relocations. +@end deffn +@deffn {} BFD_RELOC_METAG_HIADDR16 +@deffnx {} BFD_RELOC_METAG_LOADDR16 +@deffnx {} BFD_RELOC_METAG_RELBRANCH +@deffnx {} BFD_RELOC_METAG_GETSETOFF +@deffnx {} BFD_RELOC_METAG_HIOG +@deffnx {} BFD_RELOC_METAG_LOOG +@deffnx {} BFD_RELOC_METAG_REL8 +@deffnx {} BFD_RELOC_METAG_REL16 +@deffnx {} BFD_RELOC_METAG_HI16_GOTOFF +@deffnx {} BFD_RELOC_METAG_LO16_GOTOFF +@deffnx {} BFD_RELOC_METAG_GETSET_GOTOFF +@deffnx {} BFD_RELOC_METAG_GETSET_GOT +@deffnx {} BFD_RELOC_METAG_HI16_GOTPC +@deffnx {} BFD_RELOC_METAG_LO16_GOTPC +@deffnx {} BFD_RELOC_METAG_HI16_PLT +@deffnx {} BFD_RELOC_METAG_LO16_PLT +@deffnx {} BFD_RELOC_METAG_RELBRANCH_PLT +@deffnx {} BFD_RELOC_METAG_GOTOFF +@deffnx {} BFD_RELOC_METAG_PLT +@deffnx {} BFD_RELOC_METAG_COPY +@deffnx {} BFD_RELOC_METAG_JMP_SLOT +@deffnx {} BFD_RELOC_METAG_RELATIVE +@deffnx {} BFD_RELOC_METAG_GLOB_DAT +@deffnx {} BFD_RELOC_METAG_TLS_GD +@deffnx {} BFD_RELOC_METAG_TLS_LDM +@deffnx {} BFD_RELOC_METAG_TLS_LDO_HI16 +@deffnx {} BFD_RELOC_METAG_TLS_LDO_LO16 +@deffnx {} BFD_RELOC_METAG_TLS_LDO +@deffnx {} BFD_RELOC_METAG_TLS_IE +@deffnx {} BFD_RELOC_METAG_TLS_IENONPIC +@deffnx {} BFD_RELOC_METAG_TLS_IENONPIC_HI16 +@deffnx {} BFD_RELOC_METAG_TLS_IENONPIC_LO16 +@deffnx {} BFD_RELOC_METAG_TLS_TPOFF +@deffnx {} BFD_RELOC_METAG_TLS_DTPMOD +@deffnx {} BFD_RELOC_METAG_TLS_DTPOFF +@deffnx {} BFD_RELOC_METAG_TLS_LE +@deffnx {} BFD_RELOC_METAG_TLS_LE_HI16 +@deffnx {} BFD_RELOC_METAG_TLS_LE_LO16 +Imagination Technologies Meta relocations. +@end deffn +@deffn {} BFD_RELOC_MMIX_GETA +@deffnx {} BFD_RELOC_MMIX_GETA_1 +@deffnx {} BFD_RELOC_MMIX_GETA_2 +@deffnx {} BFD_RELOC_MMIX_GETA_3 +These are relocations for the GETA instruction. +@end deffn +@deffn {} BFD_RELOC_MMIX_CBRANCH +@deffnx {} BFD_RELOC_MMIX_CBRANCH_J +@deffnx {} BFD_RELOC_MMIX_CBRANCH_1 +@deffnx {} BFD_RELOC_MMIX_CBRANCH_2 +@deffnx {} BFD_RELOC_MMIX_CBRANCH_3 +These are relocations for a conditional branch instruction. +@end deffn +@deffn {} BFD_RELOC_MMIX_PUSHJ +@deffnx {} BFD_RELOC_MMIX_PUSHJ_1 +@deffnx {} BFD_RELOC_MMIX_PUSHJ_2 +@deffnx {} BFD_RELOC_MMIX_PUSHJ_3 +@deffnx {} BFD_RELOC_MMIX_PUSHJ_STUBBABLE +These are relocations for the PUSHJ instruction. +@end deffn +@deffn {} BFD_RELOC_MMIX_JMP +@deffnx {} BFD_RELOC_MMIX_JMP_1 +@deffnx {} BFD_RELOC_MMIX_JMP_2 +@deffnx {} BFD_RELOC_MMIX_JMP_3 +These are relocations for the JMP instruction. +@end deffn +@deffn {} BFD_RELOC_MMIX_ADDR19 +This is a relocation for a relative address as in a GETA instruction or +a branch. +@end deffn +@deffn {} BFD_RELOC_MMIX_ADDR27 +This is a relocation for a relative address as in a JMP instruction. +@end deffn +@deffn {} BFD_RELOC_MMIX_REG_OR_BYTE +This is a relocation for an instruction field that may be a general +register or a value 0..255. +@end deffn +@deffn {} BFD_RELOC_MMIX_REG +This is a relocation for an instruction field that may be a general +register. +@end deffn +@deffn {} BFD_RELOC_MMIX_BASE_PLUS_OFFSET +This is a relocation for two instruction fields holding a register and +an offset, the equivalent of the relocation. +@end deffn +@deffn {} BFD_RELOC_MMIX_LOCAL +This relocation is an assertion that the expression is not allocated as +a global register. It does not modify contents. +@end deffn +@deffn {} BFD_RELOC_AVR_7_PCREL +This is a 16 bit reloc for the AVR that stores 8 bit pc relative +short offset into 7 bits. +@end deffn +@deffn {} BFD_RELOC_AVR_13_PCREL +This is a 16 bit reloc for the AVR that stores 13 bit pc relative +short offset into 12 bits. +@end deffn +@deffn {} BFD_RELOC_AVR_16_PM +This is a 16 bit reloc for the AVR that stores 17 bit value (usually +program memory address) into 16 bits. +@end deffn +@deffn {} BFD_RELOC_AVR_LO8_LDI +This is a 16 bit reloc for the AVR that stores 8 bit value (usually +data memory address) into 8 bit immediate value of LDI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_HI8_LDI +This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit +of data memory address) into 8 bit immediate value of LDI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_HH8_LDI +This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit +of program memory address) into 8 bit immediate value of LDI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_MS8_LDI +This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit +of 32 bit value) into 8 bit immediate value of LDI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_LO8_LDI_NEG +This is a 16 bit reloc for the AVR that stores negated 8 bit value +(usually data memory address) into 8 bit immediate value of SUBI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_HI8_LDI_NEG +This is a 16 bit reloc for the AVR that stores negated 8 bit value +(high 8 bit of data memory address) into 8 bit immediate value of +SUBI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_HH8_LDI_NEG +This is a 16 bit reloc for the AVR that stores negated 8 bit value +(most high 8 bit of program memory address) into 8 bit immediate value +of LDI or SUBI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_MS8_LDI_NEG +This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb +of 32 bit value) into 8 bit immediate value of LDI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_LO8_LDI_PM +This is a 16 bit reloc for the AVR that stores 8 bit value (usually +command address) into 8 bit immediate value of LDI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_LO8_LDI_GS +This is a 16 bit reloc for the AVR that stores 8 bit value +(command address) into 8 bit immediate value of LDI insn. If the address +is beyond the 128k boundary, the linker inserts a jump stub for this reloc +in the lower 128k. +@end deffn +@deffn {} BFD_RELOC_AVR_HI8_LDI_PM +This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit +of command address) into 8 bit immediate value of LDI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_HI8_LDI_GS +This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit +of command address) into 8 bit immediate value of LDI insn. If the address +is beyond the 128k boundary, the linker inserts a jump stub for this reloc +below 128k. +@end deffn +@deffn {} BFD_RELOC_AVR_HH8_LDI_PM +This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit +of command address) into 8 bit immediate value of LDI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_LO8_LDI_PM_NEG +This is a 16 bit reloc for the AVR that stores negated 8 bit value +(usually command address) into 8 bit immediate value of SUBI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_HI8_LDI_PM_NEG +This is a 16 bit reloc for the AVR that stores negated 8 bit value +(high 8 bit of 16 bit command address) into 8 bit immediate value +of SUBI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_HH8_LDI_PM_NEG +This is a 16 bit reloc for the AVR that stores negated 8 bit value +(high 6 bit of 22 bit command address) into 8 bit immediate +value of SUBI insn. +@end deffn +@deffn {} BFD_RELOC_AVR_CALL +This is a 32 bit reloc for the AVR that stores 23 bit value +into 22 bits. +@end deffn +@deffn {} BFD_RELOC_AVR_LDI +This is a 16 bit reloc for the AVR that stores all needed bits +for absolute addressing with ldi with overflow check to linktime +@end deffn +@deffn {} BFD_RELOC_AVR_6 +This is a 6 bit reloc for the AVR that stores offset for ldd/std +instructions +@end deffn +@deffn {} BFD_RELOC_AVR_6_ADIW +This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw +instructions +@end deffn +@deffn {} BFD_RELOC_AVR_8_LO +This is a 8 bit reloc for the AVR that stores bits 0..7 of a symbol +in .byte lo8(symbol) +@end deffn +@deffn {} BFD_RELOC_AVR_8_HI +This is a 8 bit reloc for the AVR that stores bits 8..15 of a symbol +in .byte hi8(symbol) +@end deffn +@deffn {} BFD_RELOC_AVR_8_HLO +This is a 8 bit reloc for the AVR that stores bits 16..23 of a symbol +in .byte hlo8(symbol) +@end deffn +@deffn {} BFD_RELOC_AVR_DIFF8 +@deffnx {} BFD_RELOC_AVR_DIFF16 +@deffnx {} BFD_RELOC_AVR_DIFF32 +AVR relocations to mark the difference of two local symbols. +These are only needed to support linker relaxation and can be ignored +when not relaxing. The field is set to the value of the difference +assuming no relaxation. The relocation encodes the position of the +second symbol so the linker can determine whether to adjust the field +value. +@end deffn +@deffn {} BFD_RELOC_AVR_LDS_STS_16 +This is a 7 bit reloc for the AVR that stores SRAM address for 16bit +lds and sts instructions supported only tiny core. +@end deffn +@deffn {} BFD_RELOC_AVR_PORT6 +This is a 6 bit reloc for the AVR that stores an I/O register +number for the IN and OUT instructions +@end deffn +@deffn {} BFD_RELOC_AVR_PORT5 +This is a 5 bit reloc for the AVR that stores an I/O register +number for the SBIC, SBIS, SBI and CBI instructions +@end deffn +@deffn {} BFD_RELOC_RISCV_HI20 +@deffnx {} BFD_RELOC_RISCV_PCREL_HI20 +@deffnx {} BFD_RELOC_RISCV_PCREL_LO12_I +@deffnx {} BFD_RELOC_RISCV_PCREL_LO12_S +@deffnx {} BFD_RELOC_RISCV_LO12_I +@deffnx {} BFD_RELOC_RISCV_LO12_S +@deffnx {} BFD_RELOC_RISCV_GPREL12_I +@deffnx {} BFD_RELOC_RISCV_GPREL12_S +@deffnx {} BFD_RELOC_RISCV_TPREL_HI20 +@deffnx {} BFD_RELOC_RISCV_TPREL_LO12_I +@deffnx {} BFD_RELOC_RISCV_TPREL_LO12_S +@deffnx {} BFD_RELOC_RISCV_TPREL_ADD +@deffnx {} BFD_RELOC_RISCV_CALL +@deffnx {} BFD_RELOC_RISCV_CALL_PLT +@deffnx {} BFD_RELOC_RISCV_ADD8 +@deffnx {} BFD_RELOC_RISCV_ADD16 +@deffnx {} BFD_RELOC_RISCV_ADD32 +@deffnx {} BFD_RELOC_RISCV_ADD64 +@deffnx {} BFD_RELOC_RISCV_SUB8 +@deffnx {} BFD_RELOC_RISCV_SUB16 +@deffnx {} BFD_RELOC_RISCV_SUB32 +@deffnx {} BFD_RELOC_RISCV_SUB64 +@deffnx {} BFD_RELOC_RISCV_GOT_HI20 +@deffnx {} BFD_RELOC_RISCV_TLS_GOT_HI20 +@deffnx {} BFD_RELOC_RISCV_TLS_GD_HI20 +@deffnx {} BFD_RELOC_RISCV_JMP +@deffnx {} BFD_RELOC_RISCV_TLS_DTPMOD32 +@deffnx {} BFD_RELOC_RISCV_TLS_DTPREL32 +@deffnx {} BFD_RELOC_RISCV_TLS_DTPMOD64 +@deffnx {} BFD_RELOC_RISCV_TLS_DTPREL64 +@deffnx {} BFD_RELOC_RISCV_TLS_TPREL32 +@deffnx {} BFD_RELOC_RISCV_TLS_TPREL64 +@deffnx {} BFD_RELOC_RISCV_ALIGN +@deffnx {} BFD_RELOC_RISCV_RVC_BRANCH +@deffnx {} BFD_RELOC_RISCV_RVC_JUMP +@deffnx {} BFD_RELOC_RISCV_RVC_LUI +@deffnx {} BFD_RELOC_RISCV_GPREL_I +@deffnx {} BFD_RELOC_RISCV_GPREL_S +@deffnx {} BFD_RELOC_RISCV_TPREL_I +@deffnx {} BFD_RELOC_RISCV_TPREL_S +@deffnx {} BFD_RELOC_RISCV_RELAX +@deffnx {} BFD_RELOC_RISCV_CFA +@deffnx {} BFD_RELOC_RISCV_SUB6 +@deffnx {} BFD_RELOC_RISCV_SET6 +@deffnx {} BFD_RELOC_RISCV_SET8 +@deffnx {} BFD_RELOC_RISCV_SET16 +@deffnx {} BFD_RELOC_RISCV_SET32 +@deffnx {} BFD_RELOC_RISCV_32_PCREL +RISC-V relocations. +@end deffn +@deffn {} BFD_RELOC_RL78_NEG8 +@deffnx {} BFD_RELOC_RL78_NEG16 +@deffnx {} BFD_RELOC_RL78_NEG24 +@deffnx {} BFD_RELOC_RL78_NEG32 +@deffnx {} BFD_RELOC_RL78_16_OP +@deffnx {} BFD_RELOC_RL78_24_OP +@deffnx {} BFD_RELOC_RL78_32_OP +@deffnx {} BFD_RELOC_RL78_8U +@deffnx {} BFD_RELOC_RL78_16U +@deffnx {} BFD_RELOC_RL78_24U +@deffnx {} BFD_RELOC_RL78_DIR3U_PCREL +@deffnx {} BFD_RELOC_RL78_DIFF +@deffnx {} BFD_RELOC_RL78_GPRELB +@deffnx {} BFD_RELOC_RL78_GPRELW +@deffnx {} BFD_RELOC_RL78_GPRELL +@deffnx {} BFD_RELOC_RL78_SYM +@deffnx {} BFD_RELOC_RL78_OP_SUBTRACT +@deffnx {} BFD_RELOC_RL78_OP_NEG +@deffnx {} BFD_RELOC_RL78_OP_AND +@deffnx {} BFD_RELOC_RL78_OP_SHRA +@deffnx {} BFD_RELOC_RL78_ABS8 +@deffnx {} BFD_RELOC_RL78_ABS16 +@deffnx {} BFD_RELOC_RL78_ABS16_REV +@deffnx {} BFD_RELOC_RL78_ABS32 +@deffnx {} BFD_RELOC_RL78_ABS32_REV +@deffnx {} BFD_RELOC_RL78_ABS16U +@deffnx {} BFD_RELOC_RL78_ABS16UW +@deffnx {} BFD_RELOC_RL78_ABS16UL +@deffnx {} BFD_RELOC_RL78_RELAX +@deffnx {} BFD_RELOC_RL78_HI16 +@deffnx {} BFD_RELOC_RL78_HI8 +@deffnx {} BFD_RELOC_RL78_LO16 +@deffnx {} BFD_RELOC_RL78_CODE +@deffnx {} BFD_RELOC_RL78_SADDR +Renesas RL78 Relocations. +@end deffn +@deffn {} BFD_RELOC_RX_NEG8 +@deffnx {} BFD_RELOC_RX_NEG16 +@deffnx {} BFD_RELOC_RX_NEG24 +@deffnx {} BFD_RELOC_RX_NEG32 +@deffnx {} BFD_RELOC_RX_16_OP +@deffnx {} BFD_RELOC_RX_24_OP +@deffnx {} BFD_RELOC_RX_32_OP +@deffnx {} BFD_RELOC_RX_8U +@deffnx {} BFD_RELOC_RX_16U +@deffnx {} BFD_RELOC_RX_24U +@deffnx {} BFD_RELOC_RX_DIR3U_PCREL +@deffnx {} BFD_RELOC_RX_DIFF +@deffnx {} BFD_RELOC_RX_GPRELB +@deffnx {} BFD_RELOC_RX_GPRELW +@deffnx {} BFD_RELOC_RX_GPRELL +@deffnx {} BFD_RELOC_RX_SYM +@deffnx {} BFD_RELOC_RX_OP_SUBTRACT +@deffnx {} BFD_RELOC_RX_OP_NEG +@deffnx {} BFD_RELOC_RX_ABS8 +@deffnx {} BFD_RELOC_RX_ABS16 +@deffnx {} BFD_RELOC_RX_ABS16_REV +@deffnx {} BFD_RELOC_RX_ABS32 +@deffnx {} BFD_RELOC_RX_ABS32_REV +@deffnx {} BFD_RELOC_RX_ABS16U +@deffnx {} BFD_RELOC_RX_ABS16UW +@deffnx {} BFD_RELOC_RX_ABS16UL +@deffnx {} BFD_RELOC_RX_RELAX +Renesas RX Relocations. +@end deffn +@deffn {} BFD_RELOC_390_12 +Direct 12 bit. +@end deffn +@deffn {} BFD_RELOC_390_GOT12 +12 bit GOT offset. +@end deffn +@deffn {} BFD_RELOC_390_PLT32 +32 bit PC relative PLT address. +@end deffn +@deffn {} BFD_RELOC_390_COPY +Copy symbol at runtime. +@end deffn +@deffn {} BFD_RELOC_390_GLOB_DAT +Create GOT entry. +@end deffn +@deffn {} BFD_RELOC_390_JMP_SLOT +Create PLT entry. +@end deffn +@deffn {} BFD_RELOC_390_RELATIVE +Adjust by program base. +@end deffn +@deffn {} BFD_RELOC_390_GOTPC +32 bit PC relative offset to GOT. +@end deffn +@deffn {} BFD_RELOC_390_GOT16 +16 bit GOT offset. +@end deffn +@deffn {} BFD_RELOC_390_PC12DBL +PC relative 12 bit shifted by 1. +@end deffn +@deffn {} BFD_RELOC_390_PLT12DBL +12 bit PC rel. PLT shifted by 1. +@end deffn +@deffn {} BFD_RELOC_390_PC16DBL +PC relative 16 bit shifted by 1. +@end deffn +@deffn {} BFD_RELOC_390_PLT16DBL +16 bit PC rel. PLT shifted by 1. +@end deffn +@deffn {} BFD_RELOC_390_PC24DBL +PC relative 24 bit shifted by 1. +@end deffn +@deffn {} BFD_RELOC_390_PLT24DBL +24 bit PC rel. PLT shifted by 1. +@end deffn +@deffn {} BFD_RELOC_390_PC32DBL +PC relative 32 bit shifted by 1. +@end deffn +@deffn {} BFD_RELOC_390_PLT32DBL +32 bit PC rel. PLT shifted by 1. +@end deffn +@deffn {} BFD_RELOC_390_GOTPCDBL +32 bit PC rel. GOT shifted by 1. +@end deffn +@deffn {} BFD_RELOC_390_GOT64 +64 bit GOT offset. +@end deffn +@deffn {} BFD_RELOC_390_PLT64 +64 bit PC relative PLT address. +@end deffn +@deffn {} BFD_RELOC_390_GOTENT +32 bit rel. offset to GOT entry. +@end deffn +@deffn {} BFD_RELOC_390_GOTOFF64 +64 bit offset to GOT. +@end deffn +@deffn {} BFD_RELOC_390_GOTPLT12 +12-bit offset to symbol-entry within GOT, with PLT handling. +@end deffn +@deffn {} BFD_RELOC_390_GOTPLT16 +16-bit offset to symbol-entry within GOT, with PLT handling. +@end deffn +@deffn {} BFD_RELOC_390_GOTPLT32 +32-bit offset to symbol-entry within GOT, with PLT handling. +@end deffn +@deffn {} BFD_RELOC_390_GOTPLT64 +64-bit offset to symbol-entry within GOT, with PLT handling. +@end deffn +@deffn {} BFD_RELOC_390_GOTPLTENT +32-bit rel. offset to symbol-entry within GOT, with PLT handling. +@end deffn +@deffn {} BFD_RELOC_390_PLTOFF16 +16-bit rel. offset from the GOT to a PLT entry. +@end deffn +@deffn {} BFD_RELOC_390_PLTOFF32 +32-bit rel. offset from the GOT to a PLT entry. +@end deffn +@deffn {} BFD_RELOC_390_PLTOFF64 +64-bit rel. offset from the GOT to a PLT entry. +@end deffn +@deffn {} BFD_RELOC_390_TLS_LOAD +@deffnx {} BFD_RELOC_390_TLS_GDCALL +@deffnx {} BFD_RELOC_390_TLS_LDCALL +@deffnx {} BFD_RELOC_390_TLS_GD32 +@deffnx {} BFD_RELOC_390_TLS_GD64 +@deffnx {} BFD_RELOC_390_TLS_GOTIE12 +@deffnx {} BFD_RELOC_390_TLS_GOTIE32 +@deffnx {} BFD_RELOC_390_TLS_GOTIE64 +@deffnx {} BFD_RELOC_390_TLS_LDM32 +@deffnx {} BFD_RELOC_390_TLS_LDM64 +@deffnx {} BFD_RELOC_390_TLS_IE32 +@deffnx {} BFD_RELOC_390_TLS_IE64 +@deffnx {} BFD_RELOC_390_TLS_IEENT +@deffnx {} BFD_RELOC_390_TLS_LE32 +@deffnx {} BFD_RELOC_390_TLS_LE64 +@deffnx {} BFD_RELOC_390_TLS_LDO32 +@deffnx {} BFD_RELOC_390_TLS_LDO64 +@deffnx {} BFD_RELOC_390_TLS_DTPMOD +@deffnx {} BFD_RELOC_390_TLS_DTPOFF +@deffnx {} BFD_RELOC_390_TLS_TPOFF +s390 tls relocations. +@end deffn +@deffn {} BFD_RELOC_390_20 +@deffnx {} BFD_RELOC_390_GOT20 +@deffnx {} BFD_RELOC_390_GOTPLT20 +@deffnx {} BFD_RELOC_390_TLS_GOTIE20 +Long displacement extension. +@end deffn +@deffn {} BFD_RELOC_390_IRELATIVE +STT_GNU_IFUNC relocation. +@end deffn +@deffn {} BFD_RELOC_SCORE_GPREL15 +Score relocations +Low 16 bit for load/store +@end deffn +@deffn {} BFD_RELOC_SCORE_DUMMY2 +@deffnx {} BFD_RELOC_SCORE_JMP +This is a 24-bit reloc with the right 1 bit assumed to be 0 +@end deffn +@deffn {} BFD_RELOC_SCORE_BRANCH +This is a 19-bit reloc with the right 1 bit assumed to be 0 +@end deffn +@deffn {} BFD_RELOC_SCORE_IMM30 +This is a 32-bit reloc for 48-bit instructions. +@end deffn +@deffn {} BFD_RELOC_SCORE_IMM32 +This is a 32-bit reloc for 48-bit instructions. +@end deffn +@deffn {} BFD_RELOC_SCORE16_JMP +This is a 11-bit reloc with the right 1 bit assumed to be 0 +@end deffn +@deffn {} BFD_RELOC_SCORE16_BRANCH +This is a 8-bit reloc with the right 1 bit assumed to be 0 +@end deffn +@deffn {} BFD_RELOC_SCORE_BCMP +This is a 9-bit reloc with the right 1 bit assumed to be 0 +@end deffn +@deffn {} BFD_RELOC_SCORE_GOT15 +@deffnx {} BFD_RELOC_SCORE_GOT_LO16 +@deffnx {} BFD_RELOC_SCORE_CALL15 +@deffnx {} BFD_RELOC_SCORE_DUMMY_HI16 +Undocumented Score relocs +@end deffn +@deffn {} BFD_RELOC_IP2K_FR9 +Scenix IP2K - 9-bit register number / data address +@end deffn +@deffn {} BFD_RELOC_IP2K_BANK +Scenix IP2K - 4-bit register/data bank number +@end deffn +@deffn {} BFD_RELOC_IP2K_ADDR16CJP +Scenix IP2K - low 13 bits of instruction word address +@end deffn +@deffn {} BFD_RELOC_IP2K_PAGE3 +Scenix IP2K - high 3 bits of instruction word address +@end deffn +@deffn {} BFD_RELOC_IP2K_LO8DATA +@deffnx {} BFD_RELOC_IP2K_HI8DATA +@deffnx {} BFD_RELOC_IP2K_EX8DATA +Scenix IP2K - ext/low/high 8 bits of data address +@end deffn +@deffn {} BFD_RELOC_IP2K_LO8INSN +@deffnx {} BFD_RELOC_IP2K_HI8INSN +Scenix IP2K - low/high 8 bits of instruction word address +@end deffn +@deffn {} BFD_RELOC_IP2K_PC_SKIP +Scenix IP2K - even/odd PC modifier to modify snb pcl.0 +@end deffn +@deffn {} BFD_RELOC_IP2K_TEXT +Scenix IP2K - 16 bit word address in text section. +@end deffn +@deffn {} BFD_RELOC_IP2K_FR_OFFSET +Scenix IP2K - 7-bit sp or dp offset +@end deffn +@deffn {} BFD_RELOC_VPE4KMATH_DATA +@deffnx {} BFD_RELOC_VPE4KMATH_INSN +Scenix VPE4K coprocessor - data/insn-space addressing +@end deffn +@deffn {} BFD_RELOC_VTABLE_INHERIT +@deffnx {} BFD_RELOC_VTABLE_ENTRY +These two relocations are used by the linker to determine which of +the entries in a C++ virtual function table are actually used. When +the --gc-sections option is given, the linker will zero out the entries +that are not used, so that the code for those functions need not be +included in the output. + +VTABLE_INHERIT is a zero-space relocation used to describe to the +linker the inheritance tree of a C++ virtual function table. The +relocation's symbol should be the parent class' vtable, and the +relocation should be located at the child vtable. + +VTABLE_ENTRY is a zero-space relocation that describes the use of a +virtual function table entry. The reloc's symbol should refer to the +table of the class mentioned in the code. Off of that base, an offset +describes the entry that is being used. For Rela hosts, this offset +is stored in the reloc's addend. For Rel hosts, we are forced to put +this offset in the reloc's section offset. +@end deffn +@deffn {} BFD_RELOC_IA64_IMM14 +@deffnx {} BFD_RELOC_IA64_IMM22 +@deffnx {} BFD_RELOC_IA64_IMM64 +@deffnx {} BFD_RELOC_IA64_DIR32MSB +@deffnx {} BFD_RELOC_IA64_DIR32LSB +@deffnx {} BFD_RELOC_IA64_DIR64MSB +@deffnx {} BFD_RELOC_IA64_DIR64LSB +@deffnx {} BFD_RELOC_IA64_GPREL22 +@deffnx {} BFD_RELOC_IA64_GPREL64I +@deffnx {} BFD_RELOC_IA64_GPREL32MSB +@deffnx {} BFD_RELOC_IA64_GPREL32LSB +@deffnx {} BFD_RELOC_IA64_GPREL64MSB +@deffnx {} BFD_RELOC_IA64_GPREL64LSB +@deffnx {} BFD_RELOC_IA64_LTOFF22 +@deffnx {} BFD_RELOC_IA64_LTOFF64I +@deffnx {} BFD_RELOC_IA64_PLTOFF22 +@deffnx {} BFD_RELOC_IA64_PLTOFF64I +@deffnx {} BFD_RELOC_IA64_PLTOFF64MSB +@deffnx {} BFD_RELOC_IA64_PLTOFF64LSB +@deffnx {} BFD_RELOC_IA64_FPTR64I +@deffnx {} BFD_RELOC_IA64_FPTR32MSB +@deffnx {} BFD_RELOC_IA64_FPTR32LSB +@deffnx {} BFD_RELOC_IA64_FPTR64MSB +@deffnx {} BFD_RELOC_IA64_FPTR64LSB +@deffnx {} BFD_RELOC_IA64_PCREL21B +@deffnx {} BFD_RELOC_IA64_PCREL21BI +@deffnx {} BFD_RELOC_IA64_PCREL21M +@deffnx {} BFD_RELOC_IA64_PCREL21F +@deffnx {} BFD_RELOC_IA64_PCREL22 +@deffnx {} BFD_RELOC_IA64_PCREL60B +@deffnx {} BFD_RELOC_IA64_PCREL64I +@deffnx {} BFD_RELOC_IA64_PCREL32MSB +@deffnx {} BFD_RELOC_IA64_PCREL32LSB +@deffnx {} BFD_RELOC_IA64_PCREL64MSB +@deffnx {} BFD_RELOC_IA64_PCREL64LSB +@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR22 +@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64I +@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR32MSB +@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR32LSB +@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64MSB +@deffnx {} BFD_RELOC_IA64_LTOFF_FPTR64LSB +@deffnx {} BFD_RELOC_IA64_SEGREL32MSB +@deffnx {} BFD_RELOC_IA64_SEGREL32LSB +@deffnx {} BFD_RELOC_IA64_SEGREL64MSB +@deffnx {} BFD_RELOC_IA64_SEGREL64LSB +@deffnx {} BFD_RELOC_IA64_SECREL32MSB +@deffnx {} BFD_RELOC_IA64_SECREL32LSB +@deffnx {} BFD_RELOC_IA64_SECREL64MSB +@deffnx {} BFD_RELOC_IA64_SECREL64LSB +@deffnx {} BFD_RELOC_IA64_REL32MSB +@deffnx {} BFD_RELOC_IA64_REL32LSB +@deffnx {} BFD_RELOC_IA64_REL64MSB +@deffnx {} BFD_RELOC_IA64_REL64LSB +@deffnx {} BFD_RELOC_IA64_LTV32MSB +@deffnx {} BFD_RELOC_IA64_LTV32LSB +@deffnx {} BFD_RELOC_IA64_LTV64MSB +@deffnx {} BFD_RELOC_IA64_LTV64LSB +@deffnx {} BFD_RELOC_IA64_IPLTMSB +@deffnx {} BFD_RELOC_IA64_IPLTLSB +@deffnx {} BFD_RELOC_IA64_COPY +@deffnx {} BFD_RELOC_IA64_LTOFF22X +@deffnx {} BFD_RELOC_IA64_LDXMOV +@deffnx {} BFD_RELOC_IA64_TPREL14 +@deffnx {} BFD_RELOC_IA64_TPREL22 +@deffnx {} BFD_RELOC_IA64_TPREL64I +@deffnx {} BFD_RELOC_IA64_TPREL64MSB +@deffnx {} BFD_RELOC_IA64_TPREL64LSB +@deffnx {} BFD_RELOC_IA64_LTOFF_TPREL22 +@deffnx {} BFD_RELOC_IA64_DTPMOD64MSB +@deffnx {} BFD_RELOC_IA64_DTPMOD64LSB +@deffnx {} BFD_RELOC_IA64_LTOFF_DTPMOD22 +@deffnx {} BFD_RELOC_IA64_DTPREL14 +@deffnx {} BFD_RELOC_IA64_DTPREL22 +@deffnx {} BFD_RELOC_IA64_DTPREL64I +@deffnx {} BFD_RELOC_IA64_DTPREL32MSB +@deffnx {} BFD_RELOC_IA64_DTPREL32LSB +@deffnx {} BFD_RELOC_IA64_DTPREL64MSB +@deffnx {} BFD_RELOC_IA64_DTPREL64LSB +@deffnx {} BFD_RELOC_IA64_LTOFF_DTPREL22 +Intel IA64 Relocations. +@end deffn +@deffn {} BFD_RELOC_M68HC11_HI8 +Motorola 68HC11 reloc. +This is the 8 bit high part of an absolute address. +@end deffn +@deffn {} BFD_RELOC_M68HC11_LO8 +Motorola 68HC11 reloc. +This is the 8 bit low part of an absolute address. +@end deffn +@deffn {} BFD_RELOC_M68HC11_3B +Motorola 68HC11 reloc. +This is the 3 bit of a value. +@end deffn +@deffn {} BFD_RELOC_M68HC11_RL_JUMP +Motorola 68HC11 reloc. +This reloc marks the beginning of a jump/call instruction. +It is used for linker relaxation to correctly identify beginning +of instruction and change some branches to use PC-relative +addressing mode. +@end deffn +@deffn {} BFD_RELOC_M68HC11_RL_GROUP +Motorola 68HC11 reloc. +This reloc marks a group of several instructions that gcc generates +and for which the linker relaxation pass can modify and/or remove +some of them. +@end deffn +@deffn {} BFD_RELOC_M68HC11_LO16 +Motorola 68HC11 reloc. +This is the 16-bit lower part of an address. It is used for 'call' +instruction to specify the symbol address without any special +transformation (due to memory bank window). +@end deffn +@deffn {} BFD_RELOC_M68HC11_PAGE +Motorola 68HC11 reloc. +This is a 8-bit reloc that specifies the page number of an address. +It is used by 'call' instruction to specify the page number of +the symbol. +@end deffn +@deffn {} BFD_RELOC_M68HC11_24 +Motorola 68HC11 reloc. +This is a 24-bit reloc that represents the address with a 16-bit +value and a 8-bit page number. The symbol address is transformed +to follow the 16K memory bank of 68HC12 (seen as mapped in the window). +@end deffn +@deffn {} BFD_RELOC_M68HC12_5B +Motorola 68HC12 reloc. +This is the 5 bits of a value. +@end deffn +@deffn {} BFD_RELOC_XGATE_RL_JUMP +Freescale XGATE reloc. +This reloc marks the beginning of a bra/jal instruction. +@end deffn +@deffn {} BFD_RELOC_XGATE_RL_GROUP +Freescale XGATE reloc. +This reloc marks a group of several instructions that gcc generates +and for which the linker relaxation pass can modify and/or remove +some of them. +@end deffn +@deffn {} BFD_RELOC_XGATE_LO16 +Freescale XGATE reloc. +This is the 16-bit lower part of an address. It is used for the '16-bit' +instructions. +@end deffn +@deffn {} BFD_RELOC_XGATE_GPAGE +Freescale XGATE reloc. +@end deffn +@deffn {} BFD_RELOC_XGATE_24 +Freescale XGATE reloc. +@end deffn +@deffn {} BFD_RELOC_XGATE_PCREL_9 +Freescale XGATE reloc. +This is a 9-bit pc-relative reloc. +@end deffn +@deffn {} BFD_RELOC_XGATE_PCREL_10 +Freescale XGATE reloc. +This is a 10-bit pc-relative reloc. +@end deffn +@deffn {} BFD_RELOC_XGATE_IMM8_LO +Freescale XGATE reloc. +This is the 16-bit lower part of an address. It is used for the '16-bit' +instructions. +@end deffn +@deffn {} BFD_RELOC_XGATE_IMM8_HI +Freescale XGATE reloc. +This is the 16-bit higher part of an address. It is used for the '16-bit' +instructions. +@end deffn +@deffn {} BFD_RELOC_XGATE_IMM3 +Freescale XGATE reloc. +This is a 3-bit pc-relative reloc. +@end deffn +@deffn {} BFD_RELOC_XGATE_IMM4 +Freescale XGATE reloc. +This is a 4-bit pc-relative reloc. +@end deffn +@deffn {} BFD_RELOC_XGATE_IMM5 +Freescale XGATE reloc. +This is a 5-bit pc-relative reloc. +@end deffn +@deffn {} BFD_RELOC_M68HC12_9B +Motorola 68HC12 reloc. +This is the 9 bits of a value. +@end deffn +@deffn {} BFD_RELOC_M68HC12_16B +Motorola 68HC12 reloc. +This is the 16 bits of a value. +@end deffn +@deffn {} BFD_RELOC_M68HC12_9_PCREL +Motorola 68HC12/XGATE reloc. +This is a PCREL9 branch. +@end deffn +@deffn {} BFD_RELOC_M68HC12_10_PCREL +Motorola 68HC12/XGATE reloc. +This is a PCREL10 branch. +@end deffn +@deffn {} BFD_RELOC_M68HC12_LO8XG +Motorola 68HC12/XGATE reloc. +This is the 8 bit low part of an absolute address and immediately precedes +a matching HI8XG part. +@end deffn +@deffn {} BFD_RELOC_M68HC12_HI8XG +Motorola 68HC12/XGATE reloc. +This is the 8 bit high part of an absolute address and immediately follows +a matching LO8XG part. +@end deffn +@deffn {} BFD_RELOC_S12Z_15_PCREL +Freescale S12Z reloc. +This is a 15 bit relative address. If the most significant bits are all zero +then it may be truncated to 8 bits. +@end deffn +@deffn {} BFD_RELOC_16C_NUM08 +@deffnx {} BFD_RELOC_16C_NUM08_C +@deffnx {} BFD_RELOC_16C_NUM16 +@deffnx {} BFD_RELOC_16C_NUM16_C +@deffnx {} BFD_RELOC_16C_NUM32 +@deffnx {} BFD_RELOC_16C_NUM32_C +@deffnx {} BFD_RELOC_16C_DISP04 +@deffnx {} BFD_RELOC_16C_DISP04_C +@deffnx {} BFD_RELOC_16C_DISP08 +@deffnx {} BFD_RELOC_16C_DISP08_C +@deffnx {} BFD_RELOC_16C_DISP16 +@deffnx {} BFD_RELOC_16C_DISP16_C +@deffnx {} BFD_RELOC_16C_DISP24 +@deffnx {} BFD_RELOC_16C_DISP24_C +@deffnx {} BFD_RELOC_16C_DISP24a +@deffnx {} BFD_RELOC_16C_DISP24a_C +@deffnx {} BFD_RELOC_16C_REG04 +@deffnx {} BFD_RELOC_16C_REG04_C +@deffnx {} BFD_RELOC_16C_REG04a +@deffnx {} BFD_RELOC_16C_REG04a_C +@deffnx {} BFD_RELOC_16C_REG14 +@deffnx {} BFD_RELOC_16C_REG14_C +@deffnx {} BFD_RELOC_16C_REG16 +@deffnx {} BFD_RELOC_16C_REG16_C +@deffnx {} BFD_RELOC_16C_REG20 +@deffnx {} BFD_RELOC_16C_REG20_C +@deffnx {} BFD_RELOC_16C_ABS20 +@deffnx {} BFD_RELOC_16C_ABS20_C +@deffnx {} BFD_RELOC_16C_ABS24 +@deffnx {} BFD_RELOC_16C_ABS24_C +@deffnx {} BFD_RELOC_16C_IMM04 +@deffnx {} BFD_RELOC_16C_IMM04_C +@deffnx {} BFD_RELOC_16C_IMM16 +@deffnx {} BFD_RELOC_16C_IMM16_C +@deffnx {} BFD_RELOC_16C_IMM20 +@deffnx {} BFD_RELOC_16C_IMM20_C +@deffnx {} BFD_RELOC_16C_IMM24 +@deffnx {} BFD_RELOC_16C_IMM24_C +@deffnx {} BFD_RELOC_16C_IMM32 +@deffnx {} BFD_RELOC_16C_IMM32_C +NS CR16C Relocations. +@end deffn +@deffn {} BFD_RELOC_CR16_NUM8 +@deffnx {} BFD_RELOC_CR16_NUM16 +@deffnx {} BFD_RELOC_CR16_NUM32 +@deffnx {} BFD_RELOC_CR16_NUM32a +@deffnx {} BFD_RELOC_CR16_REGREL0 +@deffnx {} BFD_RELOC_CR16_REGREL4 +@deffnx {} BFD_RELOC_CR16_REGREL4a +@deffnx {} BFD_RELOC_CR16_REGREL14 +@deffnx {} BFD_RELOC_CR16_REGREL14a +@deffnx {} BFD_RELOC_CR16_REGREL16 +@deffnx {} BFD_RELOC_CR16_REGREL20 +@deffnx {} BFD_RELOC_CR16_REGREL20a +@deffnx {} BFD_RELOC_CR16_ABS20 +@deffnx {} BFD_RELOC_CR16_ABS24 +@deffnx {} BFD_RELOC_CR16_IMM4 +@deffnx {} BFD_RELOC_CR16_IMM8 +@deffnx {} BFD_RELOC_CR16_IMM16 +@deffnx {} BFD_RELOC_CR16_IMM20 +@deffnx {} BFD_RELOC_CR16_IMM24 +@deffnx {} BFD_RELOC_CR16_IMM32 +@deffnx {} BFD_RELOC_CR16_IMM32a +@deffnx {} BFD_RELOC_CR16_DISP4 +@deffnx {} BFD_RELOC_CR16_DISP8 +@deffnx {} BFD_RELOC_CR16_DISP16 +@deffnx {} BFD_RELOC_CR16_DISP20 +@deffnx {} BFD_RELOC_CR16_DISP24 +@deffnx {} BFD_RELOC_CR16_DISP24a +@deffnx {} BFD_RELOC_CR16_SWITCH8 +@deffnx {} BFD_RELOC_CR16_SWITCH16 +@deffnx {} BFD_RELOC_CR16_SWITCH32 +@deffnx {} BFD_RELOC_CR16_GOT_REGREL20 +@deffnx {} BFD_RELOC_CR16_GOTC_REGREL20 +@deffnx {} BFD_RELOC_CR16_GLOB_DAT +NS CR16 Relocations. +@end deffn +@deffn {} BFD_RELOC_CRX_REL4 +@deffnx {} BFD_RELOC_CRX_REL8 +@deffnx {} BFD_RELOC_CRX_REL8_CMP +@deffnx {} BFD_RELOC_CRX_REL16 +@deffnx {} BFD_RELOC_CRX_REL24 +@deffnx {} BFD_RELOC_CRX_REL32 +@deffnx {} BFD_RELOC_CRX_REGREL12 +@deffnx {} BFD_RELOC_CRX_REGREL22 +@deffnx {} BFD_RELOC_CRX_REGREL28 +@deffnx {} BFD_RELOC_CRX_REGREL32 +@deffnx {} BFD_RELOC_CRX_ABS16 +@deffnx {} BFD_RELOC_CRX_ABS32 +@deffnx {} BFD_RELOC_CRX_NUM8 +@deffnx {} BFD_RELOC_CRX_NUM16 +@deffnx {} BFD_RELOC_CRX_NUM32 +@deffnx {} BFD_RELOC_CRX_IMM16 +@deffnx {} BFD_RELOC_CRX_IMM32 +@deffnx {} BFD_RELOC_CRX_SWITCH8 +@deffnx {} BFD_RELOC_CRX_SWITCH16 +@deffnx {} BFD_RELOC_CRX_SWITCH32 +NS CRX Relocations. +@end deffn +@deffn {} BFD_RELOC_CRIS_BDISP8 +@deffnx {} BFD_RELOC_CRIS_UNSIGNED_5 +@deffnx {} BFD_RELOC_CRIS_SIGNED_6 +@deffnx {} BFD_RELOC_CRIS_UNSIGNED_6 +@deffnx {} BFD_RELOC_CRIS_SIGNED_8 +@deffnx {} BFD_RELOC_CRIS_UNSIGNED_8 +@deffnx {} BFD_RELOC_CRIS_SIGNED_16 +@deffnx {} BFD_RELOC_CRIS_UNSIGNED_16 +@deffnx {} BFD_RELOC_CRIS_LAPCQ_OFFSET +@deffnx {} BFD_RELOC_CRIS_UNSIGNED_4 +These relocs are only used within the CRIS assembler. They are not +(at present) written to any object files. +@end deffn +@deffn {} BFD_RELOC_CRIS_COPY +@deffnx {} BFD_RELOC_CRIS_GLOB_DAT +@deffnx {} BFD_RELOC_CRIS_JUMP_SLOT +@deffnx {} BFD_RELOC_CRIS_RELATIVE +Relocs used in ELF shared libraries for CRIS. +@end deffn +@deffn {} BFD_RELOC_CRIS_32_GOT +32-bit offset to symbol-entry within GOT. +@end deffn +@deffn {} BFD_RELOC_CRIS_16_GOT +16-bit offset to symbol-entry within GOT. +@end deffn +@deffn {} BFD_RELOC_CRIS_32_GOTPLT +32-bit offset to symbol-entry within GOT, with PLT handling. +@end deffn +@deffn {} BFD_RELOC_CRIS_16_GOTPLT +16-bit offset to symbol-entry within GOT, with PLT handling. +@end deffn +@deffn {} BFD_RELOC_CRIS_32_GOTREL +32-bit offset to symbol, relative to GOT. +@end deffn +@deffn {} BFD_RELOC_CRIS_32_PLT_GOTREL +32-bit offset to symbol with PLT entry, relative to GOT. +@end deffn +@deffn {} BFD_RELOC_CRIS_32_PLT_PCREL +32-bit offset to symbol with PLT entry, relative to this relocation. +@end deffn +@deffn {} BFD_RELOC_CRIS_32_GOT_GD +@deffnx {} BFD_RELOC_CRIS_16_GOT_GD +@deffnx {} BFD_RELOC_CRIS_32_GD +@deffnx {} BFD_RELOC_CRIS_DTP +@deffnx {} BFD_RELOC_CRIS_32_DTPREL +@deffnx {} BFD_RELOC_CRIS_16_DTPREL +@deffnx {} BFD_RELOC_CRIS_32_GOT_TPREL +@deffnx {} BFD_RELOC_CRIS_16_GOT_TPREL +@deffnx {} BFD_RELOC_CRIS_32_TPREL +@deffnx {} BFD_RELOC_CRIS_16_TPREL +@deffnx {} BFD_RELOC_CRIS_DTPMOD +@deffnx {} BFD_RELOC_CRIS_32_IE +Relocs used in TLS code for CRIS. +@end deffn +@deffn {} BFD_RELOC_OR1K_REL_26 +@deffnx {} BFD_RELOC_OR1K_SLO16 +@deffnx {} BFD_RELOC_OR1K_PCREL_PG21 +@deffnx {} BFD_RELOC_OR1K_LO13 +@deffnx {} BFD_RELOC_OR1K_SLO13 +@deffnx {} BFD_RELOC_OR1K_GOTPC_HI16 +@deffnx {} BFD_RELOC_OR1K_GOTPC_LO16 +@deffnx {} BFD_RELOC_OR1K_GOT16 +@deffnx {} BFD_RELOC_OR1K_GOT_PG21 +@deffnx {} BFD_RELOC_OR1K_GOT_LO13 +@deffnx {} BFD_RELOC_OR1K_PLT26 +@deffnx {} BFD_RELOC_OR1K_PLTA26 +@deffnx {} BFD_RELOC_OR1K_GOTOFF_SLO16 +@deffnx {} BFD_RELOC_OR1K_COPY +@deffnx {} BFD_RELOC_OR1K_GLOB_DAT +@deffnx {} BFD_RELOC_OR1K_JMP_SLOT +@deffnx {} BFD_RELOC_OR1K_RELATIVE +@deffnx {} BFD_RELOC_OR1K_TLS_GD_HI16 +@deffnx {} BFD_RELOC_OR1K_TLS_GD_LO16 +@deffnx {} BFD_RELOC_OR1K_TLS_GD_PG21 +@deffnx {} BFD_RELOC_OR1K_TLS_GD_LO13 +@deffnx {} BFD_RELOC_OR1K_TLS_LDM_HI16 +@deffnx {} BFD_RELOC_OR1K_TLS_LDM_LO16 +@deffnx {} BFD_RELOC_OR1K_TLS_LDM_PG21 +@deffnx {} BFD_RELOC_OR1K_TLS_LDM_LO13 +@deffnx {} BFD_RELOC_OR1K_TLS_LDO_HI16 +@deffnx {} BFD_RELOC_OR1K_TLS_LDO_LO16 +@deffnx {} BFD_RELOC_OR1K_TLS_IE_HI16 +@deffnx {} BFD_RELOC_OR1K_TLS_IE_AHI16 +@deffnx {} BFD_RELOC_OR1K_TLS_IE_LO16 +@deffnx {} BFD_RELOC_OR1K_TLS_IE_PG21 +@deffnx {} BFD_RELOC_OR1K_TLS_IE_LO13 +@deffnx {} BFD_RELOC_OR1K_TLS_LE_HI16 +@deffnx {} BFD_RELOC_OR1K_TLS_LE_AHI16 +@deffnx {} BFD_RELOC_OR1K_TLS_LE_LO16 +@deffnx {} BFD_RELOC_OR1K_TLS_LE_SLO16 +@deffnx {} BFD_RELOC_OR1K_TLS_TPOFF +@deffnx {} BFD_RELOC_OR1K_TLS_DTPOFF +@deffnx {} BFD_RELOC_OR1K_TLS_DTPMOD +OpenRISC 1000 Relocations. +@end deffn +@deffn {} BFD_RELOC_H8_DIR16A8 +@deffnx {} BFD_RELOC_H8_DIR16R8 +@deffnx {} BFD_RELOC_H8_DIR24A8 +@deffnx {} BFD_RELOC_H8_DIR24R8 +@deffnx {} BFD_RELOC_H8_DIR32A16 +@deffnx {} BFD_RELOC_H8_DISP32A16 +H8 elf Relocations. +@end deffn +@deffn {} BFD_RELOC_XSTORMY16_REL_12 +@deffnx {} BFD_RELOC_XSTORMY16_12 +@deffnx {} BFD_RELOC_XSTORMY16_24 +@deffnx {} BFD_RELOC_XSTORMY16_FPTR16 +Sony Xstormy16 Relocations. +@end deffn +@deffn {} BFD_RELOC_RELC +Self-describing complex relocations. +@end deffn +@deffn {} BFD_RELOC_XC16X_PAG +@deffnx {} BFD_RELOC_XC16X_POF +@deffnx {} BFD_RELOC_XC16X_SEG +@deffnx {} BFD_RELOC_XC16X_SOF +Infineon Relocations. +@end deffn +@deffn {} BFD_RELOC_VAX_GLOB_DAT +@deffnx {} BFD_RELOC_VAX_JMP_SLOT +@deffnx {} BFD_RELOC_VAX_RELATIVE +Relocations used by VAX ELF. +@end deffn +@deffn {} BFD_RELOC_MT_PC16 +Morpho MT - 16 bit immediate relocation. +@end deffn +@deffn {} BFD_RELOC_MT_HI16 +Morpho MT - Hi 16 bits of an address. +@end deffn +@deffn {} BFD_RELOC_MT_LO16 +Morpho MT - Low 16 bits of an address. +@end deffn +@deffn {} BFD_RELOC_MT_GNU_VTINHERIT +Morpho MT - Used to tell the linker which vtable entries are used. +@end deffn +@deffn {} BFD_RELOC_MT_GNU_VTENTRY +Morpho MT - Used to tell the linker which vtable entries are used. +@end deffn +@deffn {} BFD_RELOC_MT_PCINSN8 +Morpho MT - 8 bit immediate relocation. +@end deffn +@deffn {} BFD_RELOC_MSP430_10_PCREL +@deffnx {} BFD_RELOC_MSP430_16_PCREL +@deffnx {} BFD_RELOC_MSP430_16 +@deffnx {} BFD_RELOC_MSP430_16_PCREL_BYTE +@deffnx {} BFD_RELOC_MSP430_16_BYTE +@deffnx {} BFD_RELOC_MSP430_2X_PCREL +@deffnx {} BFD_RELOC_MSP430_RL_PCREL +@deffnx {} BFD_RELOC_MSP430_ABS8 +@deffnx {} BFD_RELOC_MSP430X_PCR20_EXT_SRC +@deffnx {} BFD_RELOC_MSP430X_PCR20_EXT_DST +@deffnx {} BFD_RELOC_MSP430X_PCR20_EXT_ODST +@deffnx {} BFD_RELOC_MSP430X_ABS20_EXT_SRC +@deffnx {} BFD_RELOC_MSP430X_ABS20_EXT_DST +@deffnx {} BFD_RELOC_MSP430X_ABS20_EXT_ODST +@deffnx {} BFD_RELOC_MSP430X_ABS20_ADR_SRC +@deffnx {} BFD_RELOC_MSP430X_ABS20_ADR_DST +@deffnx {} BFD_RELOC_MSP430X_PCR16 +@deffnx {} BFD_RELOC_MSP430X_PCR20_CALL +@deffnx {} BFD_RELOC_MSP430X_ABS16 +@deffnx {} BFD_RELOC_MSP430_ABS_HI16 +@deffnx {} BFD_RELOC_MSP430_PREL31 +@deffnx {} BFD_RELOC_MSP430_SYM_DIFF +msp430 specific relocation codes +@end deffn +@deffn {} BFD_RELOC_NIOS2_S16 +@deffnx {} BFD_RELOC_NIOS2_U16 +@deffnx {} BFD_RELOC_NIOS2_CALL26 +@deffnx {} BFD_RELOC_NIOS2_IMM5 +@deffnx {} BFD_RELOC_NIOS2_CACHE_OPX +@deffnx {} BFD_RELOC_NIOS2_IMM6 +@deffnx {} BFD_RELOC_NIOS2_IMM8 +@deffnx {} BFD_RELOC_NIOS2_HI16 +@deffnx {} BFD_RELOC_NIOS2_LO16 +@deffnx {} BFD_RELOC_NIOS2_HIADJ16 +@deffnx {} BFD_RELOC_NIOS2_GPREL +@deffnx {} BFD_RELOC_NIOS2_UJMP +@deffnx {} BFD_RELOC_NIOS2_CJMP +@deffnx {} BFD_RELOC_NIOS2_CALLR +@deffnx {} BFD_RELOC_NIOS2_ALIGN +@deffnx {} BFD_RELOC_NIOS2_GOT16 +@deffnx {} BFD_RELOC_NIOS2_CALL16 +@deffnx {} BFD_RELOC_NIOS2_GOTOFF_LO +@deffnx {} BFD_RELOC_NIOS2_GOTOFF_HA +@deffnx {} BFD_RELOC_NIOS2_PCREL_LO +@deffnx {} BFD_RELOC_NIOS2_PCREL_HA +@deffnx {} BFD_RELOC_NIOS2_TLS_GD16 +@deffnx {} BFD_RELOC_NIOS2_TLS_LDM16 +@deffnx {} BFD_RELOC_NIOS2_TLS_LDO16 +@deffnx {} BFD_RELOC_NIOS2_TLS_IE16 +@deffnx {} BFD_RELOC_NIOS2_TLS_LE16 +@deffnx {} BFD_RELOC_NIOS2_TLS_DTPMOD +@deffnx {} BFD_RELOC_NIOS2_TLS_DTPREL +@deffnx {} BFD_RELOC_NIOS2_TLS_TPREL +@deffnx {} BFD_RELOC_NIOS2_COPY +@deffnx {} BFD_RELOC_NIOS2_GLOB_DAT +@deffnx {} BFD_RELOC_NIOS2_JUMP_SLOT +@deffnx {} BFD_RELOC_NIOS2_RELATIVE +@deffnx {} BFD_RELOC_NIOS2_GOTOFF +@deffnx {} BFD_RELOC_NIOS2_CALL26_NOAT +@deffnx {} BFD_RELOC_NIOS2_GOT_LO +@deffnx {} BFD_RELOC_NIOS2_GOT_HA +@deffnx {} BFD_RELOC_NIOS2_CALL_LO +@deffnx {} BFD_RELOC_NIOS2_CALL_HA +@deffnx {} BFD_RELOC_NIOS2_R2_S12 +@deffnx {} BFD_RELOC_NIOS2_R2_I10_1_PCREL +@deffnx {} BFD_RELOC_NIOS2_R2_T1I7_1_PCREL +@deffnx {} BFD_RELOC_NIOS2_R2_T1I7_2 +@deffnx {} BFD_RELOC_NIOS2_R2_T2I4 +@deffnx {} BFD_RELOC_NIOS2_R2_T2I4_1 +@deffnx {} BFD_RELOC_NIOS2_R2_T2I4_2 +@deffnx {} BFD_RELOC_NIOS2_R2_X1I7_2 +@deffnx {} BFD_RELOC_NIOS2_R2_X2L5 +@deffnx {} BFD_RELOC_NIOS2_R2_F1I5_2 +@deffnx {} BFD_RELOC_NIOS2_R2_L5I4X1 +@deffnx {} BFD_RELOC_NIOS2_R2_T1X1I6 +@deffnx {} BFD_RELOC_NIOS2_R2_T1X1I6_2 +Relocations used by the Altera Nios II core. +@end deffn +@deffn {} BFD_RELOC_PRU_U16 +PRU LDI 16-bit unsigned data-memory relocation. +@end deffn +@deffn {} BFD_RELOC_PRU_U16_PMEMIMM +PRU LDI 16-bit unsigned instruction-memory relocation. +@end deffn +@deffn {} BFD_RELOC_PRU_LDI32 +PRU relocation for two consecutive LDI load instructions that load a +32 bit value into a register. If the higher bits are all zero, then +the second instruction may be relaxed. +@end deffn +@deffn {} BFD_RELOC_PRU_S10_PCREL +PRU QBBx 10-bit signed PC-relative relocation. +@end deffn +@deffn {} BFD_RELOC_PRU_U8_PCREL +PRU 8-bit unsigned relocation used for the LOOP instruction. +@end deffn +@deffn {} BFD_RELOC_PRU_32_PMEM +@deffnx {} BFD_RELOC_PRU_16_PMEM +PRU Program Memory relocations. Used to convert from byte addressing to +32-bit word addressing. +@end deffn +@deffn {} BFD_RELOC_PRU_GNU_DIFF8 +@deffnx {} BFD_RELOC_PRU_GNU_DIFF16 +@deffnx {} BFD_RELOC_PRU_GNU_DIFF32 +@deffnx {} BFD_RELOC_PRU_GNU_DIFF16_PMEM +@deffnx {} BFD_RELOC_PRU_GNU_DIFF32_PMEM +PRU relocations to mark the difference of two local symbols. +These are only needed to support linker relaxation and can be ignored +when not relaxing. The field is set to the value of the difference +assuming no relaxation. The relocation encodes the position of the +second symbol so the linker can determine whether to adjust the field +value. The PMEM variants encode the word difference, instead of byte +difference between symbols. +@end deffn +@deffn {} BFD_RELOC_IQ2000_OFFSET_16 +@deffnx {} BFD_RELOC_IQ2000_OFFSET_21 +@deffnx {} BFD_RELOC_IQ2000_UHI16 +IQ2000 Relocations. +@end deffn +@deffn {} BFD_RELOC_XTENSA_RTLD +Special Xtensa relocation used only by PLT entries in ELF shared +objects to indicate that the runtime linker should set the value +to one of its own internal functions or data structures. +@end deffn +@deffn {} BFD_RELOC_XTENSA_GLOB_DAT +@deffnx {} BFD_RELOC_XTENSA_JMP_SLOT +@deffnx {} BFD_RELOC_XTENSA_RELATIVE +Xtensa relocations for ELF shared objects. +@end deffn +@deffn {} BFD_RELOC_XTENSA_PLT +Xtensa relocation used in ELF object files for symbols that may require +PLT entries. Otherwise, this is just a generic 32-bit relocation. +@end deffn +@deffn {} BFD_RELOC_XTENSA_DIFF8 +@deffnx {} BFD_RELOC_XTENSA_DIFF16 +@deffnx {} BFD_RELOC_XTENSA_DIFF32 +Xtensa relocations to mark the difference of two local symbols. +These are only needed to support linker relaxation and can be ignored +when not relaxing. The field is set to the value of the difference +assuming no relaxation. The relocation encodes the position of the +first symbol so the linker can determine whether to adjust the field +value. +@end deffn +@deffn {} BFD_RELOC_XTENSA_SLOT0_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT1_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT2_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT3_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT4_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT5_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT6_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT7_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT8_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT9_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT10_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT11_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT12_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT13_OP +@deffnx {} BFD_RELOC_XTENSA_SLOT14_OP +Generic Xtensa relocations for instruction operands. Only the slot +number is encoded in the relocation. The relocation applies to the +last PC-relative immediate operand, or if there are no PC-relative +immediates, to the last immediate operand. +@end deffn +@deffn {} BFD_RELOC_XTENSA_SLOT0_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT1_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT2_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT3_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT4_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT5_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT6_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT7_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT8_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT9_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT10_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT11_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT12_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT13_ALT +@deffnx {} BFD_RELOC_XTENSA_SLOT14_ALT +Alternate Xtensa relocations. Only the slot is encoded in the +relocation. The meaning of these relocations is opcode-specific. +@end deffn +@deffn {} BFD_RELOC_XTENSA_OP0 +@deffnx {} BFD_RELOC_XTENSA_OP1 +@deffnx {} BFD_RELOC_XTENSA_OP2 +Xtensa relocations for backward compatibility. These have all been +replaced by BFD_RELOC_XTENSA_SLOT0_OP. +@end deffn +@deffn {} BFD_RELOC_XTENSA_ASM_EXPAND +Xtensa relocation to mark that the assembler expanded the +instructions from an original target. The expansion size is +encoded in the reloc size. +@end deffn +@deffn {} BFD_RELOC_XTENSA_ASM_SIMPLIFY +Xtensa relocation to mark that the linker should simplify +assembler-expanded instructions. This is commonly used +internally by the linker after analysis of a +BFD_RELOC_XTENSA_ASM_EXPAND. +@end deffn +@deffn {} BFD_RELOC_XTENSA_TLSDESC_FN +@deffnx {} BFD_RELOC_XTENSA_TLSDESC_ARG +@deffnx {} BFD_RELOC_XTENSA_TLS_DTPOFF +@deffnx {} BFD_RELOC_XTENSA_TLS_TPOFF +@deffnx {} BFD_RELOC_XTENSA_TLS_FUNC +@deffnx {} BFD_RELOC_XTENSA_TLS_ARG +@deffnx {} BFD_RELOC_XTENSA_TLS_CALL +Xtensa TLS relocations. +@end deffn +@deffn {} BFD_RELOC_Z80_DISP8 +8 bit signed offset in (ix+d) or (iy+d). +@end deffn +@deffn {} BFD_RELOC_Z8K_DISP7 +DJNZ offset. +@end deffn +@deffn {} BFD_RELOC_Z8K_CALLR +CALR offset. +@end deffn +@deffn {} BFD_RELOC_Z8K_IMM4L +4 bit value. +@end deffn +@deffn {} BFD_RELOC_LM32_CALL +@deffnx {} BFD_RELOC_LM32_BRANCH +@deffnx {} BFD_RELOC_LM32_16_GOT +@deffnx {} BFD_RELOC_LM32_GOTOFF_HI16 +@deffnx {} BFD_RELOC_LM32_GOTOFF_LO16 +@deffnx {} BFD_RELOC_LM32_COPY +@deffnx {} BFD_RELOC_LM32_GLOB_DAT +@deffnx {} BFD_RELOC_LM32_JMP_SLOT +@deffnx {} BFD_RELOC_LM32_RELATIVE +Lattice Mico32 relocations. +@end deffn +@deffn {} BFD_RELOC_MACH_O_SECTDIFF +Difference between two section addreses. Must be followed by a +BFD_RELOC_MACH_O_PAIR. +@end deffn +@deffn {} BFD_RELOC_MACH_O_LOCAL_SECTDIFF +Like BFD_RELOC_MACH_O_SECTDIFF but with a local symbol. +@end deffn +@deffn {} BFD_RELOC_MACH_O_PAIR +Pair of relocation. Contains the first symbol. +@end deffn +@deffn {} BFD_RELOC_MACH_O_SUBTRACTOR32 +Symbol will be substracted. Must be followed by a BFD_RELOC_32. +@end deffn +@deffn {} BFD_RELOC_MACH_O_SUBTRACTOR64 +Symbol will be substracted. Must be followed by a BFD_RELOC_64. +@end deffn +@deffn {} BFD_RELOC_MACH_O_X86_64_BRANCH32 +@deffnx {} BFD_RELOC_MACH_O_X86_64_BRANCH8 +PCREL relocations. They are marked as branch to create PLT entry if +required. +@end deffn +@deffn {} BFD_RELOC_MACH_O_X86_64_GOT +Used when referencing a GOT entry. +@end deffn +@deffn {} BFD_RELOC_MACH_O_X86_64_GOT_LOAD +Used when loading a GOT entry with movq. It is specially marked so that +the linker could optimize the movq to a leaq if possible. +@end deffn +@deffn {} BFD_RELOC_MACH_O_X86_64_PCREL32_1 +Same as BFD_RELOC_32_PCREL but with an implicit -1 addend. +@end deffn +@deffn {} BFD_RELOC_MACH_O_X86_64_PCREL32_2 +Same as BFD_RELOC_32_PCREL but with an implicit -2 addend. +@end deffn +@deffn {} BFD_RELOC_MACH_O_X86_64_PCREL32_4 +Same as BFD_RELOC_32_PCREL but with an implicit -4 addend. +@end deffn +@deffn {} BFD_RELOC_MACH_O_X86_64_TLV +Used when referencing a TLV entry. +@end deffn +@deffn {} BFD_RELOC_MACH_O_ARM64_ADDEND +Addend for PAGE or PAGEOFF. +@end deffn +@deffn {} BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGE21 +Relative offset to page of GOT slot. +@end deffn +@deffn {} BFD_RELOC_MACH_O_ARM64_GOT_LOAD_PAGEOFF12 +Relative offset within page of GOT slot. +@end deffn +@deffn {} BFD_RELOC_MACH_O_ARM64_POINTER_TO_GOT +Address of a GOT entry. +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_32_LO +This is a 32 bit reloc for the microblaze that stores the +low 16 bits of a value +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_32_LO_PCREL +This is a 32 bit pc-relative reloc for the microblaze that +stores the low 16 bits of a value +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_32_ROSDA +This is a 32 bit reloc for the microblaze that stores a +value relative to the read-only small data area anchor +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_32_RWSDA +This is a 32 bit reloc for the microblaze that stores a +value relative to the read-write small data area anchor +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM +This is a 32 bit reloc for the microblaze to handle +expressions of the form "Symbol Op Symbol" +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_NONE +This is a 64 bit reloc that stores the 32 bit pc relative +value in two words (with an imm instruction). No relocation is +done here - only used for relaxing +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_GOTPC +This is a 64 bit reloc that stores the 32 bit pc relative +value in two words (with an imm instruction). The relocation is +PC-relative GOT offset +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_GOT +This is a 64 bit reloc that stores the 32 bit pc relative +value in two words (with an imm instruction). The relocation is +GOT offset +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_PLT +This is a 64 bit reloc that stores the 32 bit pc relative +value in two words (with an imm instruction). The relocation is +PC-relative offset into PLT +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_GOTOFF +This is a 64 bit reloc that stores the 32 bit GOT relative +value in two words (with an imm instruction). The relocation is +relative offset from _GLOBAL_OFFSET_TABLE_ +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_32_GOTOFF +This is a 32 bit reloc that stores the 32 bit GOT relative +value in a word. The relocation is relative offset from +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_COPY +This is used to tell the dynamic linker to copy the value out of +the dynamic object into the runtime process image. +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_TLS +Unused Reloc +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_TLSGD +This is a 64 bit reloc that stores the 32 bit GOT relative value +of the GOT TLS GD info entry in two words (with an imm instruction). The +relocation is GOT offset. +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_TLSLD +This is a 64 bit reloc that stores the 32 bit GOT relative value +of the GOT TLS LD info entry in two words (with an imm instruction). The +relocation is GOT offset. +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_32_TLSDTPMOD +This is a 32 bit reloc that stores the Module ID to GOT(n). +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_32_TLSDTPREL +This is a 32 bit reloc that stores TLS offset to GOT(n+1). +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_TLSDTPREL +This is a 32 bit reloc for storing TLS offset to two words (uses imm +instruction) +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_TLSGOTTPREL +This is a 64 bit reloc that stores 32-bit thread pointer relative offset +to two words (uses imm instruction). +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_TLSTPREL +This is a 64 bit reloc that stores 32-bit thread pointer relative offset +to two words (uses imm instruction). +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_TEXTPCREL +This is a 64 bit reloc that stores the 32 bit pc relative +value in two words (with an imm instruction). The relocation is +PC-relative offset from start of TEXT. +@end deffn +@deffn {} BFD_RELOC_MICROBLAZE_64_TEXTREL +This is a 64 bit reloc that stores the 32 bit offset +value in two words (with an imm instruction). The relocation is +relative offset from start of TEXT. +@end deffn +@deffn {} BFD_RELOC_AARCH64_RELOC_START +AArch64 pseudo relocation code to mark the start of the AArch64 +relocation enumerators. N.B. the order of the enumerators is +important as several tables in the AArch64 bfd backend are indexed +by these enumerators; make sure they are all synced. +@end deffn +@deffn {} BFD_RELOC_AARCH64_NULL +Deprecated AArch64 null relocation code. +@end deffn +@deffn {} BFD_RELOC_AARCH64_NONE +AArch64 null relocation code. +@end deffn +@deffn {} BFD_RELOC_AARCH64_64 +@deffnx {} BFD_RELOC_AARCH64_32 +@deffnx {} BFD_RELOC_AARCH64_16 +Basic absolute relocations of N bits. These are equivalent to +BFD_RELOC_N and they were added to assist the indexing of the howto +table. +@end deffn +@deffn {} BFD_RELOC_AARCH64_64_PCREL +@deffnx {} BFD_RELOC_AARCH64_32_PCREL +@deffnx {} BFD_RELOC_AARCH64_16_PCREL +PC-relative relocations. These are equivalent to BFD_RELOC_N_PCREL +and they were added to assist the indexing of the howto table. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_G0 +AArch64 MOV[NZK] instruction with most significant bits 0 to 15 +of an unsigned address/value. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_G0_NC +AArch64 MOV[NZK] instruction with less significant bits 0 to 15 of +an address/value. No overflow checking. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_G1 +AArch64 MOV[NZK] instruction with most significant bits 16 to 31 +of an unsigned address/value. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_G1_NC +AArch64 MOV[NZK] instruction with less significant bits 16 to 31 +of an address/value. No overflow checking. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_G2 +AArch64 MOV[NZK] instruction with most significant bits 32 to 47 +of an unsigned address/value. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_G2_NC +AArch64 MOV[NZK] instruction with less significant bits 32 to 47 +of an address/value. No overflow checking. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_G3 +AArch64 MOV[NZK] instruction with most signficant bits 48 to 64 +of a signed or unsigned address/value. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_G0_S +AArch64 MOV[NZ] instruction with most significant bits 0 to 15 +of a signed value. Changes instruction to MOVZ or MOVN depending on the +value's sign. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_G1_S +AArch64 MOV[NZ] instruction with most significant bits 16 to 31 +of a signed value. Changes instruction to MOVZ or MOVN depending on the +value's sign. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_G2_S +AArch64 MOV[NZ] instruction with most significant bits 32 to 47 +of a signed value. Changes instruction to MOVZ or MOVN depending on the +value's sign. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_PREL_G0 +AArch64 MOV[NZ] instruction with most significant bits 0 to 15 +of a signed value. Changes instruction to MOVZ or MOVN depending on the +value's sign. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_PREL_G0_NC +AArch64 MOV[NZ] instruction with most significant bits 0 to 15 +of a signed value. Changes instruction to MOVZ or MOVN depending on the +value's sign. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_PREL_G1 +AArch64 MOVK instruction with most significant bits 16 to 31 +of a signed value. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_PREL_G1_NC +AArch64 MOVK instruction with most significant bits 16 to 31 +of a signed value. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_PREL_G2 +AArch64 MOVK instruction with most significant bits 32 to 47 +of a signed value. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_PREL_G2_NC +AArch64 MOVK instruction with most significant bits 32 to 47 +of a signed value. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_PREL_G3 +AArch64 MOVK instruction with most significant bits 47 to 63 +of a signed value. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LD_LO19_PCREL +AArch64 Load Literal instruction, holding a 19 bit pc-relative word +offset. The lowest two bits must be zero and are not stored in the +instruction, giving a 21 bit signed byte offset. +@end deffn +@deffn {} BFD_RELOC_AARCH64_ADR_LO21_PCREL +AArch64 ADR instruction, holding a simple 21 bit pc-relative byte offset. +@end deffn +@deffn {} BFD_RELOC_AARCH64_ADR_HI21_PCREL +AArch64 ADRP instruction, with bits 12 to 32 of a pc-relative page +offset, giving a 4KB aligned page base address. +@end deffn +@deffn {} BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL +AArch64 ADRP instruction, with bits 12 to 32 of a pc-relative page +offset, giving a 4KB aligned page base address, but with no overflow +checking. +@end deffn +@deffn {} BFD_RELOC_AARCH64_ADD_LO12 +AArch64 ADD immediate instruction, holding bits 0 to 11 of the address. +Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LDST8_LO12 +AArch64 8-bit load/store instruction, holding bits 0 to 11 of the +address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TSTBR14 +AArch64 14 bit pc-relative test bit and branch. +The lowest two bits must be zero and are not stored in the instruction, +giving a 16 bit signed byte offset. +@end deffn +@deffn {} BFD_RELOC_AARCH64_BRANCH19 +AArch64 19 bit pc-relative conditional branch and compare & branch. +The lowest two bits must be zero and are not stored in the instruction, +giving a 21 bit signed byte offset. +@end deffn +@deffn {} BFD_RELOC_AARCH64_JUMP26 +AArch64 26 bit pc-relative unconditional branch. +The lowest two bits must be zero and are not stored in the instruction, +giving a 28 bit signed byte offset. +@end deffn +@deffn {} BFD_RELOC_AARCH64_CALL26 +AArch64 26 bit pc-relative unconditional branch and link. +The lowest two bits must be zero and are not stored in the instruction, +giving a 28 bit signed byte offset. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LDST16_LO12 +AArch64 16-bit load/store instruction, holding bits 0 to 11 of the +address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LDST32_LO12 +AArch64 32-bit load/store instruction, holding bits 0 to 11 of the +address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LDST64_LO12 +AArch64 64-bit load/store instruction, holding bits 0 to 11 of the +address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LDST128_LO12 +AArch64 128-bit load/store instruction, holding bits 0 to 11 of the +address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. +@end deffn +@deffn {} BFD_RELOC_AARCH64_GOT_LD_PREL19 +AArch64 Load Literal instruction, holding a 19 bit PC relative word +offset of the global offset table entry for a symbol. The lowest two +bits must be zero and are not stored in the instruction, giving a 21 +bit signed byte offset. This relocation type requires signed overflow +checking. +@end deffn +@deffn {} BFD_RELOC_AARCH64_ADR_GOT_PAGE +Get to the page base of the global offset table entry for a symbol as +part of an ADRP instruction using a 21 bit PC relative value.Used in +conjunction with BFD_RELOC_AARCH64_LD64_GOT_LO12_NC. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LD64_GOT_LO12_NC +Unsigned 12 bit byte offset for 64 bit load/store from the page of +the GOT entry for this symbol. Used in conjunction with +BFD_RELOC_AARCH64_ADR_GOT_PAGE. Valid in LP64 ABI only. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LD32_GOT_LO12_NC +Unsigned 12 bit byte offset for 32 bit load/store from the page of +the GOT entry for this symbol. Used in conjunction with +BFD_RELOC_AARCH64_ADR_GOT_PAGE. Valid in ILP32 ABI only. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC +Unsigned 16 bit byte offset for 64 bit load/store from the GOT entry +for this symbol. Valid in LP64 ABI only. +@end deffn +@deffn {} BFD_RELOC_AARCH64_MOVW_GOTOFF_G1 +Unsigned 16 bit byte higher offset for 64 bit load/store from the GOT entry +for this symbol. Valid in LP64 ABI only. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LD64_GOTOFF_LO15 +Unsigned 15 bit byte offset for 64 bit load/store from the page of +the GOT entry for this symbol. Valid in LP64 ABI only. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14 +Scaled 14 bit byte offset to the page base of the global offset table. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15 +Scaled 15 bit byte offset to the page base of the global offset table. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21 +Get to the page base of the global offset table entry for a symbols +tls_index structure as part of an adrp instruction using a 21 bit PC +relative value. Used in conjunction with +BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSGD_ADR_PREL21 +AArch64 TLS General Dynamic +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC +Unsigned 12 bit byte offset to global offset table entry for a symbols +tls_index structure. Used in conjunction with +BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC +AArch64 TLS General Dynamic relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSGD_MOVW_G1 +AArch64 TLS General Dynamic relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 +AArch64 TLS INITIAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC +AArch64 TLS INITIAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC +AArch64 TLS INITIAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19 +AArch64 TLS INITIAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC +AArch64 TLS INITIAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1 +AArch64 TLS INITIAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12 +bit[23:12] of byte offset to module TLS base address. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12 +Unsigned 12 bit byte offset to module TLS base address. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC +No overflow check version of BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC +Unsigned 12 bit byte offset to global offset table entry for a symbols +tls_index structure. Used in conjunction with +BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21 +GOT entry page address for AArch64 TLS Local Dynamic, used with ADRP +instruction. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_ADR_PREL21 +GOT entry address for AArch64 TLS Local Dynamic, used with ADR instruction. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12 +bit[11:1] of byte offset to module TLS base address, encoded in ldst +instructions. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC +Similar as BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, but no overflow check. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12 +bit[11:2] of byte offset to module TLS base address, encoded in ldst +instructions. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC +Similar as BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, but no overflow check. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12 +bit[11:3] of byte offset to module TLS base address, encoded in ldst +instructions. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC +Similar as BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, but no overflow check. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12 +bit[11:0] of byte offset to module TLS base address, encoded in ldst +instructions. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC +Similar as BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, but no overflow check. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0 +bit[15:0] of byte offset to module TLS base address. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC +No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0 +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1 +bit[31:16] of byte offset to module TLS base address. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC +No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1 +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2 +bit[47:32] of byte offset to module TLS base address. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2 +AArch64 TLS LOCAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1 +AArch64 TLS LOCAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC +AArch64 TLS LOCAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0 +AArch64 TLS LOCAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC +AArch64 TLS LOCAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12 +AArch64 TLS LOCAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12 +AArch64 TLS LOCAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC +AArch64 TLS LOCAL EXEC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12 +bit[11:1] of byte offset to module TLS base address, encoded in ldst +instructions. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC +Similar as BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12, but no overflow check. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12 +bit[11:2] of byte offset to module TLS base address, encoded in ldst +instructions. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC +Similar as BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12, but no overflow check. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12 +bit[11:3] of byte offset to module TLS base address, encoded in ldst +instructions. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC +Similar as BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12, but no overflow check. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12 +bit[11:0] of byte offset to module TLS base address, encoded in ldst +instructions. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC +Similar as BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12, but no overflow check. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_LD_PREL19 +AArch64 TLS DESC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21 +AArch64 TLS DESC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21 +AArch64 TLS DESC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_LD64_LO12 +AArch64 TLS DESC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC +AArch64 TLS DESC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_ADD_LO12 +AArch64 TLS DESC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_OFF_G1 +AArch64 TLS DESC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC +AArch64 TLS DESC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_LDR +AArch64 TLS DESC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_ADD +AArch64 TLS DESC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_CALL +AArch64 TLS DESC relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_COPY +AArch64 TLS relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_GLOB_DAT +AArch64 TLS relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_JUMP_SLOT +AArch64 TLS relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_RELATIVE +AArch64 TLS relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLS_DTPMOD +AArch64 TLS relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLS_DTPREL +AArch64 TLS relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLS_TPREL +AArch64 TLS relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC +AArch64 TLS relocation. +@end deffn +@deffn {} BFD_RELOC_AARCH64_IRELATIVE +AArch64 support for STT_GNU_IFUNC. +@end deffn +@deffn {} BFD_RELOC_AARCH64_RELOC_END +AArch64 pseudo relocation code to mark the end of the AArch64 +relocation enumerators that have direct mapping to ELF reloc codes. +There are a few more enumerators after this one; those are mainly +used by the AArch64 assembler for the internal fixup or to select +one of the above enumerators. +@end deffn +@deffn {} BFD_RELOC_AARCH64_GAS_INTERNAL_FIXUP +AArch64 pseudo relocation code to be used internally by the AArch64 +assembler and not (currently) written to any object files. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LDST_LO12 +AArch64 unspecified load/store instruction, holding bits 0 to 11 of the +address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12 +AArch64 pseudo relocation code for TLS local dynamic mode. It's to be +used internally by the AArch64 assembler and not (currently) written to +any object files. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12_NC +Similar as BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12, but no overflow check. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_LDST_TPREL_LO12 +AArch64 pseudo relocation code for TLS local exec mode. It's to be +used internally by the AArch64 assembler and not (currently) written to +any object files. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSLE_LDST_TPREL_LO12_NC +Similar as BFD_RELOC_AARCH64_TLSLE_LDST_TPREL_LO12, but no overflow check. +@end deffn +@deffn {} BFD_RELOC_AARCH64_LD_GOT_LO12_NC +AArch64 pseudo relocation code to be used internally by the AArch64 +assembler and not (currently) written to any object files. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_LO12_NC +AArch64 pseudo relocation code to be used internally by the AArch64 +assembler and not (currently) written to any object files. +@end deffn +@deffn {} BFD_RELOC_AARCH64_TLSDESC_LD_LO12_NC +AArch64 pseudo relocation code to be used internally by the AArch64 +assembler and not (currently) written to any object files. +@end deffn +@deffn {} BFD_RELOC_TILEPRO_COPY +@deffnx {} BFD_RELOC_TILEPRO_GLOB_DAT +@deffnx {} BFD_RELOC_TILEPRO_JMP_SLOT +@deffnx {} BFD_RELOC_TILEPRO_RELATIVE +@deffnx {} BFD_RELOC_TILEPRO_BROFF_X1 +@deffnx {} BFD_RELOC_TILEPRO_JOFFLONG_X1 +@deffnx {} BFD_RELOC_TILEPRO_JOFFLONG_X1_PLT +@deffnx {} BFD_RELOC_TILEPRO_IMM8_X0 +@deffnx {} BFD_RELOC_TILEPRO_IMM8_Y0 +@deffnx {} BFD_RELOC_TILEPRO_IMM8_X1 +@deffnx {} BFD_RELOC_TILEPRO_IMM8_Y1 +@deffnx {} BFD_RELOC_TILEPRO_DEST_IMM8_X1 +@deffnx {} BFD_RELOC_TILEPRO_MT_IMM15_X1 +@deffnx {} BFD_RELOC_TILEPRO_MF_IMM15_X1 +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0 +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1 +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_LO +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_LO +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_HI +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_HI +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_HA +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_HA +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_PCREL +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_PCREL +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_LO_PCREL +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_LO_PCREL +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_HI_PCREL +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_HI_PCREL +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_HA_PCREL +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_HA_PCREL +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_GOT +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_GOT +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_GOT_LO +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_GOT_LO +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_GOT_HI +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_GOT_HI +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_GOT_HA +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_GOT_HA +@deffnx {} BFD_RELOC_TILEPRO_MMSTART_X0 +@deffnx {} BFD_RELOC_TILEPRO_MMEND_X0 +@deffnx {} BFD_RELOC_TILEPRO_MMSTART_X1 +@deffnx {} BFD_RELOC_TILEPRO_MMEND_X1 +@deffnx {} BFD_RELOC_TILEPRO_SHAMT_X0 +@deffnx {} BFD_RELOC_TILEPRO_SHAMT_X1 +@deffnx {} BFD_RELOC_TILEPRO_SHAMT_Y0 +@deffnx {} BFD_RELOC_TILEPRO_SHAMT_Y1 +@deffnx {} BFD_RELOC_TILEPRO_TLS_GD_CALL +@deffnx {} BFD_RELOC_TILEPRO_IMM8_X0_TLS_GD_ADD +@deffnx {} BFD_RELOC_TILEPRO_IMM8_X1_TLS_GD_ADD +@deffnx {} BFD_RELOC_TILEPRO_IMM8_Y0_TLS_GD_ADD +@deffnx {} BFD_RELOC_TILEPRO_IMM8_Y1_TLS_GD_ADD +@deffnx {} BFD_RELOC_TILEPRO_TLS_IE_LOAD +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_LO +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_LO +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_HI +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_HI +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_HA +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_HA +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_LO +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_LO +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_HI +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_HI +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_HA +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_HA +@deffnx {} BFD_RELOC_TILEPRO_TLS_DTPMOD32 +@deffnx {} BFD_RELOC_TILEPRO_TLS_DTPOFF32 +@deffnx {} BFD_RELOC_TILEPRO_TLS_TPOFF32 +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_LO +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_LO +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HI +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HI +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HA +@deffnx {} BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HA +Tilera TILEPro Relocations. +@end deffn +@deffn {} BFD_RELOC_TILEGX_HW0 +@deffnx {} BFD_RELOC_TILEGX_HW1 +@deffnx {} BFD_RELOC_TILEGX_HW2 +@deffnx {} BFD_RELOC_TILEGX_HW3 +@deffnx {} BFD_RELOC_TILEGX_HW0_LAST +@deffnx {} BFD_RELOC_TILEGX_HW1_LAST +@deffnx {} BFD_RELOC_TILEGX_HW2_LAST +@deffnx {} BFD_RELOC_TILEGX_COPY +@deffnx {} BFD_RELOC_TILEGX_GLOB_DAT +@deffnx {} BFD_RELOC_TILEGX_JMP_SLOT +@deffnx {} BFD_RELOC_TILEGX_RELATIVE +@deffnx {} BFD_RELOC_TILEGX_BROFF_X1 +@deffnx {} BFD_RELOC_TILEGX_JUMPOFF_X1 +@deffnx {} BFD_RELOC_TILEGX_JUMPOFF_X1_PLT +@deffnx {} BFD_RELOC_TILEGX_IMM8_X0 +@deffnx {} BFD_RELOC_TILEGX_IMM8_Y0 +@deffnx {} BFD_RELOC_TILEGX_IMM8_X1 +@deffnx {} BFD_RELOC_TILEGX_IMM8_Y1 +@deffnx {} BFD_RELOC_TILEGX_DEST_IMM8_X1 +@deffnx {} BFD_RELOC_TILEGX_MT_IMM14_X1 +@deffnx {} BFD_RELOC_TILEGX_MF_IMM14_X1 +@deffnx {} BFD_RELOC_TILEGX_MMSTART_X0 +@deffnx {} BFD_RELOC_TILEGX_MMEND_X0 +@deffnx {} BFD_RELOC_TILEGX_SHAMT_X0 +@deffnx {} BFD_RELOC_TILEGX_SHAMT_X1 +@deffnx {} BFD_RELOC_TILEGX_SHAMT_Y0 +@deffnx {} BFD_RELOC_TILEGX_SHAMT_Y1 +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0 +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0 +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1 +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1 +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW2 +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW2 +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW3 +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW3 +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW2_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW2_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW3_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW3_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_GOT +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_GOT +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW2_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW2_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_GOT +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_GOT +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_GOT +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_GOT +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW3_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW3_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_GD +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_GD +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_LE +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_LE +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_LE +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_LE +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_LE +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_LE +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_GD +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_GD +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_GD +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_GD +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_IE +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_IE +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_IE +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_IE +@deffnx {} BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_IE +@deffnx {} BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_IE +@deffnx {} BFD_RELOC_TILEGX_TLS_DTPMOD64 +@deffnx {} BFD_RELOC_TILEGX_TLS_DTPOFF64 +@deffnx {} BFD_RELOC_TILEGX_TLS_TPOFF64 +@deffnx {} BFD_RELOC_TILEGX_TLS_DTPMOD32 +@deffnx {} BFD_RELOC_TILEGX_TLS_DTPOFF32 +@deffnx {} BFD_RELOC_TILEGX_TLS_TPOFF32 +@deffnx {} BFD_RELOC_TILEGX_TLS_GD_CALL +@deffnx {} BFD_RELOC_TILEGX_IMM8_X0_TLS_GD_ADD +@deffnx {} BFD_RELOC_TILEGX_IMM8_X1_TLS_GD_ADD +@deffnx {} BFD_RELOC_TILEGX_IMM8_Y0_TLS_GD_ADD +@deffnx {} BFD_RELOC_TILEGX_IMM8_Y1_TLS_GD_ADD +@deffnx {} BFD_RELOC_TILEGX_TLS_IE_LOAD +@deffnx {} BFD_RELOC_TILEGX_IMM8_X0_TLS_ADD +@deffnx {} BFD_RELOC_TILEGX_IMM8_X1_TLS_ADD +@deffnx {} BFD_RELOC_TILEGX_IMM8_Y0_TLS_ADD +@deffnx {} BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD +Tilera TILE-Gx Relocations. +@end deffn +@deffn {} BFD_RELOC_EPIPHANY_SIMM8 +Adapteva EPIPHANY - 8 bit signed pc-relative displacement +@end deffn +@deffn {} BFD_RELOC_EPIPHANY_SIMM24 +Adapteva EPIPHANY - 24 bit signed pc-relative displacement +@end deffn +@deffn {} BFD_RELOC_EPIPHANY_HIGH +Adapteva EPIPHANY - 16 most-significant bits of absolute address +@end deffn +@deffn {} BFD_RELOC_EPIPHANY_LOW +Adapteva EPIPHANY - 16 least-significant bits of absolute address +@end deffn +@deffn {} BFD_RELOC_EPIPHANY_SIMM11 +Adapteva EPIPHANY - 11 bit signed number - add/sub immediate +@end deffn +@deffn {} BFD_RELOC_EPIPHANY_IMM11 +Adapteva EPIPHANY - 11 bit sign-magnitude number (ld/st displacement) +@end deffn +@deffn {} BFD_RELOC_EPIPHANY_IMM8 +Adapteva EPIPHANY - 8 bit immediate for 16 bit mov instruction. +@end deffn +@deffn {} BFD_RELOC_VISIUM_HI16 +@deffnx {} BFD_RELOC_VISIUM_LO16 +@deffnx {} BFD_RELOC_VISIUM_IM16 +@deffnx {} BFD_RELOC_VISIUM_REL16 +@deffnx {} BFD_RELOC_VISIUM_HI16_PCREL +@deffnx {} BFD_RELOC_VISIUM_LO16_PCREL +@deffnx {} BFD_RELOC_VISIUM_IM16_PCREL +Visium Relocations. +@end deffn +@deffn {} BFD_RELOC_WASM32_LEB128 +@deffnx {} BFD_RELOC_WASM32_LEB128_GOT +@deffnx {} BFD_RELOC_WASM32_LEB128_GOT_CODE +@deffnx {} BFD_RELOC_WASM32_LEB128_PLT +@deffnx {} BFD_RELOC_WASM32_PLT_INDEX +@deffnx {} BFD_RELOC_WASM32_ABS32_CODE +@deffnx {} BFD_RELOC_WASM32_COPY +@deffnx {} BFD_RELOC_WASM32_CODE_POINTER +@deffnx {} BFD_RELOC_WASM32_INDEX +@deffnx {} BFD_RELOC_WASM32_PLT_SIG +WebAssembly relocations. +@end deffn +@deffn {} BFD_RELOC_CKCORE_NONE +@deffnx {} BFD_RELOC_CKCORE_ADDR32 +@deffnx {} BFD_RELOC_CKCORE_PCREL_IMM8BY4 +@deffnx {} BFD_RELOC_CKCORE_PCREL_IMM11BY2 +@deffnx {} BFD_RELOC_CKCORE_PCREL_IMM4BY2 +@deffnx {} BFD_RELOC_CKCORE_PCREL32 +@deffnx {} BFD_RELOC_CKCORE_PCREL_JSR_IMM11BY2 +@deffnx {} BFD_RELOC_CKCORE_GNU_VTINHERIT +@deffnx {} BFD_RELOC_CKCORE_GNU_VTENTRY +@deffnx {} BFD_RELOC_CKCORE_RELATIVE +@deffnx {} BFD_RELOC_CKCORE_COPY +@deffnx {} BFD_RELOC_CKCORE_GLOB_DAT +@deffnx {} BFD_RELOC_CKCORE_JUMP_SLOT +@deffnx {} BFD_RELOC_CKCORE_GOTOFF +@deffnx {} BFD_RELOC_CKCORE_GOTPC +@deffnx {} BFD_RELOC_CKCORE_GOT32 +@deffnx {} BFD_RELOC_CKCORE_PLT32 +@deffnx {} BFD_RELOC_CKCORE_ADDRGOT +@deffnx {} BFD_RELOC_CKCORE_ADDRPLT +@deffnx {} BFD_RELOC_CKCORE_PCREL_IMM26BY2 +@deffnx {} BFD_RELOC_CKCORE_PCREL_IMM16BY2 +@deffnx {} BFD_RELOC_CKCORE_PCREL_IMM16BY4 +@deffnx {} BFD_RELOC_CKCORE_PCREL_IMM10BY2 +@deffnx {} BFD_RELOC_CKCORE_PCREL_IMM10BY4 +@deffnx {} BFD_RELOC_CKCORE_ADDR_HI16 +@deffnx {} BFD_RELOC_CKCORE_ADDR_LO16 +@deffnx {} BFD_RELOC_CKCORE_GOTPC_HI16 +@deffnx {} BFD_RELOC_CKCORE_GOTPC_LO16 +@deffnx {} BFD_RELOC_CKCORE_GOTOFF_HI16 +@deffnx {} BFD_RELOC_CKCORE_GOTOFF_LO16 +@deffnx {} BFD_RELOC_CKCORE_GOT12 +@deffnx {} BFD_RELOC_CKCORE_GOT_HI16 +@deffnx {} BFD_RELOC_CKCORE_GOT_LO16 +@deffnx {} BFD_RELOC_CKCORE_PLT12 +@deffnx {} BFD_RELOC_CKCORE_PLT_HI16 +@deffnx {} BFD_RELOC_CKCORE_PLT_LO16 +@deffnx {} BFD_RELOC_CKCORE_ADDRGOT_HI16 +@deffnx {} BFD_RELOC_CKCORE_ADDRGOT_LO16 +@deffnx {} BFD_RELOC_CKCORE_ADDRPLT_HI16 +@deffnx {} BFD_RELOC_CKCORE_ADDRPLT_LO16 +@deffnx {} BFD_RELOC_CKCORE_PCREL_JSR_IMM26BY2 +@deffnx {} BFD_RELOC_CKCORE_TOFFSET_LO16 +@deffnx {} BFD_RELOC_CKCORE_DOFFSET_LO16 +@deffnx {} BFD_RELOC_CKCORE_PCREL_IMM18BY2 +@deffnx {} BFD_RELOC_CKCORE_DOFFSET_IMM18 +@deffnx {} BFD_RELOC_CKCORE_DOFFSET_IMM18BY2 +@deffnx {} BFD_RELOC_CKCORE_DOFFSET_IMM18BY4 +@deffnx {} BFD_RELOC_CKCORE_GOTOFF_IMM18 +@deffnx {} BFD_RELOC_CKCORE_GOT_IMM18BY4 +@deffnx {} BFD_RELOC_CKCORE_PLT_IMM18BY4 +@deffnx {} BFD_RELOC_CKCORE_PCREL_IMM7BY4 +@deffnx {} BFD_RELOC_CKCORE_TLS_LE32 +@deffnx {} BFD_RELOC_CKCORE_TLS_IE32 +@deffnx {} BFD_RELOC_CKCORE_TLS_GD32 +@deffnx {} BFD_RELOC_CKCORE_TLS_LDM32 +@deffnx {} BFD_RELOC_CKCORE_TLS_LDO32 +@deffnx {} BFD_RELOC_CKCORE_TLS_DTPMOD32 +@deffnx {} BFD_RELOC_CKCORE_TLS_DTPOFF32 +@deffnx {} BFD_RELOC_CKCORE_TLS_TPOFF32 +@deffnx {} BFD_RELOC_CKCORE_PCREL_FLRW_IMM8BY4 +@deffnx {} BFD_RELOC_CKCORE_NOJSRI +@deffnx {} BFD_RELOC_CKCORE_CALLGRAPH +@deffnx {} BFD_RELOC_CKCORE_IRELATIVE +@deffnx {} BFD_RELOC_CKCORE_PCREL_BLOOP_IMM4BY4 +@deffnx {} BFD_RELOC_CKCORE_PCREL_BLOOP_IMM12BY4 +C-SKY relocations. +@end deffn +@deffn {} BFD_RELOC_S12Z_OPR +S12Z relocations. +@end deffn + +@example + +typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; +@end example +@findex bfd_reloc_type_lookup +@subsubsection @code{bfd_reloc_type_lookup} +@strong{Synopsis} +@example +reloc_howto_type *bfd_reloc_type_lookup + (bfd *abfd, bfd_reloc_code_real_type code); +reloc_howto_type *bfd_reloc_name_lookup + (bfd *abfd, const char *reloc_name); +@end example +@strong{Description}@* +Return a pointer to a howto structure which, when +invoked, will perform the relocation @var{code} on data from the +architecture noted. + +@findex bfd_default_reloc_type_lookup +@subsubsection @code{bfd_default_reloc_type_lookup} +@strong{Synopsis} +@example +reloc_howto_type *bfd_default_reloc_type_lookup + (bfd *abfd, bfd_reloc_code_real_type code); +@end example +@strong{Description}@* +Provides a default relocation lookup routine for any architecture. + +@findex bfd_get_reloc_code_name +@subsubsection @code{bfd_get_reloc_code_name} +@strong{Synopsis} +@example +const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); +@end example +@strong{Description}@* +Provides a printable name for the supplied relocation code. +Useful mainly for printing error messages. + +@findex bfd_generic_relax_section +@subsubsection @code{bfd_generic_relax_section} +@strong{Synopsis} +@example +bfd_boolean bfd_generic_relax_section + (bfd *abfd, + asection *section, + struct bfd_link_info *, + bfd_boolean *); +@end example +@strong{Description}@* +Provides default handling for relaxing for back ends which +don't do relaxing. + +@findex bfd_generic_gc_sections +@subsubsection @code{bfd_generic_gc_sections} +@strong{Synopsis} +@example +bfd_boolean bfd_generic_gc_sections + (bfd *, struct bfd_link_info *); +@end example +@strong{Description}@* +Provides default handling for relaxing for back ends which +don't do section gc -- i.e., does nothing. + +@findex bfd_generic_lookup_section_flags +@subsubsection @code{bfd_generic_lookup_section_flags} +@strong{Synopsis} +@example +bfd_boolean bfd_generic_lookup_section_flags + (struct bfd_link_info *, struct flag_info *, asection *); +@end example +@strong{Description}@* +Provides default handling for section flags lookup +-- i.e., does nothing. +Returns FALSE if the section should be omitted, otherwise TRUE. + +@findex bfd_generic_merge_sections +@subsubsection @code{bfd_generic_merge_sections} +@strong{Synopsis} +@example +bfd_boolean bfd_generic_merge_sections + (bfd *, struct bfd_link_info *); +@end example +@strong{Description}@* +Provides default handling for SEC_MERGE section merging for back ends +which don't have SEC_MERGE support -- i.e., does nothing. + +@findex bfd_generic_get_relocated_section_contents +@subsubsection @code{bfd_generic_get_relocated_section_contents} +@strong{Synopsis} +@example +bfd_byte *bfd_generic_get_relocated_section_contents + (bfd *abfd, + struct bfd_link_info *link_info, + struct bfd_link_order *link_order, + bfd_byte *data, + bfd_boolean relocatable, + asymbol **symbols); +@end example +@strong{Description}@* +Provides default handling of relocation effort for back ends +which can't be bothered to do it efficiently. + +@findex _bfd_generic_set_reloc +@subsubsection @code{_bfd_generic_set_reloc} +@strong{Synopsis} +@example +void _bfd_generic_set_reloc + (bfd *abfd, + sec_ptr section, + arelent **relptr, + unsigned int count); +@end example +@strong{Description}@* +Installs a new set of internal relocations in SECTION. + +@findex _bfd_unrecognized_reloc +@subsubsection @code{_bfd_unrecognized_reloc} +@strong{Synopsis} +@example +bfd_boolean _bfd_unrecognized_reloc + (bfd * abfd, + sec_ptr section, + unsigned int r_type); +@end example +@strong{Description}@* +Reports an unrecognized reloc. +Written as a function in order to reduce code duplication. +Returns FALSE so that it can be called from a return statement. + diff --git a/gdb-8.3.1/bfd/doc/section.texi b/gdb-8.3.1/bfd/doc/section.texi new file mode 100644 index 0000000000000000000000000000000000000000..b602583fe9f1fe81ea7017552d2d3a51356e5cf5 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/section.texi @@ -0,0 +1,1093 @@ +@section Sections +The raw data contained within a BFD is maintained through the +section abstraction. A single BFD may have any number of +sections. It keeps hold of them by pointing to the first; +each one points to the next in the list. + +Sections are supported in BFD in @code{section.c}. + +@menu +* Section Input:: +* Section Output:: +* typedef asection:: +* section prototypes:: +@end menu + +@node Section Input, Section Output, Sections, Sections +@subsection Section input +When a BFD is opened for reading, the section structures are +created and attached to the BFD. + +Each section has a name which describes the section in the +outside world---for example, @code{a.out} would contain at least +three sections, called @code{.text}, @code{.data} and @code{.bss}. + +Names need not be unique; for example a COFF file may have several +sections named @code{.data}. + +Sometimes a BFD will contain more than the ``natural'' number of +sections. A back end may attach other sections containing +constructor data, or an application may add a section (using +@code{bfd_make_section}) to the sections attached to an already open +BFD. For example, the linker creates an extra section +@code{COMMON} for each input file's BFD to hold information about +common storage. + +The raw data is not necessarily read in when +the section descriptor is created. Some targets may leave the +data in place until a @code{bfd_get_section_contents} call is +made. Other back ends may read in all the data at once. For +example, an S-record file has to be read once to determine the +size of the data. + +@node Section Output, typedef asection, Section Input, Sections +@subsection Section output +To write a new object style BFD, the various sections to be +written have to be created. They are attached to the BFD in +the same way as input sections; data is written to the +sections using @code{bfd_set_section_contents}. + +Any program that creates or combines sections (e.g., the assembler +and linker) must use the @code{asection} fields @code{output_section} and +@code{output_offset} to indicate the file sections to which each +section must be written. (If the section is being created from +scratch, @code{output_section} should probably point to the section +itself and @code{output_offset} should probably be zero.) + +The data to be written comes from input sections attached +(via @code{output_section} pointers) to +the output sections. The output section structure can be +considered a filter for the input section: the output section +determines the vma of the output data and the name, but the +input section determines the offset into the output section of +the data to be written. + +E.g., to create a section "O", starting at 0x100, 0x123 long, +containing two subsections, "A" at offset 0x0 (i.e., at vma +0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the @code{asection} +structures would look like: + +@example + section name "A" + output_offset 0x00 + size 0x20 + output_section -----------> section name "O" + | vma 0x100 + section name "B" | size 0x123 + output_offset 0x20 | + size 0x103 | + output_section --------| +@end example + +@subsection Link orders +The data within a section is stored in a @dfn{link_order}. +These are much like the fixups in @code{gas}. The link_order +abstraction allows a section to grow and shrink within itself. + +A link_order knows how big it is, and which is the next +link_order and where the raw data for it is; it also points to +a list of relocations which apply to it. + +The link_order is used by the linker to perform relaxing on +final code. The compiler creates code which is as big as +necessary to make it work without relaxing, and the user can +select whether to relax. Sometimes relaxing takes a lot of +time. The linker runs around the relocations to see if any +are attached to data which can be shrunk, if so it does it on +a link_order by link_order basis. + + +@node typedef asection, section prototypes, Section Output, Sections +@subsection typedef asection +Here is the section structure: + + +@example + +typedef struct bfd_section +@{ + /* The name of the section; the name isn't a copy, the pointer is + the same as that passed to bfd_make_section. */ + const char *name; + + /* A unique sequence number. */ + unsigned int id; + + /* Which section in the bfd; 0..n-1 as sections are created in a bfd. */ + unsigned int index; + + /* The next section in the list belonging to the BFD, or NULL. */ + struct bfd_section *next; + + /* The previous section in the list belonging to the BFD, or NULL. */ + struct bfd_section *prev; + + /* The field flags contains attributes of the section. Some + flags are read in from the object file, and some are + synthesized from other information. */ + flagword flags; + +#define SEC_NO_FLAGS 0x0 + + /* Tells the OS to allocate space for this section when loading. + This is clear for a section containing debug information only. */ +#define SEC_ALLOC 0x1 + + /* Tells the OS to load the section from the file when loading. + This is clear for a .bss section. */ +#define SEC_LOAD 0x2 + + /* The section contains data still to be relocated, so there is + some relocation information too. */ +#define SEC_RELOC 0x4 + + /* A signal to the OS that the section contains read only data. */ +#define SEC_READONLY 0x8 + + /* The section contains code only. */ +#define SEC_CODE 0x10 + + /* The section contains data only. */ +#define SEC_DATA 0x20 + + /* The section will reside in ROM. */ +#define SEC_ROM 0x40 + + /* The section contains constructor information. This section + type is used by the linker to create lists of constructors and + destructors used by @code{g++}. When a back end sees a symbol + which should be used in a constructor list, it creates a new + section for the type of name (e.g., @code{__CTOR_LIST__}), attaches + the symbol to it, and builds a relocation. To build the lists + of constructors, all the linker has to do is catenate all the + sections called @code{__CTOR_LIST__} and relocate the data + contained within - exactly the operations it would peform on + standard data. */ +#define SEC_CONSTRUCTOR 0x80 + + /* The section has contents - a data section could be + @code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be + @code{SEC_HAS_CONTENTS} */ +#define SEC_HAS_CONTENTS 0x100 + + /* An instruction to the linker to not output the section + even if it has information which would normally be written. */ +#define SEC_NEVER_LOAD 0x200 + + /* The section contains thread local data. */ +#define SEC_THREAD_LOCAL 0x400 + + /* The section's size is fixed. Generic linker code will not + recalculate it and it is up to whoever has set this flag to + get the size right. */ +#define SEC_FIXED_SIZE 0x800 + + /* The section contains common symbols (symbols may be defined + multiple times, the value of a symbol is the amount of + space it requires, and the largest symbol value is the one + used). Most targets have exactly one of these (which we + translate to bfd_com_section_ptr), but ECOFF has two. */ +#define SEC_IS_COMMON 0x1000 + + /* The section contains only debugging information. For + example, this is set for ELF .debug and .stab sections. + strip tests this flag to see if a section can be + discarded. */ +#define SEC_DEBUGGING 0x2000 + + /* The contents of this section are held in memory pointed to + by the contents field. This is checked by bfd_get_section_contents, + and the data is retrieved from memory if appropriate. */ +#define SEC_IN_MEMORY 0x4000 + + /* The contents of this section are to be excluded by the + linker for executable and shared objects unless those + objects are to be further relocated. */ +#define SEC_EXCLUDE 0x8000 + + /* The contents of this section are to be sorted based on the sum of + the symbol and addend values specified by the associated relocation + entries. Entries without associated relocation entries will be + appended to the end of the section in an unspecified order. */ +#define SEC_SORT_ENTRIES 0x10000 + + /* When linking, duplicate sections of the same name should be + discarded, rather than being combined into a single section as + is usually done. This is similar to how common symbols are + handled. See SEC_LINK_DUPLICATES below. */ +#define SEC_LINK_ONCE 0x20000 + + /* If SEC_LINK_ONCE is set, this bitfield describes how the linker + should handle duplicate sections. */ +#define SEC_LINK_DUPLICATES 0xc0000 + + /* This value for SEC_LINK_DUPLICATES means that duplicate + sections with the same name should simply be discarded. */ +#define SEC_LINK_DUPLICATES_DISCARD 0x0 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if there are any duplicate sections, although + it should still only link one copy. */ +#define SEC_LINK_DUPLICATES_ONE_ONLY 0x40000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections are a different size. */ +#define SEC_LINK_DUPLICATES_SAME_SIZE 0x80000 + + /* This value for SEC_LINK_DUPLICATES means that the linker + should warn if any duplicate sections contain different + contents. */ +#define SEC_LINK_DUPLICATES_SAME_CONTENTS \ + (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE) + + /* This section was created by the linker as part of dynamic + relocation or other arcane processing. It is skipped when + going through the first-pass output, trusting that someone + else up the line will take care of it later. */ +#define SEC_LINKER_CREATED 0x100000 + + /* This section should not be subject to garbage collection. + Also set to inform the linker that this section should not be + listed in the link map as discarded. */ +#define SEC_KEEP 0x200000 + + /* This section contains "short" data, and should be placed + "near" the GP. */ +#define SEC_SMALL_DATA 0x400000 + + /* Attempt to merge identical entities in the section. + Entity size is given in the entsize field. */ +#define SEC_MERGE 0x800000 + + /* If given with SEC_MERGE, entities to merge are zero terminated + strings where entsize specifies character size instead of fixed + size entries. */ +#define SEC_STRINGS 0x1000000 + + /* This section contains data about section groups. */ +#define SEC_GROUP 0x2000000 + + /* The section is a COFF shared library section. This flag is + only for the linker. If this type of section appears in + the input file, the linker must copy it to the output file + without changing the vma or size. FIXME: Although this + was originally intended to be general, it really is COFF + specific (and the flag was renamed to indicate this). It + might be cleaner to have some more general mechanism to + allow the back end to control what the linker does with + sections. */ +#define SEC_COFF_SHARED_LIBRARY 0x4000000 + + /* This input section should be copied to output in reverse order + as an array of pointers. This is for ELF linker internal use + only. */ +#define SEC_ELF_REVERSE_COPY 0x4000000 + + /* This section contains data which may be shared with other + executables or shared objects. This is for COFF only. */ +#define SEC_COFF_SHARED 0x8000000 + + /* This section should be compressed. This is for ELF linker + internal use only. */ +#define SEC_ELF_COMPRESS 0x8000000 + + /* When a section with this flag is being linked, then if the size of + the input section is less than a page, it should not cross a page + boundary. If the size of the input section is one page or more, + it should be aligned on a page boundary. This is for TI + TMS320C54X only. */ +#define SEC_TIC54X_BLOCK 0x10000000 + + /* This section should be renamed. This is for ELF linker + internal use only. */ +#define SEC_ELF_RENAME 0x10000000 + + /* Conditionally link this section; do not link if there are no + references found to any symbol in the section. This is for TI + TMS320C54X only. */ +#define SEC_TIC54X_CLINK 0x20000000 + + /* This section contains vliw code. This is for Toshiba MeP only. */ +#define SEC_MEP_VLIW 0x20000000 + + /* Indicate that section has the no read flag set. This happens + when memory read flag isn't set. */ +#define SEC_COFF_NOREAD 0x40000000 + + /* Indicate that section has the purecode flag set. */ +#define SEC_ELF_PURECODE 0x80000000 + + /* End of section flags. */ + + /* Some internal packed boolean fields. */ + + /* See the vma field. */ + unsigned int user_set_vma : 1; + + /* A mark flag used by some of the linker backends. */ + unsigned int linker_mark : 1; + + /* Another mark flag used by some of the linker backends. Set for + output sections that have an input section. */ + unsigned int linker_has_input : 1; + + /* Mark flag used by some linker backends for garbage collection. */ + unsigned int gc_mark : 1; + + /* Section compression status. */ + unsigned int compress_status : 2; +#define COMPRESS_SECTION_NONE 0 +#define COMPRESS_SECTION_DONE 1 +#define DECOMPRESS_SECTION_SIZED 2 + + /* The following flags are used by the ELF linker. */ + + /* Mark sections which have been allocated to segments. */ + unsigned int segment_mark : 1; + + /* Type of sec_info information. */ + unsigned int sec_info_type:3; +#define SEC_INFO_TYPE_NONE 0 +#define SEC_INFO_TYPE_STABS 1 +#define SEC_INFO_TYPE_MERGE 2 +#define SEC_INFO_TYPE_EH_FRAME 3 +#define SEC_INFO_TYPE_JUST_SYMS 4 +#define SEC_INFO_TYPE_TARGET 5 +#define SEC_INFO_TYPE_EH_FRAME_ENTRY 6 + + /* Nonzero if this section uses RELA relocations, rather than REL. */ + unsigned int use_rela_p:1; + + /* Bits used by various backends. The generic code doesn't touch + these fields. */ + + unsigned int sec_flg0:1; + unsigned int sec_flg1:1; + unsigned int sec_flg2:1; + unsigned int sec_flg3:1; + unsigned int sec_flg4:1; + unsigned int sec_flg5:1; + + /* End of internal packed boolean fields. */ + + /* The virtual memory address of the section - where it will be + at run time. The symbols are relocated against this. The + user_set_vma flag is maintained by bfd; if it's not set, the + backend can assign addresses (for example, in @code{a.out}, where + the default address for @code{.data} is dependent on the specific + target and various flags). */ + bfd_vma vma; + + /* The load address of the section - where it would be in a + rom image; really only used for writing section header + information. */ + bfd_vma lma; + + /* The size of the section in *octets*, as it will be output. + Contains a value even if the section has no contents (e.g., the + size of @code{.bss}). */ + bfd_size_type size; + + /* For input sections, the original size on disk of the section, in + octets. This field should be set for any section whose size is + changed by linker relaxation. It is required for sections where + the linker relaxation scheme doesn't cache altered section and + reloc contents (stabs, eh_frame, SEC_MERGE, some coff relaxing + targets), and thus the original size needs to be kept to read the + section multiple times. For output sections, rawsize holds the + section size calculated on a previous linker relaxation pass. */ + bfd_size_type rawsize; + + /* The compressed size of the section in octets. */ + bfd_size_type compressed_size; + + /* Relaxation table. */ + struct relax_table *relax; + + /* Count of used relaxation table entries. */ + int relax_count; + + + /* If this section is going to be output, then this value is the + offset in *bytes* into the output section of the first byte in the + input section (byte ==> smallest addressable unit on the + target). In most cases, if this was going to start at the + 100th octet (8-bit quantity) in the output section, this value + would be 100. However, if the target byte size is 16 bits + (bfd_octets_per_byte is "2"), this value would be 50. */ + bfd_vma output_offset; + + /* The output section through which to map on output. */ + struct bfd_section *output_section; + + /* The alignment requirement of the section, as an exponent of 2 - + e.g., 3 aligns to 2^3 (or 8). */ + unsigned int alignment_power; + + /* If an input section, a pointer to a vector of relocation + records for the data in this section. */ + struct reloc_cache_entry *relocation; + + /* If an output section, a pointer to a vector of pointers to + relocation records for the data in this section. */ + struct reloc_cache_entry **orelocation; + + /* The number of relocation records in one of the above. */ + unsigned reloc_count; + + /* Information below is back end specific - and not always used + or updated. */ + + /* File position of section data. */ + file_ptr filepos; + + /* File position of relocation info. */ + file_ptr rel_filepos; + + /* File position of line data. */ + file_ptr line_filepos; + + /* Pointer to data for applications. */ + void *userdata; + + /* If the SEC_IN_MEMORY flag is set, this points to the actual + contents. */ + unsigned char *contents; + + /* Attached line number information. */ + alent *lineno; + + /* Number of line number records. */ + unsigned int lineno_count; + + /* Entity size for merging purposes. */ + unsigned int entsize; + + /* Points to the kept section if this section is a link-once section, + and is discarded. */ + struct bfd_section *kept_section; + + /* When a section is being output, this value changes as more + linenumbers are written out. */ + file_ptr moving_line_filepos; + + /* What the section number is in the target world. */ + int target_index; + + void *used_by_bfd; + + /* If this is a constructor section then here is a list of the + relocations created to relocate items within it. */ + struct relent_chain *constructor_chain; + + /* The BFD which owns the section. */ + bfd *owner; + + /* A symbol which points at this section only. */ + struct bfd_symbol *symbol; + struct bfd_symbol **symbol_ptr_ptr; + + /* Early in the link process, map_head and map_tail are used to build + a list of input sections attached to an output section. Later, + output sections use these fields for a list of bfd_link_order + structs. */ + union @{ + struct bfd_link_order *link_order; + struct bfd_section *s; + @} map_head, map_tail; +@} asection; + +/* Relax table contains information about instructions which can + be removed by relaxation -- replacing a long address with a + short address. */ +struct relax_table @{ + /* Address where bytes may be deleted. */ + bfd_vma addr; + + /* Number of bytes to be deleted. */ + int size; +@}; + +/* Note: the following are provided as inline functions rather than macros + because not all callers use the return value. A macro implementation + would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some + compilers will complain about comma expressions that have no effect. */ +static inline bfd_boolean +bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, + void * val) +@{ + ptr->userdata = val; + return TRUE; +@} + +static inline bfd_boolean +bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) +@{ + ptr->vma = ptr->lma = val; + ptr->user_set_vma = TRUE; + return TRUE; +@} + +static inline bfd_boolean +bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, + unsigned int val) +@{ + ptr->alignment_power = val; + return TRUE; +@} + +/* These sections are global, and are managed by BFD. The application + and target back end are not permitted to change the values in + these sections. */ +extern asection _bfd_std_section[4]; + +#define BFD_ABS_SECTION_NAME "*ABS*" +#define BFD_UND_SECTION_NAME "*UND*" +#define BFD_COM_SECTION_NAME "*COM*" +#define BFD_IND_SECTION_NAME "*IND*" + +/* Pointer to the common section. */ +#define bfd_com_section_ptr (&_bfd_std_section[0]) +/* Pointer to the undefined section. */ +#define bfd_und_section_ptr (&_bfd_std_section[1]) +/* Pointer to the absolute section. */ +#define bfd_abs_section_ptr (&_bfd_std_section[2]) +/* Pointer to the indirect section. */ +#define bfd_ind_section_ptr (&_bfd_std_section[3]) + +#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) +#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) +#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr) + +#define bfd_is_const_section(SEC) \ + ( ((SEC) == bfd_abs_section_ptr) \ + || ((SEC) == bfd_und_section_ptr) \ + || ((SEC) == bfd_com_section_ptr) \ + || ((SEC) == bfd_ind_section_ptr)) + +/* Macros to handle insertion and deletion of a bfd's sections. These + only handle the list pointers, ie. do not adjust section_count, + target_index etc. */ +#define bfd_section_list_remove(ABFD, S) \ + do \ + @{ \ + asection *_s = S; \ + asection *_next = _s->next; \ + asection *_prev = _s->prev; \ + if (_prev) \ + _prev->next = _next; \ + else \ + (ABFD)->sections = _next; \ + if (_next) \ + _next->prev = _prev; \ + else \ + (ABFD)->section_last = _prev; \ + @} \ + while (0) +#define bfd_section_list_append(ABFD, S) \ + do \ + @{ \ + asection *_s = S; \ + bfd *_abfd = ABFD; \ + _s->next = NULL; \ + if (_abfd->section_last) \ + @{ \ + _s->prev = _abfd->section_last; \ + _abfd->section_last->next = _s; \ + @} \ + else \ + @{ \ + _s->prev = NULL; \ + _abfd->sections = _s; \ + @} \ + _abfd->section_last = _s; \ + @} \ + while (0) +#define bfd_section_list_prepend(ABFD, S) \ + do \ + @{ \ + asection *_s = S; \ + bfd *_abfd = ABFD; \ + _s->prev = NULL; \ + if (_abfd->sections) \ + @{ \ + _s->next = _abfd->sections; \ + _abfd->sections->prev = _s; \ + @} \ + else \ + @{ \ + _s->next = NULL; \ + _abfd->section_last = _s; \ + @} \ + _abfd->sections = _s; \ + @} \ + while (0) +#define bfd_section_list_insert_after(ABFD, A, S) \ + do \ + @{ \ + asection *_a = A; \ + asection *_s = S; \ + asection *_next = _a->next; \ + _s->next = _next; \ + _s->prev = _a; \ + _a->next = _s; \ + if (_next) \ + _next->prev = _s; \ + else \ + (ABFD)->section_last = _s; \ + @} \ + while (0) +#define bfd_section_list_insert_before(ABFD, B, S) \ + do \ + @{ \ + asection *_b = B; \ + asection *_s = S; \ + asection *_prev = _b->prev; \ + _s->prev = _prev; \ + _s->next = _b; \ + _b->prev = _s; \ + if (_prev) \ + _prev->next = _s; \ + else \ + (ABFD)->sections = _s; \ + @} \ + while (0) +#define bfd_section_removed_from_list(ABFD, S) \ + ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S)) + +#define BFD_FAKE_SECTION(SEC, SYM, NAME, IDX, FLAGS) \ + /* name, id, index, next, prev, flags, user_set_vma, */ \ + @{ NAME, IDX, 0, NULL, NULL, FLAGS, 0, \ + \ + /* linker_mark, linker_has_input, gc_mark, decompress_status, */ \ + 0, 0, 1, 0, \ + \ + /* segment_mark, sec_info_type, use_rela_p, */ \ + 0, 0, 0, \ + \ + /* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5, */ \ + 0, 0, 0, 0, 0, 0, \ + \ + /* vma, lma, size, rawsize, compressed_size, relax, relax_count, */ \ + 0, 0, 0, 0, 0, 0, 0, \ + \ + /* output_offset, output_section, alignment_power, */ \ + 0, &SEC, 0, \ + \ + /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \ + NULL, NULL, 0, 0, 0, \ + \ + /* line_filepos, userdata, contents, lineno, lineno_count, */ \ + 0, NULL, NULL, NULL, 0, \ + \ + /* entsize, kept_section, moving_line_filepos, */ \ + 0, NULL, 0, \ + \ + /* target_index, used_by_bfd, constructor_chain, owner, */ \ + 0, NULL, NULL, NULL, \ + \ + /* symbol, symbol_ptr_ptr, */ \ + (struct bfd_symbol *) SYM, &SEC.symbol, \ + \ + /* map_head, map_tail */ \ + @{ NULL @}, @{ NULL @} \ + @} + +/* We use a macro to initialize the static asymbol structures because + traditional C does not permit us to initialize a union member while + gcc warns if we don't initialize it. + the_bfd, name, value, attr, section [, udata] */ +#ifdef __STDC__ +#define GLOBAL_SYM_INIT(NAME, SECTION) \ + @{ 0, NAME, 0, BSF_SECTION_SYM, SECTION, @{ 0 @}@} +#else +#define GLOBAL_SYM_INIT(NAME, SECTION) \ + @{ 0, NAME, 0, BSF_SECTION_SYM, SECTION @} +#endif + +@end example + +@node section prototypes, , typedef asection, Sections +@subsection Section prototypes +These are the functions exported by the section handling part of BFD. + +@findex bfd_section_list_clear +@subsubsection @code{bfd_section_list_clear} +@strong{Synopsis} +@example +void bfd_section_list_clear (bfd *); +@end example +@strong{Description}@* +Clears the section list, and also resets the section count and +hash table entries. + +@findex bfd_get_section_by_name +@subsubsection @code{bfd_get_section_by_name} +@strong{Synopsis} +@example +asection *bfd_get_section_by_name (bfd *abfd, const char *name); +@end example +@strong{Description}@* +Return the most recently created section attached to @var{abfd} +named @var{name}. Return NULL if no such section exists. + +@findex bfd_get_next_section_by_name +@subsubsection @code{bfd_get_next_section_by_name} +@strong{Synopsis} +@example +asection *bfd_get_next_section_by_name (bfd *ibfd, asection *sec); +@end example +@strong{Description}@* +Given @var{sec} is a section returned by @code{bfd_get_section_by_name}, +return the next most recently created section attached to the same +BFD with the same name, or if no such section exists in the same BFD and +IBFD is non-NULL, the next section with the same name in any input +BFD following IBFD. Return NULL on finding no section. + +@findex bfd_get_linker_section +@subsubsection @code{bfd_get_linker_section} +@strong{Synopsis} +@example +asection *bfd_get_linker_section (bfd *abfd, const char *name); +@end example +@strong{Description}@* +Return the linker created section attached to @var{abfd} +named @var{name}. Return NULL if no such section exists. + +@findex bfd_get_section_by_name_if +@subsubsection @code{bfd_get_section_by_name_if} +@strong{Synopsis} +@example +asection *bfd_get_section_by_name_if + (bfd *abfd, + const char *name, + bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj), + void *obj); +@end example +@strong{Description}@* +Call the provided function @var{func} for each section +attached to the BFD @var{abfd} whose name matches @var{name}, +passing @var{obj} as an argument. The function will be called +as if by + +@example + func (abfd, the_section, obj); +@end example + +It returns the first section for which @var{func} returns true, +otherwise @code{NULL}. + +@findex bfd_get_unique_section_name +@subsubsection @code{bfd_get_unique_section_name} +@strong{Synopsis} +@example +char *bfd_get_unique_section_name + (bfd *abfd, const char *templat, int *count); +@end example +@strong{Description}@* +Invent a section name that is unique in @var{abfd} by tacking +a dot and a digit suffix onto the original @var{templat}. If +@var{count} is non-NULL, then it specifies the first number +tried as a suffix to generate a unique name. The value +pointed to by @var{count} will be incremented in this case. + +@findex bfd_make_section_old_way +@subsubsection @code{bfd_make_section_old_way} +@strong{Synopsis} +@example +asection *bfd_make_section_old_way (bfd *abfd, const char *name); +@end example +@strong{Description}@* +Create a new empty section called @var{name} +and attach it to the end of the chain of sections for the +BFD @var{abfd}. An attempt to create a section with a name which +is already in use returns its pointer without changing the +section chain. + +It has the funny name since this is the way it used to be +before it was rewritten.... + +Possible errors are: +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - +If output has already started for this BFD. +@item +@code{bfd_error_no_memory} - +If memory allocation fails. +@end itemize + +@findex bfd_make_section_anyway_with_flags +@subsubsection @code{bfd_make_section_anyway_with_flags} +@strong{Synopsis} +@example +asection *bfd_make_section_anyway_with_flags + (bfd *abfd, const char *name, flagword flags); +@end example +@strong{Description}@* +Create a new empty section called @var{name} and attach it to the end of +the chain of sections for @var{abfd}. Create a new section even if there +is already a section with that name. Also set the attributes of the +new section to the value @var{flags}. + +Return @code{NULL} and set @code{bfd_error} on error; possible errors are: +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}. +@item +@code{bfd_error_no_memory} - If memory allocation fails. +@end itemize + +@findex bfd_make_section_anyway +@subsubsection @code{bfd_make_section_anyway} +@strong{Synopsis} +@example +asection *bfd_make_section_anyway (bfd *abfd, const char *name); +@end example +@strong{Description}@* +Create a new empty section called @var{name} and attach it to the end of +the chain of sections for @var{abfd}. Create a new section even if there +is already a section with that name. + +Return @code{NULL} and set @code{bfd_error} on error; possible errors are: +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}. +@item +@code{bfd_error_no_memory} - If memory allocation fails. +@end itemize + +@findex bfd_make_section_with_flags +@subsubsection @code{bfd_make_section_with_flags} +@strong{Synopsis} +@example +asection *bfd_make_section_with_flags + (bfd *, const char *name, flagword flags); +@end example +@strong{Description}@* +Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling +bfd_set_error ()) without changing the section chain if there is already a +section named @var{name}. Also set the attributes of the new section to +the value @var{flags}. If there is an error, return @code{NULL} and set +@code{bfd_error}. + +@findex bfd_make_section +@subsubsection @code{bfd_make_section} +@strong{Synopsis} +@example +asection *bfd_make_section (bfd *, const char *name); +@end example +@strong{Description}@* +Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling +bfd_set_error ()) without changing the section chain if there is already a +section named @var{name}. If there is an error, return @code{NULL} and set +@code{bfd_error}. + +@findex bfd_set_section_flags +@subsubsection @code{bfd_set_section_flags} +@strong{Synopsis} +@example +bfd_boolean bfd_set_section_flags + (bfd *abfd, asection *sec, flagword flags); +@end example +@strong{Description}@* +Set the attributes of the section @var{sec} in the BFD +@var{abfd} to the value @var{flags}. Return @code{TRUE} on success, +@code{FALSE} on error. Possible error returns are: + +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - +The section cannot have one or more of the attributes +requested. For example, a .bss section in @code{a.out} may not +have the @code{SEC_HAS_CONTENTS} field set. +@end itemize + +@findex bfd_rename_section +@subsubsection @code{bfd_rename_section} +@strong{Synopsis} +@example +void bfd_rename_section + (bfd *abfd, asection *sec, const char *newname); +@end example +@strong{Description}@* +Rename section @var{sec} in @var{abfd} to @var{newname}. + +@findex bfd_map_over_sections +@subsubsection @code{bfd_map_over_sections} +@strong{Synopsis} +@example +void bfd_map_over_sections + (bfd *abfd, + void (*func) (bfd *abfd, asection *sect, void *obj), + void *obj); +@end example +@strong{Description}@* +Call the provided function @var{func} for each section +attached to the BFD @var{abfd}, passing @var{obj} as an +argument. The function will be called as if by + +@example + func (abfd, the_section, obj); +@end example + +This is the preferred method for iterating over sections; an +alternative would be to use a loop: + +@example + asection *p; + for (p = abfd->sections; p != NULL; p = p->next) + func (abfd, p, ...) +@end example + +@findex bfd_sections_find_if +@subsubsection @code{bfd_sections_find_if} +@strong{Synopsis} +@example +asection *bfd_sections_find_if + (bfd *abfd, + bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj), + void *obj); +@end example +@strong{Description}@* +Call the provided function @var{operation} for each section +attached to the BFD @var{abfd}, passing @var{obj} as an +argument. The function will be called as if by + +@example + operation (abfd, the_section, obj); +@end example + +It returns the first section for which @var{operation} returns true. + +@findex bfd_set_section_size +@subsubsection @code{bfd_set_section_size} +@strong{Synopsis} +@example +bfd_boolean bfd_set_section_size + (bfd *abfd, asection *sec, bfd_size_type val); +@end example +@strong{Description}@* +Set @var{sec} to the size @var{val}. If the operation is +ok, then @code{TRUE} is returned, else @code{FALSE}. + +Possible error returns: +@itemize @bullet + +@item +@code{bfd_error_invalid_operation} - +Writing has started to the BFD, so setting the size is invalid. +@end itemize + +@findex bfd_set_section_contents +@subsubsection @code{bfd_set_section_contents} +@strong{Synopsis} +@example +bfd_boolean bfd_set_section_contents + (bfd *abfd, asection *section, const void *data, + file_ptr offset, bfd_size_type count); +@end example +@strong{Description}@* +Sets the contents of the section @var{section} in BFD +@var{abfd} to the data starting in memory at @var{location}. +The data is written to the output section starting at offset +@var{offset} for @var{count} octets. + +Normally @code{TRUE} is returned, but @code{FALSE} is returned if +there was an error. Possible error returns are: +@itemize @bullet + +@item +@code{bfd_error_no_contents} - +The output section does not have the @code{SEC_HAS_CONTENTS} +attribute, so nothing can be written to it. +@item +@code{bfd_error_bad_value} - +The section is unable to contain all of the data. +@item +@code{bfd_error_invalid_operation} - +The BFD is not writeable. +@item +and some more too. +@end itemize +This routine is front end to the back end function +@code{_bfd_set_section_contents}. + +@findex bfd_get_section_contents +@subsubsection @code{bfd_get_section_contents} +@strong{Synopsis} +@example +bfd_boolean bfd_get_section_contents + (bfd *abfd, asection *section, void *location, file_ptr offset, + bfd_size_type count); +@end example +@strong{Description}@* +Read data from @var{section} in BFD @var{abfd} +into memory starting at @var{location}. The data is read at an +offset of @var{offset} from the start of the input section, +and is read for @var{count} bytes. + +If the contents of a constructor with the @code{SEC_CONSTRUCTOR} +flag set are requested or if the section does not have the +@code{SEC_HAS_CONTENTS} flag set, then the @var{location} is filled +with zeroes. If no errors occur, @code{TRUE} is returned, else +@code{FALSE}. + +@findex bfd_malloc_and_get_section +@subsubsection @code{bfd_malloc_and_get_section} +@strong{Synopsis} +@example +bfd_boolean bfd_malloc_and_get_section + (bfd *abfd, asection *section, bfd_byte **buf); +@end example +@strong{Description}@* +Read all data from @var{section} in BFD @var{abfd} +into a buffer, *@var{buf}, malloc'd by this function. + +@findex bfd_copy_private_section_data +@subsubsection @code{bfd_copy_private_section_data} +@strong{Synopsis} +@example +bfd_boolean bfd_copy_private_section_data + (bfd *ibfd, asection *isec, bfd *obfd, asection *osec); +@end example +@strong{Description}@* +Copy private section information from @var{isec} in the BFD +@var{ibfd} to the section @var{osec} in the BFD @var{obfd}. +Return @code{TRUE} on success, @code{FALSE} on error. Possible error +returns are: + +@itemize @bullet + +@item +@code{bfd_error_no_memory} - +Not enough memory exists to create private data for @var{osec}. +@end itemize +@example +#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ + BFD_SEND (obfd, _bfd_copy_private_section_data, \ + (ibfd, isection, obfd, osection)) +@end example + +@findex bfd_generic_is_group_section +@subsubsection @code{bfd_generic_is_group_section} +@strong{Synopsis} +@example +bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec); +@end example +@strong{Description}@* +Returns TRUE if @var{sec} is a member of a group. + +@findex bfd_generic_discard_group +@subsubsection @code{bfd_generic_discard_group} +@strong{Synopsis} +@example +bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group); +@end example +@strong{Description}@* +Remove all members of @var{group} from the output. + diff --git a/gdb-8.3.1/bfd/doc/syms.texi b/gdb-8.3.1/bfd/doc/syms.texi new file mode 100644 index 0000000000000000000000000000000000000000..ef1f70f7d36d3dc143de868502e6e52bb70d2f8b --- /dev/null +++ b/gdb-8.3.1/bfd/doc/syms.texi @@ -0,0 +1,481 @@ +@section Symbols +BFD tries to maintain as much symbol information as it can when +it moves information from file to file. BFD passes information +to applications though the @code{asymbol} structure. When the +application requests the symbol table, BFD reads the table in +the native form and translates parts of it into the internal +format. To maintain more than the information passed to +applications, some targets keep some information ``behind the +scenes'' in a structure only the particular back end knows +about. For example, the coff back end keeps the original +symbol table structure as well as the canonical structure when +a BFD is read in. On output, the coff back end can reconstruct +the output symbol table so that no information is lost, even +information unique to coff which BFD doesn't know or +understand. If a coff symbol table were read, but were written +through an a.out back end, all the coff specific information +would be lost. The symbol table of a BFD +is not necessarily read in until a canonicalize request is +made. Then the BFD back end fills in a table provided by the +application with pointers to the canonical information. To +output symbols, the application provides BFD with a table of +pointers to pointers to @code{asymbol}s. This allows applications +like the linker to output a symbol as it was read, since the ``behind +the scenes'' information will be still available. +@menu +* Reading Symbols:: +* Writing Symbols:: +* Mini Symbols:: +* typedef asymbol:: +* symbol handling functions:: +@end menu + +@node Reading Symbols, Writing Symbols, Symbols, Symbols +@subsection Reading symbols +There are two stages to reading a symbol table from a BFD: +allocating storage, and the actual reading process. This is an +excerpt from an application which reads the symbol table: + +@example + long storage_needed; + asymbol **symbol_table; + long number_of_symbols; + long i; + + storage_needed = bfd_get_symtab_upper_bound (abfd); + + if (storage_needed < 0) + FAIL + + if (storage_needed == 0) + return; + + symbol_table = xmalloc (storage_needed); + ... + number_of_symbols = + bfd_canonicalize_symtab (abfd, symbol_table); + + if (number_of_symbols < 0) + FAIL + + for (i = 0; i < number_of_symbols; i++) + process_symbol (symbol_table[i]); +@end example + +All storage for the symbols themselves is in an objalloc +connected to the BFD; it is freed when the BFD is closed. + +@node Writing Symbols, Mini Symbols, Reading Symbols, Symbols +@subsection Writing symbols +Writing of a symbol table is automatic when a BFD open for +writing is closed. The application attaches a vector of +pointers to pointers to symbols to the BFD being written, and +fills in the symbol count. The close and cleanup code reads +through the table provided and performs all the necessary +operations. The BFD output code must always be provided with an +``owned'' symbol: one which has come from another BFD, or one +which has been created using @code{bfd_make_empty_symbol}. Here is an +example showing the creation of a symbol table with only one element: + +@example + #include "sysdep.h" + #include "bfd.h" + int main (void) + @{ + bfd *abfd; + asymbol *ptrs[2]; + asymbol *new; + + abfd = bfd_openw ("foo","a.out-sunos-big"); + bfd_set_format (abfd, bfd_object); + new = bfd_make_empty_symbol (abfd); + new->name = "dummy_symbol"; + new->section = bfd_make_section_old_way (abfd, ".text"); + new->flags = BSF_GLOBAL; + new->value = 0x12345; + + ptrs[0] = new; + ptrs[1] = 0; + + bfd_set_symtab (abfd, ptrs, 1); + bfd_close (abfd); + return 0; + @} + + ./makesym + nm foo + 00012345 A dummy_symbol +@end example + +Many formats cannot represent arbitrary symbol information; for +instance, the @code{a.out} object format does not allow an +arbitrary number of sections. A symbol pointing to a section +which is not one of @code{.text}, @code{.data} or @code{.bss} cannot +be described. + +@node Mini Symbols, typedef asymbol, Writing Symbols, Symbols +@subsection Mini Symbols +Mini symbols provide read-only access to the symbol table. +They use less memory space, but require more time to access. +They can be useful for tools like nm or objdump, which may +have to handle symbol tables of extremely large executables. + +The @code{bfd_read_minisymbols} function will read the symbols +into memory in an internal form. It will return a @code{void *} +pointer to a block of memory, a symbol count, and the size of +each symbol. The pointer is allocated using @code{malloc}, and +should be freed by the caller when it is no longer needed. + +The function @code{bfd_minisymbol_to_symbol} will take a pointer +to a minisymbol, and a pointer to a structure returned by +@code{bfd_make_empty_symbol}, and return a @code{asymbol} structure. +The return value may or may not be the same as the value from +@code{bfd_make_empty_symbol} which was passed in. + + +@node typedef asymbol, symbol handling functions, Mini Symbols, Symbols +@subsection typedef asymbol +An @code{asymbol} has the form: + + +@example + +typedef struct bfd_symbol +@{ + /* A pointer to the BFD which owns the symbol. This information + is necessary so that a back end can work out what additional + information (invisible to the application writer) is carried + with the symbol. + + This field is *almost* redundant, since you can use section->owner + instead, except that some symbols point to the global sections + bfd_@{abs,com,und@}_section. This could be fixed by making + these globals be per-bfd (or per-target-flavor). FIXME. */ + struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */ + + /* The text of the symbol. The name is left alone, and not copied; the + application may not alter it. */ + const char *name; + + /* The value of the symbol. This really should be a union of a + numeric value with a pointer, since some flags indicate that + a pointer to another symbol is stored here. */ + symvalue value; + + /* Attributes of a symbol. */ +#define BSF_NO_FLAGS 0 + + /* The symbol has local scope; @code{static} in @code{C}. The value + is the offset into the section of the data. */ +#define BSF_LOCAL (1 << 0) + + /* The symbol has global scope; initialized data in @code{C}. The + value is the offset into the section of the data. */ +#define BSF_GLOBAL (1 << 1) + + /* The symbol has global scope and is exported. The value is + the offset into the section of the data. */ +#define BSF_EXPORT BSF_GLOBAL /* No real difference. */ + + /* A normal C symbol would be one of: + @code{BSF_LOCAL}, @code{BSF_UNDEFINED} or @code{BSF_GLOBAL}. */ + + /* The symbol is a debugging record. The value has an arbitrary + meaning, unless BSF_DEBUGGING_RELOC is also set. */ +#define BSF_DEBUGGING (1 << 2) + + /* The symbol denotes a function entry point. Used in ELF, + perhaps others someday. */ +#define BSF_FUNCTION (1 << 3) + + /* Used by the linker. */ +#define BSF_KEEP (1 << 5) + + /* An ELF common symbol. */ +#define BSF_ELF_COMMON (1 << 6) + + /* A weak global symbol, overridable without warnings by + a regular global symbol of the same name. */ +#define BSF_WEAK (1 << 7) + + /* This symbol was created to point to a section, e.g. ELF's + STT_SECTION symbols. */ +#define BSF_SECTION_SYM (1 << 8) + + /* The symbol used to be a common symbol, but now it is + allocated. */ +#define BSF_OLD_COMMON (1 << 9) + + /* In some files the type of a symbol sometimes alters its + location in an output file - ie in coff a @code{ISFCN} symbol + which is also @code{C_EXT} symbol appears where it was + declared and not at the end of a section. This bit is set + by the target BFD part to convey this information. */ +#define BSF_NOT_AT_END (1 << 10) + + /* Signal that the symbol is the label of constructor section. */ +#define BSF_CONSTRUCTOR (1 << 11) + + /* Signal that the symbol is a warning symbol. The name is a + warning. The name of the next symbol is the one to warn about; + if a reference is made to a symbol with the same name as the next + symbol, a warning is issued by the linker. */ +#define BSF_WARNING (1 << 12) + + /* Signal that the symbol is indirect. This symbol is an indirect + pointer to the symbol with the same name as the next symbol. */ +#define BSF_INDIRECT (1 << 13) + + /* BSF_FILE marks symbols that contain a file name. This is used + for ELF STT_FILE symbols. */ +#define BSF_FILE (1 << 14) + + /* Symbol is from dynamic linking information. */ +#define BSF_DYNAMIC (1 << 15) + + /* The symbol denotes a data object. Used in ELF, and perhaps + others someday. */ +#define BSF_OBJECT (1 << 16) + + /* This symbol is a debugging symbol. The value is the offset + into the section of the data. BSF_DEBUGGING should be set + as well. */ +#define BSF_DEBUGGING_RELOC (1 << 17) + + /* This symbol is thread local. Used in ELF. */ +#define BSF_THREAD_LOCAL (1 << 18) + + /* This symbol represents a complex relocation expression, + with the expression tree serialized in the symbol name. */ +#define BSF_RELC (1 << 19) + + /* This symbol represents a signed complex relocation expression, + with the expression tree serialized in the symbol name. */ +#define BSF_SRELC (1 << 20) + + /* This symbol was created by bfd_get_synthetic_symtab. */ +#define BSF_SYNTHETIC (1 << 21) + + /* This symbol is an indirect code object. Unrelated to BSF_INDIRECT. + The dynamic linker will compute the value of this symbol by + calling the function that it points to. BSF_FUNCTION must + also be also set. */ +#define BSF_GNU_INDIRECT_FUNCTION (1 << 22) + /* This symbol is a globally unique data object. The dynamic linker + will make sure that in the entire process there is just one symbol + with this name and type in use. BSF_OBJECT must also be set. */ +#define BSF_GNU_UNIQUE (1 << 23) + + flagword flags; + + /* A pointer to the section to which this symbol is + relative. This will always be non NULL, there are special + sections for undefined and absolute symbols. */ + struct bfd_section *section; + + /* Back end special data. */ + union + @{ + void *p; + bfd_vma i; + @} + udata; +@} +asymbol; + +@end example + +@node symbol handling functions, , typedef asymbol, Symbols +@subsection Symbol handling functions + + +@findex bfd_get_symtab_upper_bound +@subsubsection @code{bfd_get_symtab_upper_bound} +@strong{Description}@* +Return the number of bytes required to store a vector of pointers +to @code{asymbols} for all the symbols in the BFD @var{abfd}, +including a terminal NULL pointer. If there are no symbols in +the BFD, then return 0. If an error occurs, return -1. +@example +#define bfd_get_symtab_upper_bound(abfd) \ + BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd)) + +@end example + +@findex bfd_is_local_label +@subsubsection @code{bfd_is_local_label} +@strong{Synopsis} +@example +bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym); +@end example +@strong{Description}@* +Return TRUE if the given symbol @var{sym} in the BFD @var{abfd} is +a compiler generated local label, else return FALSE. + +@findex bfd_is_local_label_name +@subsubsection @code{bfd_is_local_label_name} +@strong{Synopsis} +@example +bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name); +@end example +@strong{Description}@* +Return TRUE if a symbol with the name @var{name} in the BFD +@var{abfd} is a compiler generated local label, else return +FALSE. This just checks whether the name has the form of a +local label. +@example +#define bfd_is_local_label_name(abfd, name) \ + BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) + +@end example + +@findex bfd_is_target_special_symbol +@subsubsection @code{bfd_is_target_special_symbol} +@strong{Synopsis} +@example +bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym); +@end example +@strong{Description}@* +Return TRUE iff a symbol @var{sym} in the BFD @var{abfd} is something +special to the particular target represented by the BFD. Such symbols +should normally not be mentioned to the user. +@example +#define bfd_is_target_special_symbol(abfd, sym) \ + BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym)) + +@end example + +@findex bfd_canonicalize_symtab +@subsubsection @code{bfd_canonicalize_symtab} +@strong{Description}@* +Read the symbols from the BFD @var{abfd}, and fills in +the vector @var{location} with pointers to the symbols and +a trailing NULL. +Return the actual number of symbol pointers, not +including the NULL. +@example +#define bfd_canonicalize_symtab(abfd, location) \ + BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location)) + +@end example + +@findex bfd_set_symtab +@subsubsection @code{bfd_set_symtab} +@strong{Synopsis} +@example +bfd_boolean bfd_set_symtab + (bfd *abfd, asymbol **location, unsigned int count); +@end example +@strong{Description}@* +Arrange that when the output BFD @var{abfd} is closed, +the table @var{location} of @var{count} pointers to symbols +will be written. + +@findex bfd_print_symbol_vandf +@subsubsection @code{bfd_print_symbol_vandf} +@strong{Synopsis} +@example +void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol); +@end example +@strong{Description}@* +Print the value and flags of the @var{symbol} supplied to the +stream @var{file}. + +@findex bfd_make_empty_symbol +@subsubsection @code{bfd_make_empty_symbol} +@strong{Description}@* +Create a new @code{asymbol} structure for the BFD @var{abfd} +and return a pointer to it. + +This routine is necessary because each back end has private +information surrounding the @code{asymbol}. Building your own +@code{asymbol} and pointing to it will not create the private +information, and will cause problems later on. +@example +#define bfd_make_empty_symbol(abfd) \ + BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) + +@end example + +@findex _bfd_generic_make_empty_symbol +@subsubsection @code{_bfd_generic_make_empty_symbol} +@strong{Synopsis} +@example +asymbol *_bfd_generic_make_empty_symbol (bfd *); +@end example +@strong{Description}@* +Create a new @code{asymbol} structure for the BFD @var{abfd} +and return a pointer to it. Used by core file routines, +binary back-end and anywhere else where no private info +is needed. + +@findex bfd_make_debug_symbol +@subsubsection @code{bfd_make_debug_symbol} +@strong{Description}@* +Create a new @code{asymbol} structure for the BFD @var{abfd}, +to be used as a debugging symbol. Further details of its use have +yet to be worked out. +@example +#define bfd_make_debug_symbol(abfd,ptr,size) \ + BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) + +@end example + +@findex bfd_decode_symclass +@subsubsection @code{bfd_decode_symclass} +@strong{Description}@* +Return a character corresponding to the symbol +class of @var{symbol}, or '?' for an unknown class. + +@strong{Synopsis} +@example +int bfd_decode_symclass (asymbol *symbol); +@end example +@findex bfd_is_undefined_symclass +@subsubsection @code{bfd_is_undefined_symclass} +@strong{Description}@* +Returns non-zero if the class symbol returned by +bfd_decode_symclass represents an undefined symbol. +Returns zero otherwise. + +@strong{Synopsis} +@example +bfd_boolean bfd_is_undefined_symclass (int symclass); +@end example +@findex bfd_symbol_info +@subsubsection @code{bfd_symbol_info} +@strong{Description}@* +Fill in the basic info about symbol that nm needs. +Additional info may be added by the back-ends after +calling this function. + +@strong{Synopsis} +@example +void bfd_symbol_info (asymbol *symbol, symbol_info *ret); +@end example +@findex bfd_copy_private_symbol_data +@subsubsection @code{bfd_copy_private_symbol_data} +@strong{Synopsis} +@example +bfd_boolean bfd_copy_private_symbol_data + (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym); +@end example +@strong{Description}@* +Copy private symbol information from @var{isym} in the BFD +@var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}. +Return @code{TRUE} on success, @code{FALSE} on error. Possible error +returns are: + +@itemize @bullet + +@item +@code{bfd_error_no_memory} - +Not enough memory exists to create private data for @var{osec}. +@end itemize +@example +#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ + BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ + (ibfd, isymbol, obfd, osymbol)) + +@end example + diff --git a/gdb-8.3.1/bfd/doc/targets.texi b/gdb-8.3.1/bfd/doc/targets.texi new file mode 100644 index 0000000000000000000000000000000000000000..7d46853291d424e7b21d49a78aae55aca0e34fe8 --- /dev/null +++ b/gdb-8.3.1/bfd/doc/targets.texi @@ -0,0 +1,648 @@ +@section Targets + + +@strong{Description}@* +Each port of BFD to a different machine requires the creation +of a target back end. All the back end provides to the root +part of BFD is a structure containing pointers to functions +which perform certain low level operations on files. BFD +translates the applications's requests through a pointer into +calls to the back end routines. + +When a file is opened with @code{bfd_openr}, its format and +target are unknown. BFD uses various mechanisms to determine +how to interpret the file. The operations performed are: + +@itemize @bullet + +@item +Create a BFD by calling the internal routine +@code{_bfd_new_bfd}, then call @code{bfd_find_target} with the +target string supplied to @code{bfd_openr} and the new BFD pointer. + +@item +If a null target string was provided to @code{bfd_find_target}, +look up the environment variable @code{GNUTARGET} and use +that as the target string. + +@item +If the target string is still @code{NULL}, or the target string is +@code{default}, then use the first item in the target vector +as the target type, and set @code{target_defaulted} in the BFD to +cause @code{bfd_check_format} to loop through all the targets. +@xref{bfd_target}. @xref{Formats}. + +@item +Otherwise, inspect the elements in the target vector +one by one, until a match on target name is found. When found, +use it. + +@item +Otherwise return the error @code{bfd_error_invalid_target} to +@code{bfd_openr}. + +@item +@code{bfd_openr} attempts to open the file using +@code{bfd_open_file}, and returns the BFD. +@end itemize +Once the BFD has been opened and the target selected, the file +format may be determined. This is done by calling +@code{bfd_check_format} on the BFD with a suggested format. +If @code{target_defaulted} has been set, each possible target +type is tried to see if it recognizes the specified format. +@code{bfd_check_format} returns @code{TRUE} when the caller guesses right. +@menu +* bfd_target:: +@end menu + +@node bfd_target, , Targets, Targets + +@subsection bfd_target + + +@strong{Description}@* +This structure contains everything that BFD knows about a +target. It includes things like its byte order, name, and which +routines to call to do various operations. + +Every BFD points to a target structure with its @code{xvec} +member. + +The macros below are used to dispatch to functions through the +@code{bfd_target} vector. They are used in a number of macros further +down in @file{bfd.h}, and are also used when calling various +routines by hand inside the BFD implementation. The @var{arglist} +argument must be parenthesized; it contains all the arguments +to the called function. + +They make the documentation (more) unpleasant to read, so if +someone wants to fix this and not break the above, please do. +@example +#define BFD_SEND(bfd, message, arglist) \ + ((*((bfd)->xvec->message)) arglist) + +#ifdef DEBUG_BFD_SEND +#undef BFD_SEND +#define BFD_SEND(bfd, message, arglist) \ + (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ + ((*((bfd)->xvec->message)) arglist) : \ + (bfd_assert (__FILE__,__LINE__), NULL)) +#endif +@end example +For operations which index on the BFD format: +@example +#define BFD_SEND_FMT(bfd, message, arglist) \ + (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) + +#ifdef DEBUG_BFD_SEND +#undef BFD_SEND_FMT +#define BFD_SEND_FMT(bfd, message, arglist) \ + (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ + (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \ + (bfd_assert (__FILE__,__LINE__), NULL)) +#endif + +@end example +This is the structure which defines the type of BFD this is. The +@code{xvec} member of the struct @code{bfd} itself points here. Each +module that implements access to a different target under BFD, +defines one of these. + +FIXME, these names should be rationalised with the names of +the entry points which call them. Too bad we can't have one +macro to define them both! +@example +enum bfd_flavour +@{ + /* N.B. Update bfd_flavour_name if you change this. */ + bfd_target_unknown_flavour, + bfd_target_aout_flavour, + bfd_target_coff_flavour, + bfd_target_ecoff_flavour, + bfd_target_xcoff_flavour, + bfd_target_elf_flavour, + bfd_target_tekhex_flavour, + bfd_target_srec_flavour, + bfd_target_verilog_flavour, + bfd_target_ihex_flavour, + bfd_target_som_flavour, + bfd_target_os9k_flavour, + bfd_target_versados_flavour, + bfd_target_msdos_flavour, + bfd_target_ovax_flavour, + bfd_target_evax_flavour, + bfd_target_mmo_flavour, + bfd_target_mach_o_flavour, + bfd_target_pef_flavour, + bfd_target_pef_xlib_flavour, + bfd_target_sym_flavour +@}; + +enum bfd_endian @{ BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN @}; + +/* Forward declaration. */ +typedef struct bfd_link_info _bfd_link_info; + +/* Forward declaration. */ +typedef struct flag_info flag_info; + +typedef struct bfd_target +@{ + /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */ + char *name; + + /* The "flavour" of a back end is a general indication about + the contents of a file. */ + enum bfd_flavour flavour; + + /* The order of bytes within the data area of a file. */ + enum bfd_endian byteorder; + + /* The order of bytes within the header parts of a file. */ + enum bfd_endian header_byteorder; + + /* A mask of all the flags which an executable may have set - + from the set @code{BFD_NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}. */ + flagword object_flags; + + /* A mask of all the flags which a section may have set - from + the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}. */ + flagword section_flags; + + /* The character normally found at the front of a symbol. + (if any), perhaps `_'. */ + char symbol_leading_char; + + /* The pad character for file names within an archive header. */ + char ar_pad_char; + + /* The maximum number of characters in an archive header. */ + unsigned char ar_max_namelen; + + /* How well this target matches, used to select between various + possible targets when more than one target matches. */ + unsigned char match_priority; + + /* Entries for byte swapping for data. These are different from the + other entry points, since they don't take a BFD as the first argument. + Certain other handlers could do the same. */ + bfd_uint64_t (*bfd_getx64) (const void *); + bfd_int64_t (*bfd_getx_signed_64) (const void *); + void (*bfd_putx64) (bfd_uint64_t, void *); + bfd_vma (*bfd_getx32) (const void *); + bfd_signed_vma (*bfd_getx_signed_32) (const void *); + void (*bfd_putx32) (bfd_vma, void *); + bfd_vma (*bfd_getx16) (const void *); + bfd_signed_vma (*bfd_getx_signed_16) (const void *); + void (*bfd_putx16) (bfd_vma, void *); + + /* Byte swapping for the headers. */ + bfd_uint64_t (*bfd_h_getx64) (const void *); + bfd_int64_t (*bfd_h_getx_signed_64) (const void *); + void (*bfd_h_putx64) (bfd_uint64_t, void *); + bfd_vma (*bfd_h_getx32) (const void *); + bfd_signed_vma (*bfd_h_getx_signed_32) (const void *); + void (*bfd_h_putx32) (bfd_vma, void *); + bfd_vma (*bfd_h_getx16) (const void *); + bfd_signed_vma (*bfd_h_getx_signed_16) (const void *); + void (*bfd_h_putx16) (bfd_vma, void *); + + /* Format dependent routines: these are vectors of entry points + within the target vector structure, one for each format to check. */ + + /* Check the format of a file being read. Return a @code{bfd_target *} or zero. */ + const struct bfd_target * + (*_bfd_check_format[bfd_type_end]) (bfd *); + + /* Set the format of a file being written. */ + bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *); + + /* Write cached information into a file being written, at @code{bfd_close}. */ + bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *); + +@end example +The general target vector. These vectors are initialized using the +BFD_JUMP_TABLE macros. +@example + + /* Generic entry points. */ +#define BFD_JUMP_TABLE_GENERIC(NAME) \ + NAME##_close_and_cleanup, \ + NAME##_bfd_free_cached_info, \ + NAME##_new_section_hook, \ + NAME##_get_section_contents, \ + NAME##_get_section_contents_in_window + + /* Called when the BFD is being closed to do any necessary cleanup. */ + bfd_boolean (*_close_and_cleanup) (bfd *); + /* Ask the BFD to free all cached information. */ + bfd_boolean (*_bfd_free_cached_info) (bfd *); + /* Called when a new section is created. */ + bfd_boolean (*_new_section_hook) (bfd *, sec_ptr); + /* Read the contents of a section. */ + bfd_boolean (*_bfd_get_section_contents) (bfd *, sec_ptr, void *, file_ptr, + bfd_size_type); + bfd_boolean (*_bfd_get_section_contents_in_window) (bfd *, sec_ptr, + bfd_window *, file_ptr, + bfd_size_type); + + /* Entry points to copy private data. */ +#define BFD_JUMP_TABLE_COPY(NAME) \ + NAME##_bfd_copy_private_bfd_data, \ + NAME##_bfd_merge_private_bfd_data, \ + _bfd_generic_init_private_section_data, \ + NAME##_bfd_copy_private_section_data, \ + NAME##_bfd_copy_private_symbol_data, \ + NAME##_bfd_copy_private_header_data, \ + NAME##_bfd_set_private_flags, \ + NAME##_bfd_print_private_bfd_data + + /* Called to copy BFD general private data from one object file + to another. */ + bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *); + /* Called to merge BFD general private data from one object file + to a common output file when linking. */ + bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, struct bfd_link_info *); + /* Called to initialize BFD private section data from one object file + to another. */ +#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \ + BFD_SEND (obfd, _bfd_init_private_section_data, \ + (ibfd, isec, obfd, osec, link_info)) + bfd_boolean (*_bfd_init_private_section_data) (bfd *, sec_ptr, bfd *, + sec_ptr, + struct bfd_link_info *); + /* Called to copy BFD private section data from one object file + to another. */ + bfd_boolean (*_bfd_copy_private_section_data) (bfd *, sec_ptr, bfd *, + sec_ptr); + /* Called to copy BFD private symbol data from one symbol + to another. */ + bfd_boolean (*_bfd_copy_private_symbol_data) (bfd *, asymbol *, bfd *, + asymbol *); + /* Called to copy BFD private header data from one object file + to another. */ + bfd_boolean (*_bfd_copy_private_header_data) (bfd *, bfd *); + /* Called to set private backend flags. */ + bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); + + /* Called to print private BFD data. */ + bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *); + + /* Core file entry points. */ +#define BFD_JUMP_TABLE_CORE(NAME) \ + NAME##_core_file_failing_command, \ + NAME##_core_file_failing_signal, \ + NAME##_core_file_matches_executable_p, \ + NAME##_core_file_pid + + char * (*_core_file_failing_command) (bfd *); + int (*_core_file_failing_signal) (bfd *); + bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *); + int (*_core_file_pid) (bfd *); + + /* Archive entry points. */ +#define BFD_JUMP_TABLE_ARCHIVE(NAME) \ + NAME##_slurp_armap, \ + NAME##_slurp_extended_name_table, \ + NAME##_construct_extended_name_table, \ + NAME##_truncate_arname, \ + NAME##_write_armap, \ + NAME##_read_ar_hdr, \ + NAME##_write_ar_hdr, \ + NAME##_openr_next_archived_file, \ + NAME##_get_elt_at_index, \ + NAME##_generic_stat_arch_elt, \ + NAME##_update_armap_timestamp + + bfd_boolean (*_bfd_slurp_armap) (bfd *); + bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *); + bfd_boolean (*_bfd_construct_extended_name_table) (bfd *, char **, + bfd_size_type *, + const char **); + void (*_bfd_truncate_arname) (bfd *, const char *, char *); + bfd_boolean (*write_armap) (bfd *, unsigned int, struct orl *, + unsigned int, int); + void * (*_bfd_read_ar_hdr_fn) (bfd *); + bfd_boolean (*_bfd_write_ar_hdr_fn) (bfd *, bfd *); + bfd * (*openr_next_archived_file) (bfd *, bfd *); +#define bfd_get_elt_at_index(b,i) \ + BFD_SEND (b, _bfd_get_elt_at_index, (b,i)) + bfd * (*_bfd_get_elt_at_index) (bfd *, symindex); + int (*_bfd_stat_arch_elt) (bfd *, struct stat *); + bfd_boolean (*_bfd_update_armap_timestamp) (bfd *); + + /* Entry points used for symbols. */ +#define BFD_JUMP_TABLE_SYMBOLS(NAME) \ + NAME##_get_symtab_upper_bound, \ + NAME##_canonicalize_symtab, \ + NAME##_make_empty_symbol, \ + NAME##_print_symbol, \ + NAME##_get_symbol_info, \ + NAME##_get_symbol_version_string, \ + NAME##_bfd_is_local_label_name, \ + NAME##_bfd_is_target_special_symbol, \ + NAME##_get_lineno, \ + NAME##_find_nearest_line, \ + NAME##_find_line, \ + NAME##_find_inliner_info, \ + NAME##_bfd_make_debug_symbol, \ + NAME##_read_minisymbols, \ + NAME##_minisymbol_to_symbol + + long (*_bfd_get_symtab_upper_bound) (bfd *); + long (*_bfd_canonicalize_symtab) (bfd *, struct bfd_symbol **); + struct bfd_symbol * + (*_bfd_make_empty_symbol) (bfd *); + void (*_bfd_print_symbol) (bfd *, void *, struct bfd_symbol *, + bfd_print_symbol_type); +#define bfd_print_symbol(b,p,s,e) \ + BFD_SEND (b, _bfd_print_symbol, (b,p,s,e)) + void (*_bfd_get_symbol_info) (bfd *, struct bfd_symbol *, + symbol_info *); +#define bfd_get_symbol_info(b,p,e) \ + BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) + const char *(*_bfd_get_symbol_version_string) (bfd *, struct bfd_symbol *, + bfd_boolean *); +#define bfd_get_symbol_version_string(b,s,h) \ + BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,h)) + bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); + bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); + alent * (*_get_lineno) (bfd *, struct bfd_symbol *); + bfd_boolean (*_bfd_find_nearest_line) (bfd *, struct bfd_symbol **, + struct bfd_section *, bfd_vma, + const char **, const char **, + unsigned int *, unsigned int *); + bfd_boolean (*_bfd_find_line) (bfd *, struct bfd_symbol **, + struct bfd_symbol *, const char **, + unsigned int *); + bfd_boolean (*_bfd_find_inliner_info) + (bfd *, const char **, const char **, unsigned int *); + /* Back-door to allow format-aware applications to create debug symbols + while using BFD for everything else. Currently used by the assembler + when creating COFF files. */ + asymbol * (*_bfd_make_debug_symbol) (bfd *, void *, unsigned long size); +#define bfd_read_minisymbols(b, d, m, s) \ + BFD_SEND (b, _read_minisymbols, (b, d, m, s)) + long (*_read_minisymbols) (bfd *, bfd_boolean, void **, + unsigned int *); +#define bfd_minisymbol_to_symbol(b, d, m, f) \ + BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) + asymbol * (*_minisymbol_to_symbol) (bfd *, bfd_boolean, const void *, + asymbol *); + + /* Routines for relocs. */ +#define BFD_JUMP_TABLE_RELOCS(NAME) \ + NAME##_get_reloc_upper_bound, \ + NAME##_canonicalize_reloc, \ + NAME##_set_reloc, \ + NAME##_bfd_reloc_type_lookup, \ + NAME##_bfd_reloc_name_lookup + + long (*_get_reloc_upper_bound) (bfd *, sec_ptr); + long (*_bfd_canonicalize_reloc) (bfd *, sec_ptr, arelent **, + struct bfd_symbol **); + void (*_bfd_set_reloc) (bfd *, sec_ptr, arelent **, unsigned int); + /* See documentation on reloc types. */ + reloc_howto_type * + (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); + reloc_howto_type * + (*reloc_name_lookup) (bfd *, const char *); + + /* Routines used when writing an object file. */ +#define BFD_JUMP_TABLE_WRITE(NAME) \ + NAME##_set_arch_mach, \ + NAME##_set_section_contents + + bfd_boolean (*_bfd_set_arch_mach) (bfd *, enum bfd_architecture, + unsigned long); + bfd_boolean (*_bfd_set_section_contents) (bfd *, sec_ptr, const void *, + file_ptr, bfd_size_type); + + /* Routines used by the linker. */ +#define BFD_JUMP_TABLE_LINK(NAME) \ + NAME##_sizeof_headers, \ + NAME##_bfd_get_relocated_section_contents, \ + NAME##_bfd_relax_section, \ + NAME##_bfd_link_hash_table_create, \ + NAME##_bfd_link_add_symbols, \ + NAME##_bfd_link_just_syms, \ + NAME##_bfd_copy_link_hash_symbol_type, \ + NAME##_bfd_final_link, \ + NAME##_bfd_link_split_section, \ + NAME##_bfd_link_check_relocs, \ + NAME##_bfd_gc_sections, \ + NAME##_bfd_lookup_section_flags, \ + NAME##_bfd_merge_sections, \ + NAME##_bfd_is_group_section, \ + NAME##_bfd_discard_group, \ + NAME##_section_already_linked, \ + NAME##_bfd_define_common_symbol, \ + NAME##_bfd_link_hide_symbol, \ + NAME##_bfd_define_start_stop + + int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *); + bfd_byte * (*_bfd_get_relocated_section_contents) (bfd *, + struct bfd_link_info *, + struct bfd_link_order *, + bfd_byte *, bfd_boolean, + struct bfd_symbol **); + + bfd_boolean (*_bfd_relax_section) (bfd *, struct bfd_section *, + struct bfd_link_info *, bfd_boolean *); + + /* Create a hash table for the linker. Different backends store + different information in this table. */ + struct bfd_link_hash_table * + (*_bfd_link_hash_table_create) (bfd *); + + /* Add symbols from this object file into the hash table. */ + bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); + + /* Indicate that we are only retrieving symbol values from this section. */ + void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *); + + /* Copy the symbol type and other attributes for a linker script + assignment of one symbol to another. */ +#define bfd_copy_link_hash_symbol_type(b, t, f) \ + BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f)) + void (*_bfd_copy_link_hash_symbol_type) (bfd *, + struct bfd_link_hash_entry *, + struct bfd_link_hash_entry *); + + /* Do a link based on the link_order structures attached to each + section of the BFD. */ + bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *); + + /* Should this section be split up into smaller pieces during linking. */ + bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *); + + /* Check the relocations in the bfd for validity. */ + bfd_boolean (* _bfd_link_check_relocs)(bfd *, struct bfd_link_info *); + + /* Remove sections that are not referenced from the output. */ + bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); + + /* Sets the bitmask of allowed and disallowed section flags. */ + bfd_boolean (*_bfd_lookup_section_flags) (struct bfd_link_info *, + struct flag_info *, asection *); + + /* Attempt to merge SEC_MERGE sections. */ + bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); + + /* Is this section a member of a group? */ + bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *); + + /* Discard members of a group. */ + bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); + + /* Check if SEC has been already linked during a reloceatable or + final link. */ + bfd_boolean (*_section_already_linked) (bfd *, asection *, + struct bfd_link_info *); + + /* Define a common symbol. */ + bfd_boolean (*_bfd_define_common_symbol) (bfd *, struct bfd_link_info *, + struct bfd_link_hash_entry *); + + /* Hide a symbol. */ + void (*_bfd_link_hide_symbol) (bfd *, struct bfd_link_info *, + struct bfd_link_hash_entry *); + + /* Define a __start, __stop, .startof. or .sizeof. symbol. */ + struct bfd_link_hash_entry * + (*_bfd_define_start_stop) (struct bfd_link_info *, const char *, + asection *); + + /* Routines to handle dynamic symbols and relocs. */ +#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ + NAME##_get_dynamic_symtab_upper_bound, \ + NAME##_canonicalize_dynamic_symtab, \ + NAME##_get_synthetic_symtab, \ + NAME##_get_dynamic_reloc_upper_bound, \ + NAME##_canonicalize_dynamic_reloc + + /* Get the amount of memory required to hold the dynamic symbols. */ + long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *); + /* Read in the dynamic symbols. */ + long (*_bfd_canonicalize_dynamic_symtab) (bfd *, struct bfd_symbol **); + /* Create synthetized symbols. */ + long (*_bfd_get_synthetic_symtab) (bfd *, long, struct bfd_symbol **, + long, struct bfd_symbol **, + struct bfd_symbol **); + /* Get the amount of memory required to hold the dynamic relocs. */ + long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); + /* Read in the dynamic relocs. */ + long (*_bfd_canonicalize_dynamic_reloc) (bfd *, arelent **, + struct bfd_symbol **); + +@end example +A pointer to an alternative bfd_target in case the current one is not +satisfactory. This can happen when the target cpu supports both big +and little endian code, and target chosen by the linker has the wrong +endianness. The function open_output() in ld/ldlang.c uses this field +to find an alternative output format that is suitable. +@example + /* Opposite endian version of this target. */ + const struct bfd_target *alternative_target; + + /* Data for use by back-end routines, which isn't + generic enough to belong in this structure. */ + const void *backend_data; + +@} bfd_target; + +@end example + +@findex bfd_set_default_target +@subsubsection @code{bfd_set_default_target} +@strong{Synopsis} +@example +bfd_boolean bfd_set_default_target (const char *name); +@end example +@strong{Description}@* +Set the default target vector to use when recognizing a BFD. +This takes the name of the target, which may be a BFD target +name or a configuration triplet. + +@findex bfd_find_target +@subsubsection @code{bfd_find_target} +@strong{Synopsis} +@example +const bfd_target *bfd_find_target (const char *target_name, bfd *abfd); +@end example +@strong{Description}@* +Return a pointer to the transfer vector for the object target +named @var{target_name}. If @var{target_name} is @code{NULL}, +choose the one in the environment variable @code{GNUTARGET}; if +that is null or not defined, then choose the first entry in the +target list. Passing in the string "default" or setting the +environment variable to "default" will cause the first entry in +the target list to be returned, and "target_defaulted" will be +set in the BFD if @var{abfd} isn't @code{NULL}. This causes +@code{bfd_check_format} to loop over all the targets to find the +one that matches the file being read. + +@findex bfd_get_target_info +@subsubsection @code{bfd_get_target_info} +@strong{Synopsis} +@example +const bfd_target *bfd_get_target_info (const char *target_name, + bfd *abfd, + bfd_boolean *is_bigendian, + int *underscoring, + const char **def_target_arch); +@end example +@strong{Description}@* +Return a pointer to the transfer vector for the object target +named @var{target_name}. If @var{target_name} is @code{NULL}, +choose the one in the environment variable @code{GNUTARGET}; if +that is null or not defined, then choose the first entry in the +target list. Passing in the string "default" or setting the +environment variable to "default" will cause the first entry in +the target list to be returned, and "target_defaulted" will be +set in the BFD if @var{abfd} isn't @code{NULL}. This causes +@code{bfd_check_format} to loop over all the targets to find the +one that matches the file being read. +If @var{is_bigendian} is not @code{NULL}, then set this value to target's +endian mode. True for big-endian, FALSE for little-endian or for +invalid target. +If @var{underscoring} is not @code{NULL}, then set this value to target's +underscoring mode. Zero for none-underscoring, -1 for invalid target, +else the value of target vector's symbol underscoring. +If @var{def_target_arch} is not @code{NULL}, then set it to the architecture +string specified by the target_name. + +@findex bfd_target_list +@subsubsection @code{bfd_target_list} +@strong{Synopsis} +@example +const char ** bfd_target_list (void); +@end example +@strong{Description}@* +Return a freshly malloced NULL-terminated +vector of the names of all the valid BFD targets. Do not +modify the names. + +@findex bfd_iterate_over_targets +@subsubsection @code{bfd_iterate_over_targets} +@strong{Synopsis} +@example +const bfd_target *bfd_iterate_over_targets + (int (*func) (const bfd_target *, void *), + void *data); +@end example +@strong{Description}@* +Call @var{func} for each target in the list of BFD target +vectors, passing @var{data} to @var{func}. Stop iterating if +@var{func} returns a non-zero result, and return that target +vector. Return NULL if @var{func} always returns zero. + +@findex bfd_flavour_name +@subsubsection @code{bfd_flavour_name} +@strong{Synopsis} +@example +const char *bfd_flavour_name (enum bfd_flavour flavour); +@end example +@strong{Description}@* +Return the string form of @var{flavour}. + diff --git a/gdb-8.3.1/gdb/ada-exp.c b/gdb-8.3.1/gdb/ada-exp.c new file mode 100644 index 0000000000000000000000000000000000000000..fde27c0be47bfb83afe9d0e7a9ebdfc072440044 --- /dev/null +++ b/gdb-8.3.1/gdb/ada-exp.c @@ -0,0 +1,3437 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* Copy the first part of user declarations. */ +#line 36 "ada-exp.y" /* yacc.c:339 */ + + +#include "defs.h" +#include +#include "expression.h" +#include "value.h" +#include "parser-defs.h" +#include "language.h" +#include "ada-lang.h" +#include "bfd.h" /* Required by objfiles.h. */ +#include "symfile.h" /* Required by objfiles.h. */ +#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ +#include "frame.h" +#include "block.h" + +#define parse_type(ps) builtin_type (parse_gdbarch (ps)) + +/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, + etc). */ +#define GDB_YY_REMAP_PREFIX ada_ +#include "yy-remap.h" + +struct name_info { + struct symbol *sym; + struct minimal_symbol *msym; + const struct block *block; + struct stoken stoken; +}; + +/* The state of the parser, used internally when we are parsing the + expression. */ + +static struct parser_state *pstate = NULL; + +static struct stoken empty_stoken = { "", 0 }; + +/* If expression is in the context of TYPE'(...), then TYPE, else + * NULL. */ +static struct type *type_qualifier; + +int yyparse (void); + +static int yylex (void); + +static void yyerror (const char *); + +static void write_int (struct parser_state *, LONGEST, struct type *); + +static void write_object_renaming (struct parser_state *, + const struct block *, const char *, int, + const char *, int); + +static struct type* write_var_or_type (struct parser_state *, + const struct block *, struct stoken); + +static void write_name_assoc (struct parser_state *, struct stoken); + +static void write_exp_op_with_string (struct parser_state *, enum exp_opcode, + struct stoken); + +static const struct block *block_lookup (const struct block *, const char *); + +static LONGEST convert_char_literal (struct type *, LONGEST); + +static void write_ambiguous_var (struct parser_state *, + const struct block *, char *, int); + +static struct type *type_int (struct parser_state *); + +static struct type *type_long (struct parser_state *); + +static struct type *type_long_long (struct parser_state *); + +static struct type *type_long_double (struct parser_state *); + +static struct type *type_char (struct parser_state *); + +static struct type *type_boolean (struct parser_state *); + +static struct type *type_system_address (struct parser_state *); + + +#line 149 "ada-exp.c.tmp" /* yacc.c:339 */ + +# ifndef YY_NULLPTRPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTRPTR nullptr +# else +# define YY_NULLPTRPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + INT = 258, + NULL_PTR = 259, + CHARLIT = 260, + FLOAT = 261, + TRUEKEYWORD = 262, + FALSEKEYWORD = 263, + COLONCOLON = 264, + STRING = 265, + NAME = 266, + DOT_ID = 267, + DOT_ALL = 268, + DOLLAR_VARIABLE = 269, + ASSIGN = 270, + _AND_ = 271, + OR = 272, + XOR = 273, + THEN = 274, + ELSE = 275, + NOTEQUAL = 276, + LEQ = 277, + GEQ = 278, + IN = 279, + DOTDOT = 280, + UNARY = 281, + MOD = 282, + REM = 283, + STARSTAR = 284, + ABS = 285, + NOT = 286, + VAR = 287, + ARROW = 288, + TICK_ACCESS = 289, + TICK_ADDRESS = 290, + TICK_FIRST = 291, + TICK_LAST = 292, + TICK_LENGTH = 293, + TICK_MAX = 294, + TICK_MIN = 295, + TICK_MODULUS = 296, + TICK_POS = 297, + TICK_RANGE = 298, + TICK_SIZE = 299, + TICK_TAG = 300, + TICK_VAL = 301, + NEW = 302, + OTHERS = 303 + }; +#endif +/* Tokens. */ +#define INT 258 +#define NULL_PTR 259 +#define CHARLIT 260 +#define FLOAT 261 +#define TRUEKEYWORD 262 +#define FALSEKEYWORD 263 +#define COLONCOLON 264 +#define STRING 265 +#define NAME 266 +#define DOT_ID 267 +#define DOT_ALL 268 +#define DOLLAR_VARIABLE 269 +#define ASSIGN 270 +#define _AND_ 271 +#define OR 272 +#define XOR 273 +#define THEN 274 +#define ELSE 275 +#define NOTEQUAL 276 +#define LEQ 277 +#define GEQ 278 +#define IN 279 +#define DOTDOT 280 +#define UNARY 281 +#define MOD 282 +#define REM 283 +#define STARSTAR 284 +#define ABS 285 +#define NOT 286 +#define VAR 287 +#define ARROW 288 +#define TICK_ACCESS 289 +#define TICK_ADDRESS 290 +#define TICK_FIRST 291 +#define TICK_LAST 292 +#define TICK_LENGTH 293 +#define TICK_MAX 294 +#define TICK_MIN 295 +#define TICK_MODULUS 296 +#define TICK_POS 297 +#define TICK_RANGE 298 +#define TICK_SIZE 299 +#define TICK_TAG 300 +#define TICK_VAL 301 +#define NEW 302 +#define OTHERS 303 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE +{ +#line 120 "ada-exp.y" /* yacc.c:355 */ + + LONGEST lval; + struct { + LONGEST val; + struct type *type; + } typed_val; + struct { + gdb_byte val[16]; + struct type *type; + } typed_val_float; + struct type *tval; + struct stoken sval; + const struct block *bval; + struct internalvar *ivar; + + +#line 299 "ada-exp.c.tmp" /* yacc.c:355 */ +}; + +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE yylval; + +int yyparse (void); + + + +/* Copy the second part of user declarations. */ + +#line 316 "ada-exp.c.tmp" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or xmalloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined xmalloc) \ + && (defined YYFREE || defined xfree))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC xmalloc +# if ! defined xmalloc && ! defined EXIT_SUCCESS +void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE xfree +# if ! defined xfree && ! defined EXIT_SUCCESS +void xfree (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 57 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 746 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 69 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 31 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 122 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 233 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 303 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 32, 64, + 58, 63, 34, 30, 65, 31, 57, 35, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 62, + 23, 21, 24, 2, 29, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 59, 2, 68, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 66, 43, 67, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 22, 25, 26, 27, + 28, 33, 36, 37, 38, 39, 40, 41, 42, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 60, 61 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 185, 185, 189, 190, 192, 197, 201, 206, 212, + 231, 231, 243, 247, 249, 257, 268, 278, 282, 285, + 288, 292, 296, 300, 304, 307, 309, 311, 313, 317, + 330, 334, 338, 342, 346, 350, 354, 358, 362, 366, + 369, 373, 377, 381, 383, 388, 396, 400, 406, 417, + 421, 425, 429, 430, 431, 432, 433, 434, 438, 440, + 445, 447, 452, 454, 459, 461, 465, 467, 479, 481, + 488, 491, 494, 497, 499, 501, 503, 505, 507, 509, + 513, 515, 520, 530, 532, 539, 543, 551, 559, 563, + 569, 571, 575, 579, 581, 583, 591, 602, 604, 609, + 618, 619, 625, 630, 636, 645, 646, 647, 651, 656, + 671, 670, 673, 676, 675, 682, 681, 684, 687, 686, + 694, 696, 698 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "INT", "NULL_PTR", "CHARLIT", "FLOAT", + "TRUEKEYWORD", "FALSEKEYWORD", "COLONCOLON", "STRING", "NAME", "DOT_ID", + "DOT_ALL", "DOLLAR_VARIABLE", "ASSIGN", "_AND_", "OR", "XOR", "THEN", + "ELSE", "'='", "NOTEQUAL", "'<'", "'>'", "LEQ", "GEQ", "IN", "DOTDOT", + "'@'", "'+'", "'-'", "'&'", "UNARY", "'*'", "'/'", "MOD", "REM", + "STARSTAR", "ABS", "NOT", "VAR", "ARROW", "'|'", "TICK_ACCESS", + "TICK_ADDRESS", "TICK_FIRST", "TICK_LAST", "TICK_LENGTH", "TICK_MAX", + "TICK_MIN", "TICK_MODULUS", "TICK_POS", "TICK_RANGE", "TICK_SIZE", + "TICK_TAG", "TICK_VAL", "'.'", "'('", "'['", "NEW", "OTHERS", "';'", + "')'", "'\\''", "','", "'{'", "'}'", "']'", "$accept", "start", "exp1", + "primary", "$@1", "save_qualifier", "simple_exp", "arglist", "relation", + "exp", "and_exp", "and_then_exp", "or_exp", "or_else_exp", "xor_exp", + "tick_arglist", "type_prefix", "opt_type_prefix", "var_or_type", "block", + "aggregate", "aggregate_component_list", "positional_list", + "component_groups", "others", "component_group", + "component_associations", "$@2", "$@3", "$@4", "$@5", YY_NULLPTRPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 61, 276, 60, 62, 277, 278, 279, 280, 64, + 43, 45, 38, 281, 42, 47, 282, 283, 284, 285, + 286, 287, 288, 124, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 46, 40, 91, + 302, 303, 59, 41, 39, 44, 123, 125, 93 +}; +# endif + +#define YYPACT_NINF -104 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-104))) + +#define YYTABLE_NINF -83 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 430, -104, -104, -104, -104, -104, -104, -104, 3, -104, + 430, 430, 544, 544, 430, 430, 289, 44, 49, 26, + -53, -2, 679, 86, -104, 50, 55, 48, 57, 74, + -28, -1, 275, 61, -104, -104, -104, 577, 219, 219, + 9, 9, 219, 219, 54, 58, -31, 616, 42, 45, + 289, -104, -104, 46, -104, -104, 43, -104, 430, -104, + -104, 430, -104, -104, 59, 59, 59, -104, -104, 277, + 430, 430, 430, 430, 430, 430, 430, 430, 430, 430, + 430, 430, 430, 430, 430, 430, 430, 89, 353, 392, + 430, 430, 94, 430, 100, 430, -104, 63, 64, 65, + 67, 277, -104, 15, -104, -104, 430, -104, 430, 430, + 468, -104, -104, 62, -104, 289, 544, -104, -104, 125, + -104, -104, -104, -4, 639, -57, -104, 70, 117, 117, + 117, 117, 117, 117, 149, 563, 174, 549, 219, 219, + 219, 91, 91, 91, 91, 91, 430, 430, -104, 430, + -104, -104, -104, 430, -104, 430, -104, 430, 430, 430, + 430, 659, -38, -104, -104, -104, 430, 468, -104, 339, + -104, 692, -104, -104, -104, 9, 69, 430, 430, -104, + 506, -104, 59, 430, 561, 708, 211, -104, -104, -104, + -104, 81, 99, 102, 93, 430, -104, 72, -104, -104, + -104, -104, -104, -104, 105, 82, -104, -104, 117, 59, + 430, -104, 430, 430, -104, 214, 430, 430, 468, -104, + 430, -104, 117, 106, 107, -104, 109, -104, -104, -104, + -104, -104, -104 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 84, 85, 88, 86, 87, 90, 91, 89, 93, 17, + 84, 84, 84, 84, 84, 84, 84, 0, 0, 0, + 2, 19, 39, 52, 3, 53, 54, 55, 56, 57, + 83, 0, 16, 0, 18, 97, 95, 19, 21, 20, + 121, 120, 23, 22, 93, 0, 0, 39, 3, 0, + 84, 100, 105, 106, 109, 92, 0, 1, 84, 7, + 6, 84, 68, 69, 80, 80, 80, 73, 74, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 0, 84, 84, + 84, 84, 0, 84, 0, 84, 79, 0, 0, 0, + 0, 84, 12, 94, 110, 115, 84, 15, 84, 84, + 84, 103, 99, 101, 102, 84, 84, 4, 5, 0, + 70, 71, 72, 93, 39, 0, 25, 0, 40, 41, + 50, 51, 42, 49, 19, 0, 16, 35, 36, 38, + 37, 31, 32, 34, 33, 30, 84, 84, 58, 84, + 62, 66, 59, 84, 63, 84, 67, 84, 84, 84, + 84, 39, 0, 10, 98, 96, 84, 84, 108, 0, + 112, 0, 117, 104, 107, 29, 0, 84, 84, 8, + 84, 122, 80, 84, 19, 0, 16, 60, 64, 61, + 65, 0, 0, 0, 0, 84, 9, 0, 111, 116, + 113, 118, 81, 26, 0, 93, 27, 44, 43, 80, + 84, 78, 84, 84, 77, 0, 84, 84, 84, 13, + 84, 47, 46, 0, 0, 14, 0, 114, 119, 28, + 76, 75, 11 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -104, -104, 157, 17, -104, -104, 4, 75, -54, 0, + -104, -104, -104, -104, -104, -64, -104, -104, -15, -104, + -104, -104, -104, -46, -104, -104, -103, -104, -104, -104, + -104 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 19, 20, 37, 197, 163, 22, 125, 23, 126, + 25, 26, 27, 28, 29, 120, 30, 31, 32, 33, + 34, 49, 50, 51, 52, 53, 54, 166, 217, 167, + 218 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int16 yytable[] = +{ + 24, 121, 122, 56, 114, 35, 179, 172, 180, 58, + 59, 60, 35, 61, 38, 39, 48, 21, 42, 43, + 47, 59, 60, 96, 164, 196, 57, 180, 97, 40, + 41, 58, 107, 21, 148, 150, 151, 152, 177, 154, + 36, 156, 62, 63, 64, 65, 66, 36, 98, 99, + 113, 100, 67, 68, 47, 55, 69, 70, 117, 165, + 8, 118, 136, 35, 199, 93, 91, 69, 70, 174, + 127, 92, 103, 124, 94, 128, 129, 130, 131, 132, + 133, 135, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 35, 95, 187, 134, 188, 104, 105, 36, 189, + 106, 190, 88, 89, 90, 161, 168, 111, 112, 170, + 116, 115, 169, 153, 171, 228, 146, 119, 207, 171, + 155, 157, 158, 159, 220, 160, 36, 173, 176, 86, + 216, 186, 202, 175, 78, 79, 80, 81, 181, 82, + 83, 84, 85, 86, 211, 221, 78, 79, 80, 81, + 185, 82, 83, 84, 85, 86, 214, 191, 192, 193, + 194, 59, 60, 184, 212, 0, 198, 213, 219, 230, + 231, 171, 232, 46, -45, 0, 162, 203, 0, 0, + 206, 0, 204, 0, 0, 0, 0, 208, 0, 0, + -45, -45, -45, 62, 63, 64, 65, 66, 0, 215, + 0, 0, 182, 67, 68, 0, 0, 69, 70, 0, + 0, -48, 223, 224, 222, 0, 226, 227, 0, 0, + 229, 0, 171, -82, -82, -82, -82, -48, -48, -48, + -82, 0, 101, 0, 0, 0, -45, -45, 102, -45, + 0, 0, -45, 78, 79, 80, 81, 0, 82, 83, + 84, 85, 86, 82, 83, 84, 85, 86, 0, 0, + -82, -82, -82, -82, 0, 0, 0, -82, 0, 101, + 0, 0, 0, -48, -48, 102, -48, 225, 0, -48, + 1, 2, 3, 4, 5, 6, 0, 7, 123, 0, + 0, 9, 1, 2, 3, 4, 5, 6, 0, 7, + 44, 0, 0, 9, 0, 0, 0, 10, 11, 12, + 0, 13, 0, 0, 0, 0, 14, 15, 0, 10, + 11, 12, 0, 13, -82, -82, -82, -82, 14, 15, + 0, -82, 0, 101, 0, 16, 0, 17, 0, 102, + -24, 0, -24, 18, 0, 0, 0, 16, 0, 17, + 45, 0, 0, 0, 0, 18, 1, 2, 3, 4, + 5, 6, 0, 7, 8, 0, 0, 9, 78, 79, + 80, 81, 147, 82, 83, 84, 85, 86, 0, 0, + 0, 200, 201, 10, 11, 12, 0, 13, 0, 0, + 0, 0, 14, 15, 0, 1, 2, 3, 4, 5, + 6, 0, 7, 8, 0, 0, 9, 0, 0, 0, + 0, 16, 149, 17, 0, 0, 0, 0, 0, 18, + 0, 0, 10, 11, 12, 0, 13, 0, 0, 0, + 0, 14, 15, 1, 2, 3, 4, 5, 6, 0, + 7, 8, 0, 0, 9, 0, 0, 0, 0, 0, + 16, 0, 17, 0, 0, 0, 0, 0, 18, 0, + 10, 11, 12, 0, 13, 0, 0, 0, 0, 14, + 15, 1, 2, 3, 4, 5, 6, 0, 7, 44, + 0, 0, 9, 0, 0, 0, 0, 0, 16, 0, + 17, 0, 0, 0, 0, 0, 18, 0, 10, 11, + 12, 0, 13, 0, 0, 0, 0, 14, 15, 1, + 2, 3, 4, 5, 6, 0, 7, 205, 0, 0, + 9, 0, 0, 0, 0, 0, 16, 0, 17, 0, + 0, 0, 0, 0, 18, 0, 10, 11, 12, 0, + 13, 0, 0, 0, 0, 14, 15, 1, 2, 3, + 4, 5, 6, 0, 7, 8, 0, 0, 9, 0, + 0, 0, 0, 0, 16, 0, 17, 0, 0, 0, + 0, 0, 18, 59, 60, 0, 12, 0, 13, 79, + 80, 81, 0, 82, 83, 84, 85, 86, 0, 59, + 60, 183, 78, 79, 80, 81, 0, 82, 83, 84, + 85, 86, 16, 0, 17, 62, 63, 64, 65, 66, + 18, 0, 0, 0, 209, 67, 68, 0, 0, 69, + 70, 62, 63, 64, 65, 66, 0, 0, 0, 0, + 0, 67, 68, 0, 0, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 108, 78, 79, 80, 81, 0, + 82, 83, 84, 85, 86, 0, 87, 0, 109, 110, + 71, 72, 73, 74, 75, 76, 77, 178, 78, 79, + 80, 81, 0, 82, 83, 84, 85, 86, 0, 87, + 71, 72, 73, 74, 75, 76, 77, 195, 78, 79, + 80, 81, 0, 82, 83, 84, 85, 86, 0, 87, + 71, 72, 73, 74, 75, 76, 77, 0, 78, 79, + 80, 81, 0, 82, 83, 84, 85, 86, 0, 87, + 108, 78, 79, 80, 81, 0, 82, 83, 84, 85, + 86, 0, 0, 0, 109, 110, 210, 78, 79, 80, + 81, 0, 82, 83, 84, 85, 86 +}; + +static const yytype_int16 yycheck[] = +{ + 0, 65, 66, 18, 50, 9, 63, 110, 65, 62, + 12, 13, 9, 15, 10, 11, 16, 0, 14, 15, + 16, 12, 13, 51, 9, 63, 0, 65, 56, 12, + 13, 62, 63, 16, 88, 89, 90, 91, 42, 93, + 44, 95, 44, 45, 46, 47, 48, 44, 49, 50, + 50, 52, 54, 55, 50, 11, 58, 59, 58, 44, + 11, 61, 77, 9, 167, 17, 16, 58, 59, 115, + 70, 16, 11, 69, 17, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 9, 18, 147, 77, 149, 42, 43, 44, 153, + 42, 155, 16, 17, 18, 101, 106, 65, 63, 109, + 67, 65, 108, 19, 110, 218, 27, 58, 182, 115, + 20, 58, 58, 58, 42, 58, 44, 65, 3, 38, + 58, 146, 63, 116, 29, 30, 31, 32, 68, 34, + 35, 36, 37, 38, 63, 209, 29, 30, 31, 32, + 146, 34, 35, 36, 37, 38, 63, 157, 158, 159, + 160, 12, 13, 146, 65, -1, 166, 65, 63, 63, + 63, 167, 63, 16, 0, -1, 101, 177, -1, -1, + 180, -1, 178, -1, -1, -1, -1, 183, -1, -1, + 16, 17, 18, 44, 45, 46, 47, 48, -1, 195, + -1, -1, 53, 54, 55, -1, -1, 58, 59, -1, + -1, 0, 212, 213, 210, -1, 216, 217, -1, -1, + 220, -1, 218, 49, 50, 51, 52, 16, 17, 18, + 56, -1, 58, -1, -1, -1, 62, 63, 64, 65, + -1, -1, 68, 29, 30, 31, 32, -1, 34, 35, + 36, 37, 38, 34, 35, 36, 37, 38, -1, -1, + 49, 50, 51, 52, -1, -1, -1, 56, -1, 58, + -1, -1, -1, 62, 63, 64, 65, 63, -1, 68, + 3, 4, 5, 6, 7, 8, -1, 10, 11, -1, + -1, 14, 3, 4, 5, 6, 7, 8, -1, 10, + 11, -1, -1, 14, -1, -1, -1, 30, 31, 32, + -1, 34, -1, -1, -1, -1, 39, 40, -1, 30, + 31, 32, -1, 34, 49, 50, 51, 52, 39, 40, + -1, 56, -1, 58, -1, 58, -1, 60, -1, 64, + 63, -1, 65, 66, -1, -1, -1, 58, -1, 60, + 61, -1, -1, -1, -1, 66, 3, 4, 5, 6, + 7, 8, -1, 10, 11, -1, -1, 14, 29, 30, + 31, 32, 19, 34, 35, 36, 37, 38, -1, -1, + -1, 42, 43, 30, 31, 32, -1, 34, -1, -1, + -1, -1, 39, 40, -1, 3, 4, 5, 6, 7, + 8, -1, 10, 11, -1, -1, 14, -1, -1, -1, + -1, 58, 20, 60, -1, -1, -1, -1, -1, 66, + -1, -1, 30, 31, 32, -1, 34, -1, -1, -1, + -1, 39, 40, 3, 4, 5, 6, 7, 8, -1, + 10, 11, -1, -1, 14, -1, -1, -1, -1, -1, + 58, -1, 60, -1, -1, -1, -1, -1, 66, -1, + 30, 31, 32, -1, 34, -1, -1, -1, -1, 39, + 40, 3, 4, 5, 6, 7, 8, -1, 10, 11, + -1, -1, 14, -1, -1, -1, -1, -1, 58, -1, + 60, -1, -1, -1, -1, -1, 66, -1, 30, 31, + 32, -1, 34, -1, -1, -1, -1, 39, 40, 3, + 4, 5, 6, 7, 8, -1, 10, 11, -1, -1, + 14, -1, -1, -1, -1, -1, 58, -1, 60, -1, + -1, -1, -1, -1, 66, -1, 30, 31, 32, -1, + 34, -1, -1, -1, -1, 39, 40, 3, 4, 5, + 6, 7, 8, -1, 10, 11, -1, -1, 14, -1, + -1, -1, -1, -1, 58, -1, 60, -1, -1, -1, + -1, -1, 66, 12, 13, -1, 32, -1, 34, 30, + 31, 32, -1, 34, 35, 36, 37, 38, -1, 12, + 13, 28, 29, 30, 31, 32, -1, 34, 35, 36, + 37, 38, 58, -1, 60, 44, 45, 46, 47, 48, + 66, -1, -1, -1, 53, 54, 55, -1, -1, 58, + 59, 44, 45, 46, 47, 48, -1, -1, -1, -1, + -1, 54, 55, -1, -1, 58, 59, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, + 34, 35, 36, 37, 38, -1, 40, -1, 42, 43, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, -1, 34, 35, 36, 37, 38, -1, 40, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, -1, 34, 35, 36, 37, 38, -1, 40, + 21, 22, 23, 24, 25, 26, 27, -1, 29, 30, + 31, 32, -1, 34, 35, 36, 37, 38, -1, 40, + 28, 29, 30, 31, 32, -1, 34, 35, 36, 37, + 38, -1, -1, -1, 42, 43, 28, 29, 30, 31, + 32, -1, 34, 35, 36, 37, 38 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 4, 5, 6, 7, 8, 10, 11, 14, + 30, 31, 32, 34, 39, 40, 58, 60, 66, 70, + 71, 72, 75, 77, 78, 79, 80, 81, 82, 83, + 85, 86, 87, 88, 89, 9, 44, 72, 75, 75, + 72, 72, 75, 75, 11, 61, 71, 75, 78, 90, + 91, 92, 93, 94, 95, 11, 87, 0, 62, 12, + 13, 15, 44, 45, 46, 47, 48, 54, 55, 58, + 59, 21, 22, 23, 24, 25, 26, 27, 29, 30, + 31, 32, 34, 35, 36, 37, 38, 40, 16, 17, + 18, 16, 16, 17, 17, 18, 51, 56, 49, 50, + 52, 58, 64, 11, 42, 43, 42, 63, 28, 42, + 43, 65, 63, 78, 92, 65, 67, 78, 78, 58, + 84, 84, 84, 11, 75, 76, 78, 78, 75, 75, + 75, 75, 75, 75, 72, 75, 87, 75, 75, 75, + 75, 75, 75, 75, 75, 75, 27, 19, 77, 20, + 77, 77, 77, 19, 77, 20, 77, 58, 58, 58, + 58, 75, 76, 74, 9, 44, 96, 98, 78, 75, + 78, 75, 95, 65, 92, 72, 3, 42, 28, 63, + 65, 68, 53, 28, 72, 75, 87, 77, 77, 77, + 77, 78, 78, 78, 78, 28, 63, 73, 78, 95, + 42, 43, 63, 78, 75, 11, 78, 84, 75, 53, + 28, 63, 65, 65, 63, 75, 58, 97, 99, 63, + 42, 84, 75, 78, 78, 63, 78, 78, 95, 78, + 63, 63, 63 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 69, 70, 71, 71, 71, 72, 72, 72, 72, + 73, 72, 74, 72, 72, 72, 72, 72, 72, 75, + 75, 75, 75, 75, 76, 76, 76, 76, 76, 72, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 78, 78, 78, 78, 78, 78, 79, 79, + 80, 80, 81, 81, 82, 82, 83, 83, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 84, 84, 85, 86, 86, 72, 72, 72, 72, 72, + 72, 72, 72, 87, 87, 87, 87, 88, 88, 89, + 90, 90, 90, 91, 91, 92, 92, 92, 93, 94, + 96, 95, 95, 97, 95, 98, 95, 95, 99, 95, + 72, 72, 72 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 3, 3, 2, 2, 4, 4, + 0, 7, 0, 6, 6, 3, 1, 1, 1, 1, + 2, 2, 2, 2, 0, 1, 3, 3, 5, 4, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, + 3, 3, 3, 5, 5, 3, 6, 6, 4, 3, + 3, 3, 1, 1, 1, 1, 1, 1, 3, 3, + 4, 4, 3, 3, 4, 4, 3, 3, 2, 2, + 3, 3, 3, 2, 2, 7, 7, 5, 5, 2, + 0, 3, 1, 1, 0, 1, 1, 1, 1, 1, + 1, 1, 2, 1, 2, 2, 3, 2, 3, 3, + 1, 2, 2, 2, 3, 1, 1, 3, 3, 1, + 0, 4, 3, 0, 6, 0, 4, 3, 0, 6, + 2, 2, 4 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTRPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTRPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTRPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +{ + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to xreallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to xreallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: +#line 191 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_COMMA); } +#line 1665 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 5: +#line 193 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN); } +#line 1671 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 6: +#line 198 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_IND); } +#line 1677 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 7: +#line 202 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_op_with_string (pstate, STRUCTOP_STRUCT, + (yyvsp[0].sval)); } +#line 1684 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 8: +#line 207 "ada-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_FUNCALL); + write_exp_elt_longcst (pstate, (yyvsp[-1].lval)); + write_exp_elt_opcode (pstate, OP_FUNCALL); + } +#line 1694 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 9: +#line 213 "ada-exp.y" /* yacc.c:1646 */ + { + if ((yyvsp[-3].tval) != NULL) + { + if ((yyvsp[-1].lval) != 1) + error (_("Invalid conversion")); + write_exp_elt_opcode (pstate, UNOP_CAST); + write_exp_elt_type (pstate, (yyvsp[-3].tval)); + write_exp_elt_opcode (pstate, UNOP_CAST); + } + else + { + write_exp_elt_opcode (pstate, OP_FUNCALL); + write_exp_elt_longcst (pstate, (yyvsp[-1].lval)); + write_exp_elt_opcode (pstate, OP_FUNCALL); + } + } +#line 1715 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 10: +#line 231 "ada-exp.y" /* yacc.c:1646 */ + { type_qualifier = (yyvsp[-2].tval); } +#line 1721 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 11: +#line 233 "ada-exp.y" /* yacc.c:1646 */ + { + if ((yyvsp[-6].tval) == NULL) + error (_("Type required for qualification")); + write_exp_elt_opcode (pstate, UNOP_QUAL); + write_exp_elt_type (pstate, (yyvsp[-6].tval)); + write_exp_elt_opcode (pstate, UNOP_QUAL); + type_qualifier = (yyvsp[-4].tval); + } +#line 1734 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 12: +#line 243 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = type_qualifier; } +#line 1740 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 13: +#line 248 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, TERNOP_SLICE); } +#line 1746 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 14: +#line 250 "ada-exp.y" /* yacc.c:1646 */ + { if ((yyvsp[-5].tval) == NULL) + write_exp_elt_opcode (pstate, TERNOP_SLICE); + else + error (_("Cannot slice a type")); + } +#line 1756 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 15: +#line 257 "ada-exp.y" /* yacc.c:1646 */ + { } +#line 1762 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 16: +#line 269 "ada-exp.y" /* yacc.c:1646 */ + { if ((yyvsp[0].tval) != NULL) + { + write_exp_elt_opcode (pstate, OP_TYPE); + write_exp_elt_type (pstate, (yyvsp[0].tval)); + write_exp_elt_opcode (pstate, OP_TYPE); + } + } +#line 1774 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 17: +#line 279 "ada-exp.y" /* yacc.c:1646 */ + { write_dollar_variable (pstate, (yyvsp[0].sval)); } +#line 1780 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 20: +#line 289 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_NEG); } +#line 1786 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 21: +#line 293 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PLUS); } +#line 1792 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 22: +#line 297 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); } +#line 1798 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 23: +#line 301 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ABS); } +#line 1804 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 24: +#line 304 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = 0; } +#line 1810 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 25: +#line 308 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = 1; } +#line 1816 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 26: +#line 310 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = 1; } +#line 1822 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 27: +#line 312 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[-2].lval) + 1; } +#line 1828 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 28: +#line 314 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[-4].lval) + 1; } +#line 1834 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 29: +#line 319 "ada-exp.y" /* yacc.c:1646 */ + { + if ((yyvsp[-2].tval) == NULL) + error (_("Type required within braces in coercion")); + write_exp_elt_opcode (pstate, UNOP_MEMVAL); + write_exp_elt_type (pstate, (yyvsp[-2].tval)); + write_exp_elt_opcode (pstate, UNOP_MEMVAL); + } +#line 1846 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 30: +#line 331 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_EXP); } +#line 1852 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 31: +#line 335 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_MUL); } +#line 1858 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 32: +#line 339 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_DIV); } +#line 1864 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 33: +#line 343 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_REM); } +#line 1870 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 34: +#line 347 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_MOD); } +#line 1876 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 35: +#line 351 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_REPEAT); } +#line 1882 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 36: +#line 355 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ADD); } +#line 1888 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 37: +#line 359 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_CONCAT); } +#line 1894 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 38: +#line 363 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUB); } +#line 1900 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 40: +#line 370 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_EQUAL); } +#line 1906 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 41: +#line 374 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); } +#line 1912 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 42: +#line 378 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LEQ); } +#line 1918 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 43: +#line 382 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, TERNOP_IN_RANGE); } +#line 1924 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 44: +#line 384 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval)); + write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS); + } +#line 1933 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 45: +#line 389 "ada-exp.y" /* yacc.c:1646 */ + { + if ((yyvsp[0].tval) == NULL) + error (_("Right operand of 'in' must be type")); + write_exp_elt_opcode (pstate, UNOP_IN_RANGE); + write_exp_elt_type (pstate, (yyvsp[0].tval)); + write_exp_elt_opcode (pstate, UNOP_IN_RANGE); + } +#line 1945 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 46: +#line 397 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, TERNOP_IN_RANGE); + write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); + } +#line 1953 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 47: +#line 401 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval)); + write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS); + write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); + } +#line 1963 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 48: +#line 407 "ada-exp.y" /* yacc.c:1646 */ + { + if ((yyvsp[0].tval) == NULL) + error (_("Right operand of 'in' must be type")); + write_exp_elt_opcode (pstate, UNOP_IN_RANGE); + write_exp_elt_type (pstate, (yyvsp[0].tval)); + write_exp_elt_opcode (pstate, UNOP_IN_RANGE); + write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); + } +#line 1976 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 49: +#line 418 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GEQ); } +#line 1982 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 50: +#line 422 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LESS); } +#line 1988 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 51: +#line 426 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GTR); } +#line 1994 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 58: +#line 439 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); } +#line 2000 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 59: +#line 441 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); } +#line 2006 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 60: +#line 446 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); } +#line 2012 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 61: +#line 448 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); } +#line 2018 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 62: +#line 453 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); } +#line 2024 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 63: +#line 455 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); } +#line 2030 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 64: +#line 460 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); } +#line 2036 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 65: +#line 462 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); } +#line 2042 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 66: +#line 466 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); } +#line 2048 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 67: +#line 468 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); } +#line 2054 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 68: +#line 480 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ADDR); } +#line 2060 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 69: +#line 482 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ADDR); + write_exp_elt_opcode (pstate, UNOP_CAST); + write_exp_elt_type (pstate, + type_system_address (pstate)); + write_exp_elt_opcode (pstate, UNOP_CAST); + } +#line 2071 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 70: +#line 489 "ada-exp.y" /* yacc.c:1646 */ + { write_int (pstate, (yyvsp[0].lval), type_int (pstate)); + write_exp_elt_opcode (pstate, OP_ATR_FIRST); } +#line 2078 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 71: +#line 492 "ada-exp.y" /* yacc.c:1646 */ + { write_int (pstate, (yyvsp[0].lval), type_int (pstate)); + write_exp_elt_opcode (pstate, OP_ATR_LAST); } +#line 2085 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 72: +#line 495 "ada-exp.y" /* yacc.c:1646 */ + { write_int (pstate, (yyvsp[0].lval), type_int (pstate)); + write_exp_elt_opcode (pstate, OP_ATR_LENGTH); } +#line 2092 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 73: +#line 498 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_ATR_SIZE); } +#line 2098 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 74: +#line 500 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_ATR_TAG); } +#line 2104 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 75: +#line 502 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_ATR_MIN); } +#line 2110 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 76: +#line 504 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_ATR_MAX); } +#line 2116 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 77: +#line 506 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_ATR_POS); } +#line 2122 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 78: +#line 508 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_ATR_VAL); } +#line 2128 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 79: +#line 510 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_ATR_MODULUS); } +#line 2134 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 80: +#line 514 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = 1; } +#line 2140 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 81: +#line 516 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[-1].typed_val).val; } +#line 2146 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 82: +#line 521 "ada-exp.y" /* yacc.c:1646 */ + { + if ((yyvsp[0].tval) == NULL) + error (_("Prefix must be type")); + write_exp_elt_opcode (pstate, OP_TYPE); + write_exp_elt_type (pstate, (yyvsp[0].tval)); + write_exp_elt_opcode (pstate, OP_TYPE); } +#line 2157 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 84: +#line 532 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_TYPE); + write_exp_elt_type (pstate, + parse_type (pstate)->builtin_void); + write_exp_elt_opcode (pstate, OP_TYPE); } +#line 2166 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 85: +#line 540 "ada-exp.y" /* yacc.c:1646 */ + { write_int (pstate, (LONGEST) (yyvsp[0].typed_val).val, (yyvsp[0].typed_val).type); } +#line 2172 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 86: +#line 544 "ada-exp.y" /* yacc.c:1646 */ + { write_int (pstate, + convert_char_literal (type_qualifier, (yyvsp[0].typed_val).val), + (type_qualifier == NULL) + ? (yyvsp[0].typed_val).type : type_qualifier); + } +#line 2182 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 87: +#line 552 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FLOAT); + write_exp_elt_type (pstate, (yyvsp[0].typed_val_float).type); + write_exp_elt_floatcst (pstate, (yyvsp[0].typed_val_float).val); + write_exp_elt_opcode (pstate, OP_FLOAT); + } +#line 2192 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 88: +#line 560 "ada-exp.y" /* yacc.c:1646 */ + { write_int (pstate, 0, type_int (pstate)); } +#line 2198 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 89: +#line 564 "ada-exp.y" /* yacc.c:1646 */ + { + write_exp_op_with_string (pstate, OP_STRING, (yyvsp[0].sval)); + } +#line 2206 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 90: +#line 570 "ada-exp.y" /* yacc.c:1646 */ + { write_int (pstate, 1, type_boolean (pstate)); } +#line 2212 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 91: +#line 572 "ada-exp.y" /* yacc.c:1646 */ + { write_int (pstate, 0, type_boolean (pstate)); } +#line 2218 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 92: +#line 576 "ada-exp.y" /* yacc.c:1646 */ + { error (_("NEW not implemented.")); } +#line 2224 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 93: +#line 580 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = write_var_or_type (pstate, NULL, (yyvsp[0].sval)); } +#line 2230 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 94: +#line 582 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = write_var_or_type (pstate, (yyvsp[-1].bval), (yyvsp[0].sval)); } +#line 2236 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 95: +#line 584 "ada-exp.y" /* yacc.c:1646 */ + { + (yyval.tval) = write_var_or_type (pstate, NULL, (yyvsp[-1].sval)); + if ((yyval.tval) == NULL) + write_exp_elt_opcode (pstate, UNOP_ADDR); + else + (yyval.tval) = lookup_pointer_type ((yyval.tval)); + } +#line 2248 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 96: +#line 592 "ada-exp.y" /* yacc.c:1646 */ + { + (yyval.tval) = write_var_or_type (pstate, (yyvsp[-2].bval), (yyvsp[-1].sval)); + if ((yyval.tval) == NULL) + write_exp_elt_opcode (pstate, UNOP_ADDR); + else + (yyval.tval) = lookup_pointer_type ((yyval.tval)); + } +#line 2260 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 97: +#line 603 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.bval) = block_lookup (NULL, (yyvsp[-1].sval).ptr); } +#line 2266 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 98: +#line 605 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.bval) = block_lookup ((yyvsp[-2].bval), (yyvsp[-1].sval).ptr); } +#line 2272 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 99: +#line 610 "ada-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_AGGREGATE); + write_exp_elt_longcst (pstate, (yyvsp[-1].lval)); + write_exp_elt_opcode (pstate, OP_AGGREGATE); + } +#line 2282 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 100: +#line 618 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[0].lval); } +#line 2288 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 101: +#line 620 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_POSITIONAL); + write_exp_elt_longcst (pstate, (yyvsp[-1].lval)); + write_exp_elt_opcode (pstate, OP_POSITIONAL); + (yyval.lval) = (yyvsp[-1].lval) + 1; + } +#line 2298 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 102: +#line 626 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[-1].lval) + (yyvsp[0].lval); } +#line 2304 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 103: +#line 631 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_POSITIONAL); + write_exp_elt_longcst (pstate, 0); + write_exp_elt_opcode (pstate, OP_POSITIONAL); + (yyval.lval) = 1; + } +#line 2314 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 104: +#line 637 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_POSITIONAL); + write_exp_elt_longcst (pstate, (yyvsp[-2].lval)); + write_exp_elt_opcode (pstate, OP_POSITIONAL); + (yyval.lval) = (yyvsp[-2].lval) + 1; + } +#line 2324 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 105: +#line 645 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = 1; } +#line 2330 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 106: +#line 646 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = 1; } +#line 2336 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 107: +#line 648 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[0].lval) + 1; } +#line 2342 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 108: +#line 652 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_OTHERS); } +#line 2348 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 109: +#line 657 "ada-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_CHOICES); + write_exp_elt_longcst (pstate, (yyvsp[0].lval)); + write_exp_elt_opcode (pstate, OP_CHOICES); + } +#line 2358 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 110: +#line 671 "ada-exp.y" /* yacc.c:1646 */ + { write_name_assoc (pstate, (yyvsp[-1].sval)); } +#line 2364 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 111: +#line 672 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = 1; } +#line 2370 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 112: +#line 674 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = 1; } +#line 2376 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 113: +#line 676 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_DISCRETE_RANGE); + write_exp_op_with_string (pstate, OP_NAME, + empty_stoken); + } +#line 2385 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 114: +#line 680 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = 1; } +#line 2391 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 115: +#line 682 "ada-exp.y" /* yacc.c:1646 */ + { write_name_assoc (pstate, (yyvsp[-1].sval)); } +#line 2397 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 116: +#line 683 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[0].lval) + 1; } +#line 2403 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 117: +#line 685 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[0].lval) + 1; } +#line 2409 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 118: +#line 687 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_DISCRETE_RANGE); } +#line 2415 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 119: +#line 688 "ada-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[0].lval) + 1; } +#line 2421 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 120: +#line 695 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_IND); } +#line 2427 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 121: +#line 697 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ADDR); } +#line 2433 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 122: +#line 699 "ada-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); } +#line 2439 "ada-exp.c.tmp" /* yacc.c:1646 */ + break; + + +#line 2443 "ada-exp.c.tmp" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 702 "ada-exp.y" /* yacc.c:1906 */ + + +/* yylex defined in ada-lex.c: Reads one token, getting characters */ +/* through lexptr. */ + +/* Remap normal flex interface names (yylex) as well as gratuitiously */ +/* global symbol names, so we can have multiple flex-generated parsers */ +/* in gdb. */ + +/* (See note above on previous definitions for YACC.) */ + +#define yy_create_buffer ada_yy_create_buffer +#define yy_delete_buffer ada_yy_delete_buffer +#define yy_init_buffer ada_yy_init_buffer +#define yy_load_buffer_state ada_yy_load_buffer_state +#define yy_switch_to_buffer ada_yy_switch_to_buffer +#define yyrestart ada_yyrestart +#define yytext ada_yytext +#define yywrap ada_yywrap + +static struct obstack temp_parse_space; + +/* The following kludge was found necessary to prevent conflicts between */ +/* defs.h and non-standard stdlib.h files. */ +#define qsort __qsort__dummy +#include "ada-lex.c" + +int +ada_parse (struct parser_state *par_state) +{ + /* Setting up the parser state. */ + scoped_restore pstate_restore = make_scoped_restore (&pstate); + gdb_assert (par_state != NULL); + pstate = par_state; + + lexer_init (yyin); /* (Re-)initialize lexer. */ + type_qualifier = NULL; + obstack_free (&temp_parse_space, NULL); + obstack_init (&temp_parse_space); + + return yyparse (); +} + +static void +yyerror (const char *msg) +{ + error (_("Error in expression, near `%s'."), lexptr); +} + +/* Emit expression to access an instance of SYM, in block BLOCK (if + non-NULL). */ + +static void +write_var_from_sym (struct parser_state *par_state, + const struct block *block, + struct symbol *sym) +{ + if (symbol_read_needs_frame (sym)) + innermost_block.update (block, INNERMOST_BLOCK_FOR_SYMBOLS); + + write_exp_elt_opcode (par_state, OP_VAR_VALUE); + write_exp_elt_block (par_state, block); + write_exp_elt_sym (par_state, sym); + write_exp_elt_opcode (par_state, OP_VAR_VALUE); +} + +/* Write integer or boolean constant ARG of type TYPE. */ + +static void +write_int (struct parser_state *par_state, LONGEST arg, struct type *type) +{ + write_exp_elt_opcode (par_state, OP_LONG); + write_exp_elt_type (par_state, type); + write_exp_elt_longcst (par_state, arg); + write_exp_elt_opcode (par_state, OP_LONG); +} + +/* Write an OPCODE, string, OPCODE sequence to the current expression. */ +static void +write_exp_op_with_string (struct parser_state *par_state, + enum exp_opcode opcode, struct stoken token) +{ + write_exp_elt_opcode (par_state, opcode); + write_exp_string (par_state, token); + write_exp_elt_opcode (par_state, opcode); +} + +/* Emit expression corresponding to the renamed object named + * designated by RENAMED_ENTITY[0 .. RENAMED_ENTITY_LEN-1] in the + * context of ORIG_LEFT_CONTEXT, to which is applied the operations + * encoded by RENAMING_EXPR. MAX_DEPTH is the maximum number of + * cascaded renamings to allow. If ORIG_LEFT_CONTEXT is null, it + * defaults to the currently selected block. ORIG_SYMBOL is the + * symbol that originally encoded the renaming. It is needed only + * because its prefix also qualifies any index variables used to index + * or slice an array. It should not be necessary once we go to the + * new encoding entirely (FIXME pnh 7/20/2007). */ + +static void +write_object_renaming (struct parser_state *par_state, + const struct block *orig_left_context, + const char *renamed_entity, int renamed_entity_len, + const char *renaming_expr, int max_depth) +{ + char *name; + enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state; + struct block_symbol sym_info; + + if (max_depth <= 0) + error (_("Could not find renamed symbol")); + + if (orig_left_context == NULL) + orig_left_context = get_selected_block (NULL); + + name = (char *) obstack_copy0 (&temp_parse_space, renamed_entity, + renamed_entity_len); + ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info); + if (sym_info.symbol == NULL) + error (_("Could not find renamed variable: %s"), ada_decode (name)); + else if (SYMBOL_CLASS (sym_info.symbol) == LOC_TYPEDEF) + /* We have a renaming of an old-style renaming symbol. Don't + trust the block information. */ + sym_info.block = orig_left_context; + + { + const char *inner_renamed_entity; + int inner_renamed_entity_len; + const char *inner_renaming_expr; + + switch (ada_parse_renaming (sym_info.symbol, &inner_renamed_entity, + &inner_renamed_entity_len, + &inner_renaming_expr)) + { + case ADA_NOT_RENAMING: + write_var_from_sym (par_state, sym_info.block, sym_info.symbol); + break; + case ADA_OBJECT_RENAMING: + write_object_renaming (par_state, sym_info.block, + inner_renamed_entity, inner_renamed_entity_len, + inner_renaming_expr, max_depth - 1); + break; + default: + goto BadEncoding; + } + } + + slice_state = SIMPLE_INDEX; + while (*renaming_expr == 'X') + { + renaming_expr += 1; + + switch (*renaming_expr) { + case 'A': + renaming_expr += 1; + write_exp_elt_opcode (par_state, UNOP_IND); + break; + case 'L': + slice_state = LOWER_BOUND; + /* FALLTHROUGH */ + case 'S': + renaming_expr += 1; + if (isdigit (*renaming_expr)) + { + char *next; + long val = strtol (renaming_expr, &next, 10); + if (next == renaming_expr) + goto BadEncoding; + renaming_expr = next; + write_exp_elt_opcode (par_state, OP_LONG); + write_exp_elt_type (par_state, type_int (par_state)); + write_exp_elt_longcst (par_state, (LONGEST) val); + write_exp_elt_opcode (par_state, OP_LONG); + } + else + { + const char *end; + char *index_name; + struct block_symbol index_sym_info; + + end = strchr (renaming_expr, 'X'); + if (end == NULL) + end = renaming_expr + strlen (renaming_expr); + + index_name + = (char *) obstack_copy0 (&temp_parse_space, renaming_expr, + end - renaming_expr); + renaming_expr = end; + + ada_lookup_encoded_symbol (index_name, orig_left_context, + VAR_DOMAIN, &index_sym_info); + if (index_sym_info.symbol == NULL) + error (_("Could not find %s"), index_name); + else if (SYMBOL_CLASS (index_sym_info.symbol) == LOC_TYPEDEF) + /* Index is an old-style renaming symbol. */ + index_sym_info.block = orig_left_context; + write_var_from_sym (par_state, index_sym_info.block, + index_sym_info.symbol); + } + if (slice_state == SIMPLE_INDEX) + { + write_exp_elt_opcode (par_state, OP_FUNCALL); + write_exp_elt_longcst (par_state, (LONGEST) 1); + write_exp_elt_opcode (par_state, OP_FUNCALL); + } + else if (slice_state == LOWER_BOUND) + slice_state = UPPER_BOUND; + else if (slice_state == UPPER_BOUND) + { + write_exp_elt_opcode (par_state, TERNOP_SLICE); + slice_state = SIMPLE_INDEX; + } + break; + + case 'R': + { + struct stoken field_name; + const char *end; + char *buf; + + renaming_expr += 1; + + if (slice_state != SIMPLE_INDEX) + goto BadEncoding; + end = strchr (renaming_expr, 'X'); + if (end == NULL) + end = renaming_expr + strlen (renaming_expr); + field_name.length = end - renaming_expr; + buf = (char *) xmalloc (end - renaming_expr + 1); + field_name.ptr = buf; + strncpy (buf, renaming_expr, end - renaming_expr); + buf[end - renaming_expr] = '\000'; + renaming_expr = end; + write_exp_op_with_string (par_state, STRUCTOP_STRUCT, field_name); + break; + } + + default: + goto BadEncoding; + } + } + if (slice_state == SIMPLE_INDEX) + return; + + BadEncoding: + error (_("Internal error in encoding of renaming declaration")); +} + +static const struct block* +block_lookup (const struct block *context, const char *raw_name) +{ + const char *name; + std::vector syms; + int nsyms; + struct symtab *symtab; + const struct block *result = NULL; + + if (raw_name[0] == '\'') + { + raw_name += 1; + name = raw_name; + } + else + name = ada_encode (raw_name); + + nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms); + + if (context == NULL + && (nsyms == 0 || SYMBOL_CLASS (syms[0].symbol) != LOC_BLOCK)) + symtab = lookup_symtab (name); + else + symtab = NULL; + + if (symtab != NULL) + result = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), STATIC_BLOCK); + else if (nsyms == 0 || SYMBOL_CLASS (syms[0].symbol) != LOC_BLOCK) + { + if (context == NULL) + error (_("No file or function \"%s\"."), raw_name); + else + error (_("No function \"%s\" in specified context."), raw_name); + } + else + { + if (nsyms > 1) + warning (_("Function name \"%s\" ambiguous here"), raw_name); + result = SYMBOL_BLOCK_VALUE (syms[0].symbol); + } + + return result; +} + +static struct symbol* +select_possible_type_sym (const std::vector &syms) +{ + int i; + int preferred_index; + struct type *preferred_type; + + preferred_index = -1; preferred_type = NULL; + for (i = 0; i < syms.size (); i += 1) + switch (SYMBOL_CLASS (syms[i].symbol)) + { + case LOC_TYPEDEF: + if (ada_prefer_type (SYMBOL_TYPE (syms[i].symbol), preferred_type)) + { + preferred_index = i; + preferred_type = SYMBOL_TYPE (syms[i].symbol); + } + break; + case LOC_REGISTER: + case LOC_ARG: + case LOC_REF_ARG: + case LOC_REGPARM_ADDR: + case LOC_LOCAL: + case LOC_COMPUTED: + return NULL; + default: + break; + } + if (preferred_type == NULL) + return NULL; + return syms[preferred_index].symbol; +} + +static struct type* +find_primitive_type (struct parser_state *par_state, char *name) +{ + struct type *type; + type = language_lookup_primitive_type (parse_language (par_state), + parse_gdbarch (par_state), + name); + if (type == NULL && strcmp ("system__address", name) == 0) + type = type_system_address (par_state); + + if (type != NULL) + { + /* Check to see if we have a regular definition of this + type that just didn't happen to have been read yet. */ + struct symbol *sym; + char *expanded_name = + (char *) alloca (strlen (name) + sizeof ("standard__")); + strcpy (expanded_name, "standard__"); + strcat (expanded_name, name); + sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN, NULL).symbol; + if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF) + type = SYMBOL_TYPE (sym); + } + + return type; +} + +static int +chop_selector (char *name, int end) +{ + int i; + for (i = end - 1; i > 0; i -= 1) + if (name[i] == '.' || (name[i] == '_' && name[i+1] == '_')) + return i; + return -1; +} + +/* If NAME is a string beginning with a separator (either '__', or + '.'), chop this separator and return the result; else, return + NAME. */ + +static char * +chop_separator (char *name) +{ + if (*name == '.') + return name + 1; + + if (name[0] == '_' && name[1] == '_') + return name + 2; + + return name; +} + +/* Given that SELS is a string of the form ()*, where + is '__' or '.', write the indicated sequence of + STRUCTOP_STRUCT expression operators. */ +static void +write_selectors (struct parser_state *par_state, char *sels) +{ + while (*sels != '\0') + { + struct stoken field_name; + char *p = chop_separator (sels); + sels = p; + while (*sels != '\0' && *sels != '.' + && (sels[0] != '_' || sels[1] != '_')) + sels += 1; + field_name.length = sels - p; + field_name.ptr = p; + write_exp_op_with_string (par_state, STRUCTOP_STRUCT, field_name); + } +} + +/* Write a variable access (OP_VAR_VALUE) to ambiguous encoded name + NAME[0..LEN-1], in block context BLOCK, to be resolved later. Writes + a temporary symbol that is valid until the next call to ada_parse. + */ +static void +write_ambiguous_var (struct parser_state *par_state, + const struct block *block, char *name, int len) +{ + struct symbol *sym = XOBNEW (&temp_parse_space, struct symbol); + + memset (sym, 0, sizeof (struct symbol)); + SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN; + SYMBOL_LINKAGE_NAME (sym) + = (const char *) obstack_copy0 (&temp_parse_space, name, len); + SYMBOL_LANGUAGE (sym) = language_ada; + + write_exp_elt_opcode (par_state, OP_VAR_VALUE); + write_exp_elt_block (par_state, block); + write_exp_elt_sym (par_state, sym); + write_exp_elt_opcode (par_state, OP_VAR_VALUE); +} + +/* A convenient wrapper around ada_get_field_index that takes + a non NUL-terminated FIELD_NAME0 and a FIELD_NAME_LEN instead + of a NUL-terminated field name. */ + +static int +ada_nget_field_index (const struct type *type, const char *field_name0, + int field_name_len, int maybe_missing) +{ + char *field_name = (char *) alloca ((field_name_len + 1) * sizeof (char)); + + strncpy (field_name, field_name0, field_name_len); + field_name[field_name_len] = '\0'; + return ada_get_field_index (type, field_name, maybe_missing); +} + +/* If encoded_field_name is the name of a field inside symbol SYM, + then return the type of that field. Otherwise, return NULL. + + This function is actually recursive, so if ENCODED_FIELD_NAME + doesn't match one of the fields of our symbol, then try to see + if ENCODED_FIELD_NAME could not be a succession of field names + (in other words, the user entered an expression of the form + TYPE_NAME.FIELD1.FIELD2.FIELD3), in which case we evaluate + each field name sequentially to obtain the desired field type. + In case of failure, we return NULL. */ + +static struct type * +get_symbol_field_type (struct symbol *sym, char *encoded_field_name) +{ + char *field_name = encoded_field_name; + char *subfield_name; + struct type *type = SYMBOL_TYPE (sym); + int fieldno; + + if (type == NULL || field_name == NULL) + return NULL; + type = check_typedef (type); + + while (field_name[0] != '\0') + { + field_name = chop_separator (field_name); + + fieldno = ada_get_field_index (type, field_name, 1); + if (fieldno >= 0) + return TYPE_FIELD_TYPE (type, fieldno); + + subfield_name = field_name; + while (*subfield_name != '\0' && *subfield_name != '.' + && (subfield_name[0] != '_' || subfield_name[1] != '_')) + subfield_name += 1; + + if (subfield_name[0] == '\0') + return NULL; + + fieldno = ada_nget_field_index (type, field_name, + subfield_name - field_name, 1); + if (fieldno < 0) + return NULL; + + type = TYPE_FIELD_TYPE (type, fieldno); + field_name = subfield_name; + } + + return NULL; +} + +/* Look up NAME0 (an unencoded identifier or dotted name) in BLOCK (or + expression_block_context if NULL). If it denotes a type, return + that type. Otherwise, write expression code to evaluate it as an + object and return NULL. In this second case, NAME0 will, in general, + have the form (.)*, where is an object + or renaming encoded in the debugging data. Calls error if no + prefix matches a name in the debugging data (i.e., matches + either a complete name or, as a wild-card match, the final + identifier). */ + +static struct type* +write_var_or_type (struct parser_state *par_state, + const struct block *block, struct stoken name0) +{ + int depth; + char *encoded_name; + int name_len; + + if (block == NULL) + block = expression_context_block; + + encoded_name = ada_encode (name0.ptr); + name_len = strlen (encoded_name); + encoded_name + = (char *) obstack_copy0 (&temp_parse_space, encoded_name, name_len); + for (depth = 0; depth < MAX_RENAMING_CHAIN_LENGTH; depth += 1) + { + int tail_index; + + tail_index = name_len; + while (tail_index > 0) + { + int nsyms; + std::vector syms; + struct symbol *type_sym; + struct symbol *renaming_sym; + const char* renaming; + int renaming_len; + const char* renaming_expr; + int terminator = encoded_name[tail_index]; + + encoded_name[tail_index] = '\0'; + nsyms = ada_lookup_symbol_list (encoded_name, block, + VAR_DOMAIN, &syms); + encoded_name[tail_index] = terminator; + + /* A single symbol may rename a package or object. */ + + /* This should go away when we move entirely to new version. + FIXME pnh 7/20/2007. */ + if (nsyms == 1) + { + struct symbol *ren_sym = + ada_find_renaming_symbol (syms[0].symbol, syms[0].block); + + if (ren_sym != NULL) + syms[0].symbol = ren_sym; + } + + type_sym = select_possible_type_sym (syms); + + if (type_sym != NULL) + renaming_sym = type_sym; + else if (nsyms == 1) + renaming_sym = syms[0].symbol; + else + renaming_sym = NULL; + + switch (ada_parse_renaming (renaming_sym, &renaming, + &renaming_len, &renaming_expr)) + { + case ADA_NOT_RENAMING: + break; + case ADA_PACKAGE_RENAMING: + case ADA_EXCEPTION_RENAMING: + case ADA_SUBPROGRAM_RENAMING: + { + int alloc_len = renaming_len + name_len - tail_index + 1; + char *new_name + = (char *) obstack_alloc (&temp_parse_space, alloc_len); + strncpy (new_name, renaming, renaming_len); + strcpy (new_name + renaming_len, encoded_name + tail_index); + encoded_name = new_name; + name_len = renaming_len + name_len - tail_index; + goto TryAfterRenaming; + } + case ADA_OBJECT_RENAMING: + write_object_renaming (par_state, block, renaming, renaming_len, + renaming_expr, MAX_RENAMING_CHAIN_LENGTH); + write_selectors (par_state, encoded_name + tail_index); + return NULL; + default: + internal_error (__FILE__, __LINE__, + _("impossible value from ada_parse_renaming")); + } + + if (type_sym != NULL) + { + struct type *field_type; + + if (tail_index == name_len) + return SYMBOL_TYPE (type_sym); + + /* We have some extraneous characters after the type name. + If this is an expression "TYPE_NAME.FIELD0.[...].FIELDN", + then try to get the type of FIELDN. */ + field_type + = get_symbol_field_type (type_sym, encoded_name + tail_index); + if (field_type != NULL) + return field_type; + else + error (_("Invalid attempt to select from type: \"%s\"."), + name0.ptr); + } + else if (tail_index == name_len && nsyms == 0) + { + struct type *type = find_primitive_type (par_state, + encoded_name); + + if (type != NULL) + return type; + } + + if (nsyms == 1) + { + write_var_from_sym (par_state, syms[0].block, syms[0].symbol); + write_selectors (par_state, encoded_name + tail_index); + return NULL; + } + else if (nsyms == 0) + { + struct bound_minimal_symbol msym + = ada_lookup_simple_minsym (encoded_name); + if (msym.minsym != NULL) + { + write_exp_msymbol (par_state, msym); + /* Maybe cause error here rather than later? FIXME? */ + write_selectors (par_state, encoded_name + tail_index); + return NULL; + } + + if (tail_index == name_len + && strncmp (encoded_name, "standard__", + sizeof ("standard__") - 1) == 0) + error (_("No definition of \"%s\" found."), name0.ptr); + + tail_index = chop_selector (encoded_name, tail_index); + } + else + { + write_ambiguous_var (par_state, block, encoded_name, + tail_index); + write_selectors (par_state, encoded_name + tail_index); + return NULL; + } + } + + if (!have_full_symbols () && !have_partial_symbols () && block == NULL) + error (_("No symbol table is loaded. Use the \"file\" command.")); + if (block == expression_context_block) + error (_("No definition of \"%s\" in current context."), name0.ptr); + else + error (_("No definition of \"%s\" in specified context."), name0.ptr); + + TryAfterRenaming: ; + } + + error (_("Could not find renamed symbol \"%s\""), name0.ptr); + +} + +/* Write a left side of a component association (e.g., NAME in NAME => + exp). If NAME has the form of a selected component, write it as an + ordinary expression. If it is a simple variable that unambiguously + corresponds to exactly one symbol that does not denote a type or an + object renaming, also write it normally as an OP_VAR_VALUE. + Otherwise, write it as an OP_NAME. + + Unfortunately, we don't know at this point whether NAME is supposed + to denote a record component name or the value of an array index. + Therefore, it is not appropriate to disambiguate an ambiguous name + as we normally would, nor to replace a renaming with its referent. + As a result, in the (one hopes) rare case that one writes an + aggregate such as (R => 42) where R renames an object or is an + ambiguous name, one must write instead ((R) => 42). */ + +static void +write_name_assoc (struct parser_state *par_state, struct stoken name) +{ + if (strchr (name.ptr, '.') == NULL) + { + std::vector syms; + int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block, + VAR_DOMAIN, &syms); + + if (nsyms != 1 || SYMBOL_CLASS (syms[0].symbol) == LOC_TYPEDEF) + write_exp_op_with_string (par_state, OP_NAME, name); + else + write_var_from_sym (par_state, syms[0].block, syms[0].symbol); + } + else + if (write_var_or_type (par_state, NULL, name) != NULL) + error (_("Invalid use of type.")); +} + +/* Convert the character literal whose ASCII value would be VAL to the + appropriate value of type TYPE, if there is a translation. + Otherwise return VAL. Hence, in an enumeration type ('A', 'B'), + the literal 'A' (VAL == 65), returns 0. */ + +static LONGEST +convert_char_literal (struct type *type, LONGEST val) +{ + char name[7]; + int f; + + if (type == NULL) + return val; + type = check_typedef (type); + if (TYPE_CODE (type) != TYPE_CODE_ENUM) + return val; + + xsnprintf (name, sizeof (name), "QU%02x", (int) val); + for (f = 0; f < TYPE_NFIELDS (type); f += 1) + { + if (strcmp (name, TYPE_FIELD_NAME (type, f)) == 0) + return TYPE_FIELD_ENUMVAL (type, f); + } + return val; +} + +static struct type * +type_int (struct parser_state *par_state) +{ + return parse_type (par_state)->builtin_int; +} + +static struct type * +type_long (struct parser_state *par_state) +{ + return parse_type (par_state)->builtin_long; +} + +static struct type * +type_long_long (struct parser_state *par_state) +{ + return parse_type (par_state)->builtin_long_long; +} + +static struct type * +type_long_double (struct parser_state *par_state) +{ + return parse_type (par_state)->builtin_long_double; +} + +static struct type * +type_char (struct parser_state *par_state) +{ + return language_string_char_type (parse_language (par_state), + parse_gdbarch (par_state)); +} + +static struct type * +type_boolean (struct parser_state *par_state) +{ + return parse_type (par_state)->builtin_bool; +} + +static struct type * +type_system_address (struct parser_state *par_state) +{ + struct type *type + = language_lookup_primitive_type (parse_language (par_state), + parse_gdbarch (par_state), + "system__address"); + return type != NULL ? type : parse_type (par_state)->builtin_data_ptr; +} + +void +_initialize_ada_exp (void) +{ + obstack_init (&temp_parse_space); +} diff --git a/gdb-8.3.1/gdb/ada-lex.c b/gdb-8.3.1/gdb/ada-lex.c new file mode 100644 index 0000000000000000000000000000000000000000..ef9d91b5b28411dcebe4c7c76492de324aac21ae --- /dev/null +++ b/gdb-8.3.1/gdb/ada-lex.c @@ -0,0 +1,2895 @@ + +#line 3 "" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can xrealloc() it to grow it, and should xfree() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = NULL; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); + +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); + +void *yyalloc ( yy_size_t ); +void *yyxrealloc ( void *, yy_size_t ); +void yyfree ( void * ); + +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ +typedef flex_uint8_t YY_CHAR; + +FILE *yyin = NULL, *yyout = NULL; + +typedef int yy_state_type; + +extern int yylineno; +int yylineno = 1; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; +#define YY_NUM_RULES 55 +#define YY_END_OF_BUFFER 56 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[207] = + { 0, + 0, 0, 0, 0, 56, 54, 1, 1, 15, 53, + 43, 54, 45, 46, 43, 44, 43, 43, 43, 4, + 4, 43, 43, 43, 43, 52, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 42, 0, 14, + 0, 53, 0, 0, 0, 0, 0, 0, 0, 37, + 2, 0, 36, 0, 48, 48, 39, 0, 0, 4, + 0, 0, 51, 38, 40, 0, 35, 41, 0, 0, + 49, 0, 49, 49, 49, 49, 49, 16, 22, 49, + 49, 49, 49, 27, 49, 49, 49, 49, 49, 49, + 0, 14, 0, 12, 12, 34, 0, 2, 0, 48, + + 48, 0, 9, 0, 3, 7, 0, 49, 0, 0, + 0, 49, 19, 20, 49, 49, 23, 24, 25, 49, + 49, 29, 49, 49, 49, 49, 31, 0, 0, 0, + 0, 0, 0, 48, 47, 6, 0, 0, 9, 0, + 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 49, 21, 49, 26, 49, 17, 30, + 49, 32, 0, 50, 0, 0, 0, 0, 49, 0, + 0, 0, 0, 0, 0, 0, 0, 33, 49, 49, + 0, 0, 5, 11, 0, 8, 0, 0, 0, 0, + 0, 0, 28, 49, 0, 5, 0, 8, 0, 0, + + 13, 0, 18, 10, 10, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 5, 6, 7, 8, 5, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 21, 22, 23, + 24, 25, 5, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 33, 36, 37, 38, 39, 40, 33, + 33, 41, 42, 43, 44, 33, 45, 46, 33, 33, + 47, 5, 48, 5, 49, 5, 50, 51, 29, 52, + + 53, 54, 33, 55, 56, 33, 57, 58, 59, 60, + 61, 33, 33, 62, 63, 64, 65, 33, 66, 67, + 33, 33, 26, 22, 26, 5, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static const YY_CHAR yy_meta[68] = + { 0, + 1, 2, 3, 4, 5, 6, 7, 8, 5, 9, + 5, 5, 5, 5, 5, 5, 10, 5, 11, 11, + 5, 5, 12, 13, 14, 5, 15, 15, 15, 15, + 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 5, 5, 17, 15, + 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16 + } ; + +static const flex_int16_t yy_base[229] = + { 0, + 0, 0, 649, 638, 646, 1252, 1252, 1252, 62, 0, + 1252, 109, 1252, 1252, 623, 1252, 619, 175, 606, 174, + 180, 48, 604, 592, 590, 1252, 204, 71, 214, 186, + 235, 244, 304, 256, 39, 368, 40, 430, 179, 1252, + 195, 0, 602, 595, 592, 585, 574, 497, 72, 1252, + 0, 273, 1252, 0, 39, 0, 1252, 0, 66, 262, + 75, 0, 1252, 1252, 1252, 557, 1252, 1252, 284, 300, + 1252, 322, 329, 349, 358, 377, 339, 396, 412, 563, + 566, 575, 584, 587, 569, 596, 623, 616, 576, 617, + 571, 568, 334, 380, 1252, 562, 677, 0, 403, 0, + + 40, 89, 642, 71, 163, 0, 401, 672, 401, 723, + 0, 708, 741, 750, 637, 776, 785, 794, 797, 806, + 775, 827, 831, 843, 818, 819, 883, 415, 0, 712, + 399, 885, 352, 1252, 0, 191, 0, 202, 772, 170, + 243, 334, 222, 244, 247, 259, 766, 47, 209, 216, + 203, 251, 302, 892, 916, 890, 942, 715, 946, 958, + 930, 974, 274, 1252, 93, 344, 278, 310, 979, 256, + 264, 337, 270, 274, 352, 355, 215, 984, 995, 1000, + 299, 354, 589, 355, 223, 603, 209, 204, 198, 189, + 174, 101, 1004, 1016, 92, 634, 411, 644, 872, 1021, + + 717, 373, 1252, 793, 832, 1252, 1055, 1065, 1081, 1086, + 1102, 1119, 1136, 1139, 1146, 339, 560, 1153, 1169, 1181, + 1186, 1197, 1200, 1216, 634, 645, 1223, 1234 + } ; + +static const flex_int16_t yy_def[229] = + { 0, + 206, 1, 1, 1, 206, 206, 206, 206, 207, 208, + 206, 206, 206, 206, 206, 206, 206, 209, 206, 206, + 206, 206, 210, 206, 206, 206, 211, 211, 211, 211, + 211, 211, 211, 211, 33, 211, 33, 206, 207, 206, + 207, 208, 212, 38, 38, 212, 206, 206, 212, 206, + 213, 209, 206, 214, 215, 215, 206, 216, 206, 206, + 206, 217, 206, 206, 206, 218, 206, 206, 206, 206, + 206, 219, 211, 211, 211, 211, 211, 211, 211, 211, + 211, 211, 211, 211, 36, 211, 211, 36, 33, 36, + 48, 220, 206, 206, 206, 48, 212, 213, 221, 215, + + 215, 222, 206, 206, 206, 217, 218, 206, 219, 206, + 223, 224, 211, 211, 33, 211, 211, 211, 211, 211, + 33, 211, 211, 211, 33, 33, 211, 206, 225, 206, + 206, 97, 221, 206, 215, 206, 226, 222, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 227, 224, 211, 33, 211, 36, 211, 211, + 36, 211, 206, 206, 212, 206, 228, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 227, 211, 211, 211, + 212, 206, 206, 206, 228, 206, 206, 206, 206, 206, + 206, 206, 211, 211, 212, 206, 206, 206, 206, 206, + + 206, 206, 206, 206, 206, 0, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206 + } ; + +static const flex_int16_t yy_nxt[1320] = + { 0, + 6, 7, 8, 7, 6, 9, 6, 10, 11, 12, + 13, 14, 15, 11, 16, 17, 18, 19, 20, 21, + 22, 11, 23, 24, 25, 26, 27, 28, 28, 28, + 29, 30, 28, 28, 31, 28, 28, 32, 33, 34, + 35, 28, 36, 28, 28, 37, 11, 11, 28, 27, + 28, 28, 29, 30, 28, 31, 28, 28, 32, 33, + 34, 35, 28, 36, 28, 28, 37, 40, 63, 86, + 73, 64, 69, 69, 70, 101, 135, 97, 73, 90, + 71, 94, 73, 73, 103, 103, 172, 72, 104, 105, + 105, 86, 73, 105, 105, 136, 101, 135, 181, 73, + + 90, 201, 93, 73, 73, 137, 169, 172, 41, 43, + 44, 44, 45, 46, 46, 46, 46, 46, 47, 46, + 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, + 46, 46, 46, 46, 46, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 49, 46, 46, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 52, 52, 52, 169, + 58, 141, 141, 168, 40, 168, 58, 69, 69, 70, + 59, 53, 60, 60, 169, 71, 59, 54, 60, 60, + + 92, 55, 72, 169, 61, 69, 69, 70, 136, 169, + 61, 141, 77, 71, 169, 69, 69, 70, 137, 62, + 72, 166, 60, 71, 55, 41, 61, 169, 60, 184, + 72, 74, 61, 175, 142, 77, 69, 69, 70, 169, + 62, 41, 75, 166, 71, 69, 69, 70, 173, 169, + 76, 72, 169, 71, 74, 175, 174, 69, 69, 70, + 72, 141, 141, 75, 169, 71, 78, 142, 58, 173, + 142, 76, 72, 79, 52, 52, 52, 174, 59, 169, + 60, 60, 142, 80, 184, 69, 69, 69, 78, 206, + 176, 141, 61, 188, 79, 54, 84, 187, 85, 55, + + 72, 69, 69, 70, 80, 69, 69, 70, 93, 71, + 60, 176, 190, 71, 61, 188, 72, 84, 187, 85, + 72, 39, 55, 109, 109, 109, 169, 110, 186, 186, + 69, 69, 70, 190, 81, 130, 130, 130, 71, 169, + 69, 69, 70, 82, 111, 72, 195, 83, 71, 102, + 69, 69, 70, 102, 131, 72, 81, 182, 71, 69, + 69, 70, 183, 183, 82, 72, 189, 71, 83, 69, + 69, 70, 183, 183, 72, 116, 134, 71, 69, 69, + 70, 130, 130, 130, 72, 197, 71, 114, 189, 191, + 113, 204, 204, 72, 87, 192, 116, 69, 69, 70, + + 131, 88, 109, 109, 109, 71, 110, 197, 89, 114, + 191, 113, 72, 69, 69, 70, 192, 87, 115, 164, + 163, 71, 88, 111, 202, 108, 202, 134, 72, 89, + 43, 44, 44, 44, 43, 43, 43, 43, 43, 115, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 91, 43, 43, 43, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 91, 91, 43, 43, 43, + + 43, 43, 43, 43, 43, 43, 94, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 43, 43, 43, 96, 96, 96, 96, + 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, + 96, 96, 96, 96, 69, 69, 70, 69, 69, 70, + 106, 93, 71, 128, 106, 71, 69, 69, 70, 72, + 93, 108, 72, 95, 71, 69, 69, 70, 69, 69, + 70, 72, 117, 71, 94, 73, 71, 69, 69, 70, + + 72, 94, 121, 72, 93, 71, 73, 196, 196, 73, + 118, 93, 72, 68, 117, 73, 67, 119, 73, 126, + 120, 198, 198, 121, 69, 69, 70, 65, 73, 57, + 73, 118, 71, 122, 51, 50, 73, 196, 119, 72, + 126, 120, 73, 73, 128, 206, 124, 38, 128, 73, + 73, 198, 196, 196, 122, 167, 125, 127, 38, 167, + 139, 139, 198, 198, 123, 73, 73, 155, 124, 206, + 73, 73, 140, 69, 69, 70, 73, 125, 127, 206, + 73, 71, 196, 206, 206, 123, 93, 206, 72, 155, + 139, 206, 198, 206, 140, 132, 132, 73, 206, 206, + + 206, 73, 206, 132, 132, 132, 132, 132, 132, 69, + 69, 70, 206, 130, 130, 130, 206, 71, 130, 130, + 130, 206, 206, 206, 72, 206, 132, 132, 132, 132, + 132, 142, 131, 206, 206, 143, 142, 131, 142, 206, + 144, 73, 69, 69, 70, 145, 142, 146, 73, 147, + 71, 69, 69, 70, 206, 179, 206, 72, 206, 71, + 148, 149, 150, 151, 73, 206, 72, 206, 152, 73, + 206, 206, 147, 206, 206, 206, 179, 69, 69, 70, + 206, 148, 149, 150, 151, 71, 69, 69, 70, 152, + 139, 139, 72, 170, 71, 69, 69, 70, 69, 69, + + 70, 72, 140, 71, 171, 158, 71, 69, 69, 70, + 72, 205, 205, 72, 73, 71, 170, 156, 73, 206, + 139, 206, 72, 206, 140, 171, 206, 158, 69, 69, + 70, 206, 69, 69, 70, 73, 71, 206, 156, 73, + 71, 205, 157, 72, 69, 69, 70, 72, 161, 162, + 205, 205, 71, 206, 206, 206, 206, 73, 73, 72, + 206, 73, 73, 157, 206, 206, 159, 206, 206, 206, + 161, 162, 206, 199, 199, 199, 206, 206, 73, 73, + 205, 160, 73, 73, 69, 69, 70, 159, 72, 206, + 203, 203, 71, 69, 69, 70, 206, 206, 206, 72, + + 206, 71, 160, 165, 165, 206, 206, 206, 72, 206, + 206, 165, 165, 165, 165, 165, 165, 69, 69, 70, + 178, 206, 206, 206, 206, 71, 206, 206, 206, 73, + 206, 206, 72, 73, 165, 165, 165, 165, 165, 206, + 206, 206, 178, 69, 69, 70, 206, 69, 69, 70, + 73, 71, 206, 206, 73, 71, 180, 206, 72, 69, + 69, 70, 72, 73, 206, 206, 206, 71, 206, 206, + 73, 206, 206, 206, 72, 69, 69, 70, 206, 180, + 69, 69, 70, 71, 73, 69, 69, 70, 71, 206, + 72, 73, 206, 71, 206, 72, 69, 69, 70, 206, + + 72, 69, 69, 70, 71, 69, 69, 70, 206, 71, + 206, 72, 206, 71, 206, 206, 72, 199, 199, 200, + 72, 206, 199, 199, 200, 71, 206, 206, 206, 194, + 71, 206, 72, 206, 206, 206, 193, 72, 206, 203, + 203, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 194, 206, 206, 206, 206, 206, 193, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 42, 206, 206, 42, 206, 206, 206, 42, + 42, 42, 56, 56, 56, 206, 206, 206, 206, 206, + 56, 206, 56, 206, 206, 56, 56, 56, 66, 206, + + 66, 66, 66, 73, 73, 73, 206, 206, 206, 206, + 73, 73, 73, 206, 206, 206, 73, 73, 73, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 98, 98, 206, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 99, 99, 99, 100, 206, 206, 206, + 100, 100, 100, 107, 206, 206, 107, 107, 107, 107, + 112, 112, 112, 206, 112, 206, 206, 206, 206, 206, + 112, 206, 206, 112, 112, 112, 129, 206, 206, 206, + 206, 129, 206, 206, 206, 129, 133, 206, 206, 133, + + 133, 133, 133, 138, 206, 206, 138, 138, 206, 206, + 206, 138, 206, 138, 153, 153, 153, 154, 154, 154, + 206, 206, 206, 206, 154, 154, 154, 206, 206, 206, + 154, 154, 154, 177, 206, 206, 177, 177, 177, 177, + 185, 206, 206, 206, 185, 206, 206, 206, 185, 206, + 185, 5, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206 + } ; + +static const flex_int16_t yy_chk[1320] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 9, 22, 35, + 37, 22, 28, 28, 28, 55, 101, 49, 35, 37, + 28, 49, 35, 37, 59, 59, 148, 28, 61, 104, + 104, 35, 37, 61, 61, 102, 55, 101, 165, 35, + + 37, 195, 165, 35, 37, 102, 192, 148, 9, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 18, 18, 18, 191, + 20, 105, 105, 140, 39, 140, 21, 30, 30, 30, + 20, 18, 20, 20, 190, 30, 21, 18, 21, 21, + + 41, 18, 30, 189, 20, 27, 27, 27, 138, 188, + 21, 105, 30, 27, 187, 29, 29, 29, 138, 20, + 27, 136, 20, 29, 18, 39, 20, 143, 21, 185, + 29, 27, 21, 151, 143, 30, 31, 31, 31, 177, + 20, 41, 27, 136, 31, 32, 32, 32, 149, 144, + 29, 31, 145, 32, 27, 151, 150, 34, 34, 34, + 32, 141, 141, 27, 146, 34, 31, 144, 60, 149, + 145, 29, 34, 31, 52, 52, 52, 150, 60, 174, + 60, 60, 146, 32, 167, 69, 69, 69, 31, 52, + 152, 141, 60, 171, 31, 52, 34, 170, 34, 52, + + 69, 70, 70, 70, 32, 33, 33, 33, 181, 70, + 60, 152, 173, 33, 60, 171, 70, 34, 170, 34, + 33, 163, 52, 72, 72, 72, 153, 72, 168, 168, + 73, 73, 73, 173, 33, 93, 93, 93, 73, 142, + 77, 77, 77, 33, 72, 73, 181, 33, 77, 216, + 74, 74, 74, 216, 93, 77, 33, 166, 74, 75, + 75, 75, 166, 166, 33, 74, 172, 75, 33, 36, + 36, 36, 182, 182, 75, 77, 133, 36, 76, 76, + 76, 94, 94, 94, 36, 184, 76, 75, 172, 175, + 74, 202, 202, 76, 36, 176, 77, 78, 78, 78, + + 94, 36, 109, 109, 109, 78, 109, 184, 36, 75, + 175, 74, 78, 79, 79, 79, 176, 36, 76, 131, + 128, 79, 36, 109, 197, 107, 197, 99, 79, 36, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 76, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 48, 48, 48, + + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 80, 80, 80, 81, 81, 81, + 217, 96, 80, 92, 217, 81, 82, 82, 82, 80, + 91, 66, 81, 47, 82, 83, 83, 83, 84, 84, + 84, 82, 80, 83, 46, 85, 84, 86, 86, 86, + + 83, 45, 85, 84, 44, 86, 89, 183, 183, 85, + 81, 43, 86, 25, 80, 89, 24, 82, 85, 89, + 83, 186, 186, 85, 87, 87, 87, 23, 89, 19, + 85, 81, 87, 86, 17, 15, 89, 183, 82, 87, + 89, 83, 88, 90, 225, 5, 88, 4, 225, 88, + 90, 186, 196, 196, 86, 226, 88, 90, 3, 226, + 103, 103, 198, 198, 87, 88, 90, 115, 88, 0, + 88, 90, 103, 108, 108, 108, 115, 88, 90, 0, + 115, 108, 196, 0, 0, 87, 97, 0, 108, 115, + 103, 0, 198, 0, 103, 97, 97, 115, 0, 0, + + 0, 115, 0, 97, 97, 97, 97, 97, 97, 112, + 112, 112, 0, 130, 130, 130, 0, 112, 201, 201, + 201, 0, 0, 0, 112, 0, 97, 97, 97, 97, + 97, 110, 130, 0, 0, 110, 110, 201, 110, 0, + 110, 158, 113, 113, 113, 110, 110, 110, 158, 110, + 113, 114, 114, 114, 0, 158, 0, 113, 0, 114, + 110, 110, 110, 110, 158, 0, 114, 0, 110, 158, + 0, 0, 110, 0, 0, 0, 158, 116, 116, 116, + 0, 110, 110, 110, 110, 116, 117, 117, 117, 110, + 139, 139, 116, 147, 117, 118, 118, 118, 119, 119, + + 119, 117, 139, 118, 147, 121, 119, 120, 120, 120, + 118, 204, 204, 119, 121, 120, 147, 116, 121, 0, + 139, 0, 120, 0, 139, 147, 0, 121, 122, 122, + 122, 0, 123, 123, 123, 121, 122, 0, 116, 121, + 123, 204, 120, 122, 124, 124, 124, 123, 125, 126, + 205, 205, 124, 0, 0, 0, 0, 125, 126, 124, + 0, 125, 126, 120, 0, 0, 123, 0, 0, 0, + 125, 126, 0, 199, 199, 199, 0, 0, 125, 126, + 205, 124, 125, 126, 127, 127, 127, 123, 199, 0, + 199, 199, 127, 154, 154, 154, 0, 0, 0, 127, + + 0, 154, 124, 132, 132, 0, 0, 0, 154, 0, + 0, 132, 132, 132, 132, 132, 132, 155, 155, 155, + 156, 0, 0, 0, 0, 155, 0, 0, 0, 156, + 0, 0, 155, 156, 132, 132, 132, 132, 132, 0, + 0, 0, 156, 157, 157, 157, 0, 159, 159, 159, + 156, 157, 0, 0, 156, 159, 161, 0, 157, 160, + 160, 160, 159, 161, 0, 0, 0, 160, 0, 0, + 161, 0, 0, 0, 160, 162, 162, 162, 0, 161, + 169, 169, 169, 162, 161, 178, 178, 178, 169, 0, + 162, 161, 0, 178, 0, 169, 179, 179, 179, 0, + + 178, 180, 180, 180, 179, 193, 193, 193, 0, 180, + 0, 179, 0, 193, 0, 0, 180, 194, 194, 194, + 193, 0, 200, 200, 200, 194, 0, 0, 0, 180, + 200, 0, 194, 0, 0, 0, 179, 200, 0, 200, + 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 180, 0, 0, 0, 0, 0, 179, 207, 207, + 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, + 207, 207, 208, 0, 0, 208, 0, 0, 0, 208, + 208, 208, 209, 209, 209, 0, 0, 0, 0, 0, + 209, 0, 209, 0, 0, 209, 209, 209, 210, 0, + + 210, 210, 210, 211, 211, 211, 0, 0, 0, 0, + 211, 211, 211, 0, 0, 0, 211, 211, 211, 212, + 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, + 212, 212, 212, 212, 212, 212, 213, 213, 0, 213, + 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, + 213, 213, 213, 214, 214, 214, 215, 0, 0, 0, + 215, 215, 215, 218, 0, 0, 218, 218, 218, 218, + 219, 219, 219, 0, 219, 0, 0, 0, 0, 0, + 219, 0, 0, 219, 219, 219, 220, 0, 0, 0, + 0, 220, 0, 0, 0, 220, 221, 0, 0, 221, + + 221, 221, 221, 222, 0, 0, 222, 222, 0, 0, + 0, 222, 0, 222, 223, 223, 223, 224, 224, 224, + 0, 0, 0, 0, 224, 224, 224, 0, 0, 0, + 224, 224, 224, 227, 0, 0, 227, 227, 227, 227, + 228, 0, 0, 0, 228, 0, 0, 0, 228, 0, + 228, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + + 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, + 206, 206, 206, 206, 206, 206, 206, 206, 206 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "ada-lex.l" +/* FLEX lexer for Ada expressions, for GDB. + Copyright (C) 1994-2019 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ +/*----------------------------------------------------------------------*/ +/* The converted version of this file is to be included in ada-exp.y, */ +/* the Ada parser for gdb. The function yylex obtains characters from */ +/* the global pointer lexptr. It returns a syntactic category for */ +/* each successive token and places a semantic value into yylval */ +/* (ada-lval), defined by the parser. */ +#line 43 "ada-lex.l" + +#include "diagnostics.h" + +/* Some old versions of flex generate code that uses the "register" keyword, + which clang warns about. This was observed for example with flex 2.5.35, + as shipped with macOS 10.12. */ +DIAGNOSTIC_PUSH +DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER + +#define NUMERAL_WIDTH 256 +#define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1)) + +/* Temporary staging for numeric literals. */ +static char numbuf[NUMERAL_WIDTH]; + static void canonicalizeNumeral (char *s1, const char *); +static struct stoken processString (const char*, int); +static int processInt (struct parser_state *, const char *, const char *, + const char *); +static int processReal (struct parser_state *, const char *); +static struct stoken processId (const char *, int); +static int processAttribute (const char *); +static int find_dot_all (const char *); +static void rewind_to_char (int); + +#undef YY_DECL +#define YY_DECL static int yylex ( void ) + +/* Flex generates a static function "input" which is not used. + Defining YY_NO_INPUT comments it out. */ +#define YY_NO_INPUT + +#undef YY_INPUT +#define YY_INPUT(BUF, RESULT, MAX_SIZE) \ + if ( *lexptr == '\000' ) \ + (RESULT) = YY_NULL; \ + else \ + { \ + *(BUF) = *lexptr; \ + (RESULT) = 1; \ + lexptr += 1; \ + } + +static int find_dot_all (const char *); + +#line 873 "" + +#line 875 "" + +#define INITIAL 0 +#define BEFORE_QUAL_QUOTE 1 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals ( void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( void ); + +int yyget_debug ( void ); + +void yyset_debug ( int debug_flag ); + +YY_EXTRA_TYPE yyget_extra ( void ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in ( void ); + +void yyset_in ( FILE * _in_str ); + +FILE *yyget_out ( void ); + +void yyset_out ( FILE * _out_str ); + + int yyget_leng ( void ); + +char *yyget_text ( void ); + +int yyget_lineno ( void ); + +void yyset_lineno ( int _line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( void ); +#else +extern int yywrap ( void ); +#endif +#endif + +#ifndef YY_NO_UNPUT + + static void yyunput ( int c, char *buf_ptr ); + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * ); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput ( void ); +#else +static int input ( void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + { +#line 93 "ada-lex.l" + + +#line 1096 "" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 207 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 1252 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +/* rule 1 can match eol */ +YY_RULE_SETUP +#line 95 "ada-lex.l" +{ } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 97 "ada-lex.l" +{ yyterminate(); } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 99 "ada-lex.l" +{ + canonicalizeNumeral (numbuf, yytext); + return processInt (pstate, NULL, numbuf, + strrchr (numbuf, 'e') + 1); + } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 105 "ada-lex.l" +{ + canonicalizeNumeral (numbuf, yytext); + return processInt (pstate, NULL, numbuf, NULL); + } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 110 "ada-lex.l" +{ + canonicalizeNumeral (numbuf, yytext); + return processInt (pstate, numbuf, + strchr (numbuf, '#') + 1, + strrchr(numbuf, '#') + 1); + } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 117 "ada-lex.l" +{ + canonicalizeNumeral (numbuf, yytext); + return processInt (pstate, numbuf, strchr (numbuf, '#') + 1, + NULL); + } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 123 "ada-lex.l" +{ + canonicalizeNumeral (numbuf, yytext+2); + return processInt (pstate, "16#", numbuf, NULL); + } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 129 "ada-lex.l" +{ + canonicalizeNumeral (numbuf, yytext); + return processReal (pstate, numbuf); + } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 134 "ada-lex.l" +{ + canonicalizeNumeral (numbuf, yytext); + return processReal (pstate, numbuf); + } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 139 "ada-lex.l" +{ + error (_("Based real literals not implemented yet.")); + } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 143 "ada-lex.l" +{ + error (_("Based real literals not implemented yet.")); + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 147 "ada-lex.l" +{ + yylval.typed_val.type = type_char (pstate); + yylval.typed_val.val = yytext[1]; + return CHARLIT; + } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 153 "ada-lex.l" +{ + int v; + yylval.typed_val.type = type_char (pstate); + sscanf (yytext+3, "%2x", &v); + yylval.typed_val.val = v; + return CHARLIT; + } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 161 "ada-lex.l" +{ + yylval.sval = processString (yytext+1, yyleng-2); + return STRING; + } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 166 "ada-lex.l" +{ + error (_("ill-formed or non-terminated string literal")); + } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 171 "ada-lex.l" +{ + rewind_to_char ('i'); + return 0; + } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 176 "ada-lex.l" +{ + rewind_to_char ('t'); + return 0; + } + YY_BREAK +case 18: +/* rule 18 can match eol */ +YY_RULE_SETUP +#line 181 "ada-lex.l" +{ + /* This keyword signals the end of the expression and + will be processed separately. */ + rewind_to_char ('t'); + return 0; + } + YY_BREAK +/* ADA KEYWORDS */ +case 19: +YY_RULE_SETUP +#line 190 "ada-lex.l" +{ return ABS; } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 191 "ada-lex.l" +{ return _AND_; } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 192 "ada-lex.l" +{ return ELSE; } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 193 "ada-lex.l" +{ return IN; } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 194 "ada-lex.l" +{ return MOD; } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 195 "ada-lex.l" +{ return NEW; } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 196 "ada-lex.l" +{ return NOT; } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 197 "ada-lex.l" +{ return NULL_PTR; } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 198 "ada-lex.l" +{ return OR; } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 199 "ada-lex.l" +{ return OTHERS; } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 200 "ada-lex.l" +{ return REM; } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 201 "ada-lex.l" +{ return THEN; } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 202 "ada-lex.l" +{ return XOR; } + YY_BREAK +/* BOOLEAN "KEYWORDS" */ +/* True and False are not keywords in Ada, but rather enumeration constants. + However, the boolean type is no longer represented as an enum, so True + and False are no longer defined in symbol tables. We compromise by + making them keywords (when bare). */ +case 32: +YY_RULE_SETUP +#line 211 "ada-lex.l" +{ return TRUEKEYWORD; } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 212 "ada-lex.l" +{ return FALSEKEYWORD; } + YY_BREAK +/* ATTRIBUTES */ +case 34: +/* rule 34 can match eol */ +YY_RULE_SETUP +#line 216 "ada-lex.l" +{ BEGIN INITIAL; return processAttribute (yytext+1); } + YY_BREAK +/* PUNCTUATION */ +case 35: +YY_RULE_SETUP +#line 220 "ada-lex.l" +{ return ARROW; } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 221 "ada-lex.l" +{ return DOTDOT; } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 222 "ada-lex.l" +{ return STARSTAR; } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 223 "ada-lex.l" +{ return ASSIGN; } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 224 "ada-lex.l" +{ return NOTEQUAL; } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 225 "ada-lex.l" +{ return LEQ; } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 226 "ada-lex.l" +{ return GEQ; } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 228 "ada-lex.l" +{ BEGIN INITIAL; return '\''; } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 230 "ada-lex.l" +{ return yytext[0]; } + YY_BREAK +case 44: +YY_RULE_SETUP +#line 232 "ada-lex.l" +{ if (paren_depth == 0 && comma_terminates) + { + rewind_to_char (','); + return 0; + } + else + return ','; + } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 241 "ada-lex.l" +{ paren_depth += 1; return '('; } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 242 "ada-lex.l" +{ if (paren_depth == 0) + { + rewind_to_char (')'); + return 0; + } + else + { + paren_depth -= 1; + return ')'; + } + } + YY_BREAK +case 47: +/* rule 47 can match eol */ +YY_RULE_SETUP +#line 254 "ada-lex.l" +{ return DOT_ALL; } + YY_BREAK +case 48: +/* rule 48 can match eol */ +YY_RULE_SETUP +#line 256 "ada-lex.l" +{ + yylval.sval = processId (yytext+1, yyleng-1); + return DOT_ID; + } + YY_BREAK +case 49: +/* rule 49 can match eol */ +YY_RULE_SETUP +#line 261 "ada-lex.l" +{ + int all_posn = find_dot_all (yytext); + + if (all_posn == -1 && yytext[yyleng-1] == '\'') + { + BEGIN BEFORE_QUAL_QUOTE; + yyless (yyleng-1); + } + else if (all_posn >= 0) + yyless (all_posn); + yylval.sval = processId (yytext, yyleng); + return NAME; + } + YY_BREAK +/* GDB EXPRESSION CONSTRUCTS */ +case 50: +/* rule 50 can match eol */ +YY_RULE_SETUP +#line 278 "ada-lex.l" +{ + yyless (yyleng - 2); + yylval.sval = processId (yytext, yyleng); + return NAME; + } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 284 "ada-lex.l" +{ return COLONCOLON; } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 286 "ada-lex.l" +{ return yytext[0]; } + YY_BREAK +/* REGISTERS AND GDB CONVENIENCE VARIABLES */ +case 53: +YY_RULE_SETUP +#line 290 "ada-lex.l" +{ + yylval.sval.ptr = yytext; + yylval.sval.length = yyleng; + return DOLLAR_VARIABLE; + } + YY_BREAK +/* CATCH-ALL ERROR CASE */ +case 54: +YY_RULE_SETUP +#line 298 "ada-lex.l" +{ error (_("Invalid character '%s' in expression."), yytext); } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 299 "ada-lex.l" +YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK +#line 1541 "" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(BEFORE_QUAL_QUOTE): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyxrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyxrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + yy_state_type yy_current_state; + char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 207 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 207 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 206); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree( (void *) b->yy_ch_buf ); + + yyfree( (void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate xrealloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyxrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (const char * yystr ) +{ + + return yy_scan_bytes( yystr, (int) strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yynoreturn yy_fatal_error (const char* msg ) +{ + fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param _line_number line number + * + */ +void yyset_lineno (int _line_number ) +{ + + yylineno = _line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * _in_str ) +{ + yyin = _in_str ; +} + +void yyset_out (FILE * _out_str ) +{ + yyout = _out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int _bdebug ) +{ + yy_flex_debug = _bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = NULL; + yyout = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n ) +{ + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (const char * s ) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return xmalloc(size); +} + +void *yyxrealloc (void * ptr, yy_size_t size ) +{ + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return xrealloc(ptr, size); +} + +void yyfree (void * ptr ) +{ + xfree( (char *) ptr ); /* see yyxrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 299 "ada-lex.l" + + +#include +/* Initialize the lexer for processing new expression. */ + +static void +lexer_init (FILE *inp) +{ + BEGIN INITIAL; + yyrestart (inp); +} + + +/* Copy S2 to S1, removing all underscores, and downcasing all letters. */ + +static void +canonicalizeNumeral (char *s1, const char *s2) +{ + for (; *s2 != '\000'; s2 += 1) + { + if (*s2 != '_') + { + *s1 = tolower(*s2); + s1 += 1; + } + } + s1[0] = '\000'; +} + +/* Interprets the prefix of NUM that consists of digits of the given BASE + as an integer of that BASE, with the string EXP as an exponent. + Puts value in yylval, and returns INT, if the string is valid. Causes + an error if the number is improperly formated. BASE, if NULL, defaults + to "10", and EXP to "1". The EXP does not contain a leading 'e' or 'E'. + */ + +static int +processInt (struct parser_state *par_state, const char *base0, + const char *num0, const char *exp0) +{ + ULONGEST result; + long exp; + int base; + const char *trailer; + + if (base0 == NULL) + base = 10; + else + { + base = strtol (base0, (char **) NULL, 10); + if (base < 2 || base > 16) + error (_("Invalid base: %d."), base); + } + + if (exp0 == NULL) + exp = 0; + else + exp = strtol(exp0, (char **) NULL, 10); + + errno = 0; + result = strtoulst (num0, &trailer, base); + if (errno == ERANGE) + error (_("Integer literal out of range")); + if (isxdigit(*trailer)) + error (_("Invalid digit `%c' in based literal"), *trailer); + + while (exp > 0) + { + if (result > (ULONG_MAX / base)) + error (_("Integer literal out of range")); + result *= base; + exp -= 1; + } + + if ((result >> (gdbarch_int_bit (parse_gdbarch (par_state))-1)) == 0) + yylval.typed_val.type = type_int (par_state); + else if ((result >> (gdbarch_long_bit (parse_gdbarch (par_state))-1)) == 0) + yylval.typed_val.type = type_long (par_state); + else if (((result >> (gdbarch_long_bit (parse_gdbarch (par_state))-1)) >> 1) == 0) + { + /* We have a number representable as an unsigned integer quantity. + For consistency with the C treatment, we will treat it as an + anonymous modular (unsigned) quantity. Alas, the types are such + that we need to store .val as a signed quantity. Sorry + for the mess, but C doesn't officially guarantee that a simple + assignment does the trick (no, it doesn't; read the reference manual). + */ + yylval.typed_val.type + = builtin_type (parse_gdbarch (par_state))->builtin_unsigned_long; + if (result & LONGEST_SIGN) + yylval.typed_val.val = + (LONGEST) (result & ~LONGEST_SIGN) + - (LONGEST_SIGN>>1) - (LONGEST_SIGN>>1); + else + yylval.typed_val.val = (LONGEST) result; + return INT; + } + else + yylval.typed_val.type = type_long_long (par_state); + + yylval.typed_val.val = (LONGEST) result; + return INT; +} + +static int +processReal (struct parser_state *par_state, const char *num0) +{ + yylval.typed_val_float.type = type_long_double (par_state); + + bool parsed = parse_float (num0, strlen (num0), + yylval.typed_val_float.type, + yylval.typed_val_float.val); + gdb_assert (parsed); + return FLOAT; +} + + +/* Store a canonicalized version of NAME0[0..LEN-1] in yylval.ssym. The + resulting string is valid until the next call to ada_parse. If + NAME0 contains the substring "___", it is assumed to be already + encoded and the resulting name is equal to it. Similarly, if the name + starts with '<', it is copied verbatim. Otherwise, it differs + from NAME0 in that: + + Characters between '...' are transfered verbatim to yylval.ssym. + + Trailing "'" characters in quoted sequences are removed (a leading quote is + preserved to indicate that the name is not to be GNAT-encoded). + + Unquoted whitespace is removed. + + Unquoted alphabetic characters are mapped to lower case. + Result is returned as a struct stoken, but for convenience, the string + is also null-terminated. Result string valid until the next call of + ada_parse. + */ +static struct stoken +processId (const char *name0, int len) +{ + char *name = (char *) obstack_alloc (&temp_parse_space, len + 11); + int i0, i; + struct stoken result; + + result.ptr = name; + while (len > 0 && isspace (name0[len-1])) + len -= 1; + + if (name0[0] == '<' || strstr (name0, "___") != NULL) + { + strncpy (name, name0, len); + name[len] = '\000'; + result.length = len; + return result; + } + + i = i0 = 0; + while (i0 < len) + { + if (isalnum (name0[i0])) + { + name[i] = tolower (name0[i0]); + i += 1; i0 += 1; + } + else switch (name0[i0]) + { + default: + name[i] = name0[i0]; + i += 1; i0 += 1; + break; + case ' ': case '\t': + i0 += 1; + break; + case '\'': + do + { + name[i] = name0[i0]; + i += 1; i0 += 1; + } + while (i0 < len && name0[i0] != '\''); + i0 += 1; + break; + } + } + name[i] = '\000'; + + result.length = i; + return result; +} + +/* Return TEXT[0..LEN-1], a string literal without surrounding quotes, + with special hex character notations replaced with characters. + Result valid until the next call to ada_parse. */ + +static struct stoken +processString (const char *text, int len) +{ + const char *p; + char *q; + const char *lim = text + len; + struct stoken result; + + q = (char *) obstack_alloc (&temp_parse_space, len); + result.ptr = q; + p = text; + while (p < lim) + { + if (p[0] == '[' && p[1] == '"' && p+2 < lim) + { + if (p[2] == '"') /* "...["""]... */ + { + *q = '"'; + p += 4; + } + else + { + int chr; + sscanf (p+2, "%2x", &chr); + *q = (char) chr; + p += 5; + } + } + else + *q = *p; + q += 1; + p += 1; + } + result.length = q - result.ptr; + return result; +} + +/* Returns the position within STR of the '.' in a + '.{WHITE}*all' component of a dotted name, or -1 if there is none. + Note: we actually don't need this routine, since 'all' can never be an + Ada identifier. Thus, looking up foo.all or foo.all.x as a name + must fail, and will eventually be interpreted as (foo).all or + (foo).all.x. However, this does avoid an extraneous lookup. */ + +static int +find_dot_all (const char *str) +{ + int i; + + for (i = 0; str[i] != '\000'; i++) + if (str[i] == '.') + { + int i0 = i; + + do + i += 1; + while (isspace (str[i])); + + if (strncasecmp (str + i, "all", 3) == 0 + && !isalnum (str[i + 3]) && str[i + 3] != '_') + return i0; + } + return -1; +} + +/* Returns non-zero iff string SUBSEQ matches a subsequence of STR, ignoring + case. */ + +static int +subseqMatch (const char *subseq, const char *str) +{ + if (subseq[0] == '\0') + return 1; + else if (str[0] == '\0') + return 0; + else if (tolower (subseq[0]) == tolower (str[0])) + return subseqMatch (subseq+1, str+1) || subseqMatch (subseq, str+1); + else + return subseqMatch (subseq, str+1); +} + + +static struct { const char *name; int code; } +attributes[] = { + { "address", TICK_ADDRESS }, + { "unchecked_access", TICK_ACCESS }, + { "unrestricted_access", TICK_ACCESS }, + { "access", TICK_ACCESS }, + { "first", TICK_FIRST }, + { "last", TICK_LAST }, + { "length", TICK_LENGTH }, + { "max", TICK_MAX }, + { "min", TICK_MIN }, + { "modulus", TICK_MODULUS }, + { "pos", TICK_POS }, + { "range", TICK_RANGE }, + { "size", TICK_SIZE }, + { "tag", TICK_TAG }, + { "val", TICK_VAL }, + { NULL, -1 } +}; + +/* Return the syntactic code corresponding to the attribute name or + abbreviation STR. */ + +static int +processAttribute (const char *str) +{ + int i, k; + + for (i = 0; attributes[i].code != -1; i += 1) + if (strcasecmp (str, attributes[i].name) == 0) + return attributes[i].code; + + for (i = 0, k = -1; attributes[i].code != -1; i += 1) + if (subseqMatch (str, attributes[i].name)) + { + if (k == -1) + k = i; + else + error (_("ambiguous attribute name: `%s'"), str); + } + if (k == -1) + error (_("unrecognized attribute: `%s'"), str); + + return attributes[k].code; +} + +/* Back up lexptr by yyleng and then to the rightmost occurrence of + character CH, case-folded (there must be one). WARNING: since + lexptr points to the next input character that Flex has not yet + transferred to its internal buffer, the use of this function + depends on the assumption that Flex calls YY_INPUT only when it is + logically necessary to do so (thus, there is no reading ahead + farther than needed to identify the next token.) */ + +static void +rewind_to_char (int ch) +{ + lexptr -= yyleng; + while (toupper (*lexptr) != toupper (ch)) + lexptr -= 1; + yyrestart (NULL); +} + +int +yywrap(void) +{ + return 1; +} + +/* Dummy definition to suppress warnings about unused static definitions. */ +typedef void (*dummy_function) (); +dummy_function ada_flex_use[] = +{ + (dummy_function) yyunput +}; + +DIAGNOSTIC_POP + diff --git a/gdb-8.3.1/gdb/c-exp.c b/gdb-8.3.1/gdb/c-exp.c new file mode 100644 index 0000000000000000000000000000000000000000..8a266c7b0340baebd93d5d35e597d920cd226797 --- /dev/null +++ b/gdb-8.3.1/gdb/c-exp.c @@ -0,0 +1,5996 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* Copy the first part of user declarations. */ +#line 36 "c-exp.y" /* yacc.c:339 */ + + +#include "defs.h" +#include +#include "expression.h" +#include "value.h" +#include "parser-defs.h" +#include "language.h" +#include "c-lang.h" +#include "c-support.h" +#include "bfd.h" /* Required by objfiles.h. */ +#include "symfile.h" /* Required by objfiles.h. */ +#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ +#include "charset.h" +#include "block.h" +#include "cp-support.h" +#include "macroscope.h" +#include "objc-lang.h" +#include "typeprint.h" +#include "cp-abi.h" + +#define parse_type(ps) builtin_type (parse_gdbarch (ps)) + +/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, + etc). */ +#define GDB_YY_REMAP_PREFIX c_ +#include "yy-remap.h" + +/* The state of the parser, used internally when we are parsing the + expression. */ + +static struct parser_state *pstate = NULL; + +/* Data that must be held for the duration of a parse. */ + +struct c_parse_state +{ + /* These are used to hold type lists and type stacks that are + allocated during the parse. */ + std::vector>> type_lists; + std::vector> type_stacks; + + /* Storage for some strings allocated during the parse. */ + std::vector> strings; + + /* When we find that lexptr (the global var defined in parse.c) is + pointing at a macro invocation, we expand the invocation, and call + scan_macro_expansion to save the old lexptr here and point lexptr + into the expanded text. When we reach the end of that, we call + end_macro_expansion to pop back to the value we saved here. The + macro expansion code promises to return only fully-expanded text, + so we don't need to "push" more than one level. + + This is disgusting, of course. It would be cleaner to do all macro + expansion beforehand, and then hand that to lexptr. But we don't + really know where the expression ends. Remember, in a command like + + (gdb) break *ADDRESS if CONDITION + + we evaluate ADDRESS in the scope of the current frame, but we + evaluate CONDITION in the scope of the breakpoint's location. So + it's simply wrong to try to macro-expand the whole thing at once. */ + const char *macro_original_text = nullptr; + + /* We save all intermediate macro expansions on this obstack for the + duration of a single parse. The expansion text may sometimes have + to live past the end of the expansion, due to yacc lookahead. + Rather than try to be clever about saving the data for a single + token, we simply keep it all and delete it after parsing has + completed. */ + auto_obstack expansion_obstack; +}; + +/* This is set and cleared in c_parse. */ + +static struct c_parse_state *cpstate; + +int yyparse (void); + +static int yylex (void); + +static void yyerror (const char *); + +static int type_aggregate_p (struct type *); + + +#line 153 "c-exp.c.tmp" /* yacc.c:339 */ + +# ifndef YY_NULLPTRPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTRPTR nullptr +# else +# define YY_NULLPTRPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + INT = 258, + FLOAT = 259, + STRING = 260, + NSSTRING = 261, + SELECTOR = 262, + CHAR = 263, + NAME = 264, + UNKNOWN_CPP_NAME = 265, + COMPLETE = 266, + TYPENAME = 267, + CLASSNAME = 268, + OBJC_LBRAC = 269, + NAME_OR_INT = 270, + OPERATOR = 271, + STRUCT = 272, + CLASS = 273, + UNION = 274, + ENUM = 275, + SIZEOF = 276, + ALIGNOF = 277, + UNSIGNED = 278, + COLONCOLON = 279, + TEMPLATE = 280, + ERROR = 281, + NEW = 282, + DELETE = 283, + REINTERPRET_CAST = 284, + DYNAMIC_CAST = 285, + STATIC_CAST = 286, + CONST_CAST = 287, + ENTRY = 288, + TYPEOF = 289, + DECLTYPE = 290, + TYPEID = 291, + SIGNED_KEYWORD = 292, + LONG = 293, + SHORT = 294, + INT_KEYWORD = 295, + CONST_KEYWORD = 296, + VOLATILE_KEYWORD = 297, + DOUBLE_KEYWORD = 298, + DOLLAR_VARIABLE = 299, + ASSIGN_MODIFY = 300, + TRUEKEYWORD = 301, + FALSEKEYWORD = 302, + ABOVE_COMMA = 303, + OROR = 304, + ANDAND = 305, + EQUAL = 306, + NOTEQUAL = 307, + LEQ = 308, + GEQ = 309, + LSH = 310, + RSH = 311, + UNARY = 312, + INCREMENT = 313, + DECREMENT = 314, + ARROW = 315, + ARROW_STAR = 316, + DOT_STAR = 317, + BLOCKNAME = 318, + FILENAME = 319, + DOTDOTDOT = 320 + }; +#endif +/* Tokens. */ +#define INT 258 +#define FLOAT 259 +#define STRING 260 +#define NSSTRING 261 +#define SELECTOR 262 +#define CHAR 263 +#define NAME 264 +#define UNKNOWN_CPP_NAME 265 +#define COMPLETE 266 +#define TYPENAME 267 +#define CLASSNAME 268 +#define OBJC_LBRAC 269 +#define NAME_OR_INT 270 +#define OPERATOR 271 +#define STRUCT 272 +#define CLASS 273 +#define UNION 274 +#define ENUM 275 +#define SIZEOF 276 +#define ALIGNOF 277 +#define UNSIGNED 278 +#define COLONCOLON 279 +#define TEMPLATE 280 +#define ERROR 281 +#define NEW 282 +#define DELETE 283 +#define REINTERPRET_CAST 284 +#define DYNAMIC_CAST 285 +#define STATIC_CAST 286 +#define CONST_CAST 287 +#define ENTRY 288 +#define TYPEOF 289 +#define DECLTYPE 290 +#define TYPEID 291 +#define SIGNED_KEYWORD 292 +#define LONG 293 +#define SHORT 294 +#define INT_KEYWORD 295 +#define CONST_KEYWORD 296 +#define VOLATILE_KEYWORD 297 +#define DOUBLE_KEYWORD 298 +#define DOLLAR_VARIABLE 299 +#define ASSIGN_MODIFY 300 +#define TRUEKEYWORD 301 +#define FALSEKEYWORD 302 +#define ABOVE_COMMA 303 +#define OROR 304 +#define ANDAND 305 +#define EQUAL 306 +#define NOTEQUAL 307 +#define LEQ 308 +#define GEQ 309 +#define LSH 310 +#define RSH 311 +#define UNARY 312 +#define INCREMENT 313 +#define DECREMENT 314 +#define ARROW 315 +#define ARROW_STAR 316 +#define DOT_STAR 317 +#define BLOCKNAME 318 +#define FILENAME 319 +#define DOTDOTDOT 320 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE +{ +#line 128 "c-exp.y" /* yacc.c:355 */ + + LONGEST lval; + struct { + LONGEST val; + struct type *type; + } typed_val_int; + struct { + gdb_byte val[16]; + struct type *type; + } typed_val_float; + struct type *tval; + struct stoken sval; + struct typed_stoken tsval; + struct ttype tsym; + struct symtoken ssym; + int voidval; + const struct block *bval; + enum exp_opcode opcode; + + struct stoken_vector svec; + std::vector *tvec; + + struct type_stack *type_stack; + + struct objc_class_str theclass; + + +#line 348 "c-exp.c.tmp" /* yacc.c:355 */ +}; + +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE yylval; + +int yyparse (void); + + + +/* Copy the second part of user declarations. */ +#line 155 "c-exp.y" /* yacc.c:358 */ + +/* YYSTYPE gets defined by %union */ +static int parse_number (struct parser_state *par_state, + const char *, int, int, YYSTYPE *); +static struct stoken operator_stoken (const char *); +static struct stoken typename_stoken (const char *); +static void check_parameter_typelist (std::vector *); +static void write_destructor_name (struct parser_state *par_state, + struct stoken); + +#ifdef YYBISON +static void c_print_token (FILE *file, int type, YYSTYPE value); +#define YYPRINT(FILE, TYPE, VALUE) c_print_token (FILE, TYPE, VALUE) +#endif + +#line 380 "c-exp.c.tmp" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or xmalloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined xmalloc) \ + && (defined YYFREE || defined xfree))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC xmalloc +# if ! defined xmalloc && ! defined EXIT_SUCCESS +void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE xfree +# if ! defined xfree && ! defined EXIT_SUCCESS +void xfree (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 171 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 1732 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 90 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 50 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 275 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 432 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 320 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 84, 2, 2, 2, 70, 56, 2, + 79, 83, 68, 66, 48, 67, 76, 69, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 87, 2, + 59, 50, 60, 51, 65, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 78, 2, 86, 55, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 88, 54, 89, 85, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 49, 52, 53, 57, 58, 61, 62, + 63, 64, 71, 72, 73, 74, 75, 77, 80, 81, + 82 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 273, 273, 274, 277, 281, 285, 291, 298, 299, + 304, 308, 312, 316, 320, 324, 328, 332, 336, 340, + 344, 348, 352, 356, 360, 366, 373, 383, 389, 396, + 404, 408, 414, 421, 431, 437, 444, 452, 456, 460, + 470, 469, 493, 492, 509, 508, 517, 519, 522, 523, + 526, 528, 530, 537, 534, 548, 558, 557, 583, 587, + 590, 594, 598, 617, 628, 635, 636, 639, 647, 650, + 657, 661, 665, 671, 675, 679, 683, 687, 691, 695, + 699, 703, 707, 711, 715, 719, 723, 727, 731, 735, + 739, 743, 747, 751, 755, 762, 769, 778, 791, 798, + 801, 807, 814, 834, 839, 843, 847, 854, 871, 889, + 922, 931, 939, 949, 957, 963, 974, 989, 1007, 1020, + 1044, 1053, 1054, 1082, 1160, 1164, 1165, 1168, 1171, 1172, + 1176, 1177, 1182, 1181, 1185, 1184, 1187, 1189, 1191, 1193, + 1197, 1204, 1206, 1207, 1210, 1212, 1220, 1228, 1235, 1243, + 1245, 1247, 1249, 1253, 1258, 1270, 1284, 1286, 1290, 1294, + 1298, 1302, 1306, 1310, 1314, 1318, 1322, 1326, 1330, 1334, + 1338, 1342, 1346, 1350, 1354, 1358, 1362, 1366, 1370, 1374, + 1378, 1382, 1386, 1390, 1396, 1402, 1405, 1410, 1416, 1419, + 1424, 1430, 1433, 1438, 1444, 1447, 1452, 1458, 1462, 1466, + 1470, 1477, 1481, 1483, 1487, 1488, 1496, 1504, 1515, 1517, + 1526, 1535, 1542, 1543, 1550, 1554, 1555, 1558, 1559, 1562, + 1566, 1568, 1572, 1574, 1576, 1578, 1580, 1582, 1584, 1586, + 1588, 1590, 1592, 1594, 1596, 1598, 1600, 1602, 1604, 1606, + 1608, 1610, 1650, 1652, 1654, 1656, 1658, 1660, 1662, 1664, + 1666, 1668, 1670, 1672, 1674, 1676, 1678, 1680, 1682, 1705, + 1706, 1707, 1708, 1709, 1710, 1711, 1714, 1715, 1716, 1717, + 1718, 1719, 1722, 1723, 1731, 1743 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "NSSTRING", + "SELECTOR", "CHAR", "NAME", "UNKNOWN_CPP_NAME", "COMPLETE", "TYPENAME", + "CLASSNAME", "OBJC_LBRAC", "NAME_OR_INT", "OPERATOR", "STRUCT", "CLASS", + "UNION", "ENUM", "SIZEOF", "ALIGNOF", "UNSIGNED", "COLONCOLON", + "TEMPLATE", "ERROR", "NEW", "DELETE", "REINTERPRET_CAST", "DYNAMIC_CAST", + "STATIC_CAST", "CONST_CAST", "ENTRY", "TYPEOF", "DECLTYPE", "TYPEID", + "SIGNED_KEYWORD", "LONG", "SHORT", "INT_KEYWORD", "CONST_KEYWORD", + "VOLATILE_KEYWORD", "DOUBLE_KEYWORD", "DOLLAR_VARIABLE", "ASSIGN_MODIFY", + "TRUEKEYWORD", "FALSEKEYWORD", "','", "ABOVE_COMMA", "'='", "'?'", + "OROR", "ANDAND", "'|'", "'^'", "'&'", "EQUAL", "NOTEQUAL", "'<'", "'>'", + "LEQ", "GEQ", "LSH", "RSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'", + "UNARY", "INCREMENT", "DECREMENT", "ARROW", "ARROW_STAR", "'.'", + "DOT_STAR", "'['", "'('", "BLOCKNAME", "FILENAME", "DOTDOTDOT", "')'", + "'!'", "'~'", "']'", "':'", "'{'", "'}'", "$accept", "start", "type_exp", + "exp1", "exp", "$@1", "$@2", "$@3", "msglist", "msgarglist", "msgarg", + "$@4", "$@5", "lcurly", "arglist", "function_method", + "function_method_void", "function_method_void_or_typelist", "rcurly", + "string_exp", "block", "variable", "qualified_name", "space_identifier", + "const_or_volatile", "cv_with_space_id", + "const_or_volatile_or_space_identifier_noopt", + "const_or_volatile_or_space_identifier", "ptr_operator", "$@6", "$@7", + "ptr_operator_ts", "abs_decl", "direct_abs_decl", "array_mod", + "func_mod", "type", "typebase", "type_name", "parameter_typelist", + "nonempty_typelist", "ptype", "conversion_type_id", + "conversion_declarator", "const_and_volatile", "const_or_volatile_noopt", + "oper", "field_name", "name", "name_not_typename", YY_NULLPTRPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 44, 303, + 61, 63, 304, 305, 124, 94, 38, 306, 307, 60, + 62, 308, 309, 310, 311, 64, 43, 45, 42, 47, + 37, 312, 313, 314, 315, 316, 46, 317, 91, 40, + 318, 319, 320, 41, 33, 126, 93, 58, 123, 125 +}; +# endif + +#define YYPACT_NINF -226 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-226))) + +#define YYTABLE_NINF -127 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 488, -226, -226, -226, -226, -64, -226, -226, -54, 4, + 660, -226, 907, 139, 243, 254, 271, 746, -27, 182, + 27, 81, -1, 15, 26, 35, -8, 24, 34, 263, + 288, 202, -226, 78, 89, -226, -226, -226, -226, 832, + 832, 832, 832, 832, 832, 488, 114, -226, 832, 832, + -226, 145, -226, 105, 1308, 402, 172, -226, 176, 158, + 177, -226, -226, 141, -226, 1689, -226, 146, 282, -226, + 151, -226, 184, 81, -226, 47, 4, -226, 1308, -226, + 137, 21, 30, -226, -226, -226, -226, -226, -226, -226, + -226, -226, -226, -226, -226, -226, -226, -226, -226, -226, + -226, -226, -226, -226, -226, -226, -226, -226, 143, 148, + -226, -226, 276, -226, -226, -226, -226, -226, -226, -226, + -226, 222, -226, 225, -226, 227, -226, 229, 4, 488, + 216, 1657, -226, 11, 201, -226, -226, -226, -226, -226, + 189, 1657, 1657, 1657, 1657, 574, 832, 488, 86, -226, + -226, 211, 220, 239, -226, -226, 238, 244, -226, -226, + -226, 216, 216, 216, 216, 216, 216, 173, -7, 216, + 216, -226, 832, 832, 832, 832, 832, 832, 832, 832, + 832, 832, 832, 832, 832, 832, 832, 832, 832, 832, + 832, 832, 832, 832, 832, 832, -226, -226, 72, 832, + 234, 832, 832, 1024, 178, 1308, 12, 81, -226, 81, + 289, 118, 146, -226, 3, 48, 231, -226, 14, 1015, + 236, 50, -226, 55, -226, -226, -226, 214, 832, 81, + 281, 38, 38, 38, -226, 223, 235, 241, 250, -226, + -226, 179, -226, -226, -226, -226, -226, 232, 237, 268, + -226, -226, 1689, 262, 264, 270, 277, 1063, 259, 1098, + 265, 1133, 305, -226, -226, -226, 306, 309, -226, -226, + -226, 832, -226, 1308, -25, 1308, 1308, 944, 1374, 1406, + 1431, 1463, 1488, 1520, 1520, 1545, 1545, 1545, 1545, 1560, + 1560, 1577, 1589, 1589, 216, 216, 216, -226, 4, -226, + -226, -226, -226, -226, -226, 81, -226, 341, -226, 65, + -226, 81, -226, 343, 65, -21, 31, 832, -226, 272, + 308, -226, 832, 832, -226, -226, 334, -226, -226, -226, + 283, -226, 236, 236, 146, 287, -226, -226, 279, 280, + -226, 55, 347, -226, -226, -226, -6, -226, 81, 832, + 832, 290, 38, -226, 291, 293, 294, -226, -226, -226, + -226, -226, -226, -226, -226, -226, 314, 296, 298, 302, + 303, -226, -226, -226, -226, -226, -226, -226, -226, 216, + -226, 832, 357, -226, 372, -226, -226, -226, 19, 118, + 1062, 216, 1308, -226, -226, -226, -226, -226, -226, 146, + -226, -226, 1308, 1308, -226, -226, 291, 832, -226, -226, + -226, 832, 832, 832, 832, 1340, -226, -226, -226, -226, + -226, -226, -226, 1308, 1168, 1203, 1238, 1273, -226, -226, + -226, -226 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint16 yydefact[] = +{ + 126, 95, 98, 107, 110, 0, 96, 272, 275, 156, + 0, 97, 126, 0, 0, 0, 0, 0, 0, 198, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 200, + 158, 159, 157, 220, 221, 183, 100, 111, 112, 0, + 0, 0, 0, 0, 0, 126, 273, 114, 0, 0, + 58, 0, 3, 2, 8, 59, 64, 66, 0, 109, + 0, 99, 121, 0, 128, 126, 4, 212, 155, 219, + 129, 274, 123, 0, 56, 0, 40, 42, 44, 156, + 0, 222, 223, 241, 252, 238, 249, 248, 235, 233, + 234, 244, 245, 239, 240, 246, 247, 242, 243, 228, + 229, 230, 231, 232, 250, 251, 254, 253, 0, 0, + 237, 236, 215, 258, 266, 270, 186, 268, 269, 267, + 271, 185, 189, 188, 192, 191, 195, 194, 0, 126, + 22, 126, 204, 206, 207, 205, 197, 275, 273, 122, + 0, 126, 126, 126, 126, 126, 0, 126, 206, 207, + 199, 166, 162, 167, 160, 184, 181, 179, 177, 217, + 218, 11, 13, 12, 10, 16, 17, 0, 0, 14, + 15, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 18, 19, 0, 0, + 0, 0, 0, 53, 0, 60, 0, 0, 108, 0, + 0, 126, 202, 203, 0, 138, 136, 134, 0, 126, + 140, 142, 213, 143, 146, 148, 116, 0, 59, 0, + 118, 0, 0, 0, 257, 0, 0, 0, 0, 256, + 255, 215, 214, 187, 190, 193, 196, 0, 0, 173, + 164, 180, 126, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 171, 163, 165, 161, 175, 170, 168, 182, + 178, 0, 72, 9, 0, 94, 93, 0, 91, 90, + 89, 88, 87, 81, 82, 85, 86, 83, 84, 79, + 80, 73, 77, 78, 74, 75, 76, 26, 268, 265, + 264, 262, 263, 261, 260, 0, 29, 24, 259, 30, + 33, 0, 36, 31, 37, 0, 55, 59, 210, 0, + 208, 68, 0, 0, 69, 67, 117, 124, 127, 125, + 0, 150, 139, 137, 131, 0, 149, 153, 0, 0, + 132, 141, 126, 145, 147, 101, 0, 119, 0, 0, + 0, 0, 47, 48, 46, 0, 0, 226, 224, 227, + 225, 132, 216, 102, 23, 174, 0, 0, 0, 0, + 0, 5, 6, 7, 21, 20, 172, 176, 169, 71, + 39, 0, 27, 25, 34, 32, 38, 63, 0, 126, + 126, 70, 61, 152, 130, 135, 151, 144, 154, 131, + 57, 120, 52, 51, 41, 49, 0, 0, 43, 45, + 201, 0, 0, 0, 0, 92, 28, 35, 54, 62, + 209, 211, 133, 50, 0, 0, 0, 0, 103, 105, + 104, 106 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -226, -226, 66, 13, -10, -226, -226, -226, -34, -226, + 39, -226, -226, -226, -225, -226, -226, -226, 186, -226, + -226, -226, -42, -226, -199, -226, -66, -4, -110, -226, + -226, -226, 174, 175, -219, -218, -105, 10, 365, 195, + -226, -226, -226, 159, -226, -197, -5, 199, 5, 393 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 51, 167, 168, 54, 231, 232, 233, 351, 352, + 353, 317, 228, 55, 206, 56, 57, 58, 322, 59, + 60, 61, 62, 211, 63, 64, 65, 395, 220, 399, + 334, 221, 222, 223, 224, 225, 66, 67, 136, 339, + 320, 68, 113, 242, 69, 70, 71, 307, 354, 72 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int16 yytable[] = +{ + 78, 213, 241, 346, 343, 344, 330, 130, 120, 120, + 120, 120, 328, 53, 329, 73, 120, 335, 121, 123, + 125, 127, 112, 172, 247, 74, 140, 172, 75, 161, + 162, 163, 164, 165, 166, 235, 7, 137, 169, 170, + 258, 172, 323, 12, 237, 205, 213, 114, 115, 249, + 117, 250, 131, 118, 12, -126, 114, 115, 141, 117, + 323, 380, 118, 12, 214, 386, 52, 323, 120, 214, + 120, 145, 33, 34, 142, 212, 272, 400, 227, 173, + 230, 114, 115, 297, 298, 143, 349, 118, 12, 331, + 114, 115, 388, 117, 144, 299, 118, 12, 318, 236, + 336, 321, 418, 146, 216, 332, 333, 138, 238, 300, + 301, 302, 303, 147, 318, 304, 217, 387, 119, 329, + 159, 204, 343, 344, 262, 350, 263, 119, 218, 219, + 160, 241, 229, 218, 342, 257, 259, 261, -113, 198, + 199, 200, 201, 202, 203, 171, 213, 366, 114, 115, + 116, 117, 119, 172, 118, 12, 306, 305, 312, 33, + 34, 119, 273, 208, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 291, 292, 293, 294, 295, 296, 274, 33, 34, 309, + 419, 314, 329, 120, 132, 120, -65, 248, 355, 356, + 207, 209, 120, 308, 120, 308, 210, 253, 254, 255, + 256, -126, 325, 260, 326, 315, -125, 226, 205, 119, + 133, 134, 135, 234, 120, 156, 120, 120, 120, 239, + 173, 240, 215, 243, 347, 216, 244, 318, 245, 157, + 246, 251, 158, 114, 115, 310, 298, 361, 252, 118, + 12, 264, 114, 115, 122, 117, 271, 299, 118, 12, + 265, 379, 266, 114, 115, 124, 117, 321, 394, 118, + 12, 300, 301, 302, 303, 132, 267, 304, 269, 268, + 114, 115, 126, 117, 270, 421, 118, 12, 196, 197, + 198, 199, 200, 201, 202, 203, 214, 345, 327, 217, + 120, 148, 149, 135, 340, 348, 120, 205, 365, 357, + 382, 151, 391, 392, 119, 363, 384, 33, 34, 311, + 364, 358, 367, 119, 368, 152, 153, 359, 154, 215, + 369, 155, 216, 394, 119, 215, 360, 370, 216, 402, + 403, -126, 372, 120, 217, 376, 377, 120, 374, 378, + 217, 119, 383, 401, 385, 389, 390, 406, -115, 79, + 218, 219, 397, 398, 13, 14, 15, 16, 416, 393, + 19, 415, 21, 396, 410, 411, 404, 412, 407, 408, + 409, 413, 414, 417, 29, 30, 31, 32, 33, 34, + 35, 405, 324, 338, 150, 422, 341, 423, 319, 313, + 362, 424, 425, 426, 427, 1, 2, 3, 4, 5, + 6, 7, 8, 139, 9, 0, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 0, 0, + 337, 22, 23, 24, 25, 0, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 0, 37, 38, + 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, + 0, 0, 0, 0, 0, 0, 0, -126, 40, 41, + 42, 0, 0, 0, 43, 44, 0, 0, 0, 0, + 0, 45, 46, 47, 0, 0, 48, 49, 0, 0, + 50, 1, 2, 3, 4, 5, 6, 7, 8, 0, + 9, 0, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 0, 0, 0, 22, 23, 24, + 25, 0, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 0, 37, 38, 0, 0, 0, 0, + 0, 0, 0, 0, 39, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 40, 41, 42, 0, 0, 0, + 43, 44, 0, 0, 0, 0, 0, 45, 46, 47, + 0, 0, 48, 49, 0, 0, 50, 1, 2, 3, + 4, 5, 6, 7, 8, 0, 9, 0, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 0, 0, 0, 22, 23, 24, 25, 0, 0, 0, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 0, + 37, 38, 0, 0, 0, 0, 0, 0, 0, 0, + 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 40, 41, 42, 0, 0, 0, 43, 44, 0, 0, + 0, 0, 0, 45, 46, 47, 0, 0, 48, 49, + 0, 0, 50, 1, 2, 3, 4, 5, 6, 7, + 8, 0, 76, 77, 10, 11, 12, 0, 0, 0, + 0, 17, 18, 0, 20, 0, 0, 0, 0, 22, + 23, 24, 25, 0, 0, 0, 28, 0, 0, 0, + 0, 0, 0, 0, 36, 0, 37, 38, 0, 0, + 0, 0, 0, 0, 0, 0, 39, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 40, 41, 42, 0, + 0, 0, 43, 44, 0, 0, 0, 0, 0, 45, + 46, 47, 0, 0, 48, 49, 0, 0, 50, 1, + 2, 3, 4, 5, 6, 7, 8, 0, 128, 0, + 10, 11, 12, 0, 0, 0, 0, 17, 18, 0, + 20, 0, 0, 0, 0, 22, 23, 24, 25, 0, + 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, + 36, 0, 37, 38, 0, 0, 0, 0, 0, 0, + 0, 0, 39, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 40, 41, 42, 0, 0, 0, 43, 44, + 0, 0, 0, 0, 0, 129, 46, 47, 0, 0, + 48, 49, 0, 0, 50, 1, 2, 3, 4, 5, + 6, 7, 8, 0, 128, 0, 10, 11, 12, 0, + 0, 0, 0, 17, 18, 0, 20, 0, 0, 0, + 0, 22, 23, 24, 25, 0, 0, 0, 28, 0, + 0, 0, 0, 0, 0, 0, 36, 0, 37, 38, + 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 40, 41, + 42, 0, 0, 0, 43, 44, 0, 0, 0, 0, + 0, 45, 46, 47, 0, 0, 48, 49, 0, 79, + 50, 80, 0, 0, 13, 14, 15, 16, 0, 0, + 19, 0, 21, 0, 81, 82, 0, 0, 0, 0, + 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, + 35, 0, 83, 0, 0, 84, 0, 85, 173, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 0, 99, 100, 101, 102, 103, 0, 104, + 105, 106, 107, 0, 0, 108, 109, 0, 0, 174, + 0, 110, 111, 0, 175, 176, 177, 178, 179, 180, + 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 0, 196, 197, 198, 199, + 200, 201, 202, 203, 0, 0, 0, 79, 0, 214, + 0, 381, 13, 14, 15, 16, 79, 0, 19, 0, + 21, 13, 14, 15, 16, 0, 0, 19, 0, 21, + 0, 0, 29, 30, 31, 32, 33, 34, 35, 0, + 0, 29, 30, 31, 32, 33, 34, 35, 215, 0, + 0, 216, 0, 0, 79, 0, 0, 173, 0, 13, + 14, 15, 16, 217, 0, 19, 0, 21, 0, -126, + 0, 0, 0, 218, 219, 0, 0, 0, 337, 29, + 30, 31, 32, 33, 34, 35, 0, 316, 174, 0, + 0, 0, 173, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 0, 196, 197, 198, 199, 200, + 201, 202, 203, 174, 420, 0, 371, 173, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 0, + 196, 197, 198, 199, 200, 201, 202, 203, 174, 0, + 0, 373, 173, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 0, 196, 197, 198, 199, 200, + 201, 202, 203, 174, 0, 0, 375, 173, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 0, + 196, 197, 198, 199, 200, 201, 202, 203, 174, 0, + 0, 428, 173, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 0, 196, 197, 198, 199, 200, + 201, 202, 203, 174, 0, 0, 429, 173, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 0, + 196, 197, 198, 199, 200, 201, 202, 203, 174, 0, + 0, 430, 173, 175, 176, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 0, 196, 197, 198, 199, 200, + 201, 202, 203, 174, 173, 0, 431, 0, 175, 176, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 0, + 196, 197, 198, 199, 200, 201, 202, 203, 173, 0, + 0, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 0, 196, 197, 198, 199, 200, 201, 202, 203, + 173, 0, 0, 0, 0, 0, 0, 178, 179, 180, + 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 173, 196, 197, 198, 199, + 200, 201, 202, 203, 0, 0, 0, 0, 0, 0, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, 195, 173, 196, 197, + 198, 199, 200, 201, 202, 203, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 195, 173, 196, 197, 198, 199, 200, 201, 202, + 203, 0, 0, 0, 0, 0, 0, 0, 0, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, 195, 173, 196, 197, 198, 199, 200, + 201, 202, 203, 0, 0, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, 195, 173, + 196, 197, 198, 199, 200, 201, 202, 203, 0, 0, + 0, 0, 0, 0, 173, 0, 0, 0, 0, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 173, 196, 197, 198, 199, 200, 201, 202, 203, + 0, 0, 0, 173, 0, 0, 0, 0, 188, 189, + 190, 191, 192, 193, 194, 195, 0, 196, 197, 198, + 199, 200, 201, 202, 203, 190, 191, 192, 193, 194, + 195, 0, 196, 197, 198, 199, 200, 201, 202, 203, + 0, 0, 0, 191, 192, 193, 194, 195, 0, 196, + 197, 198, 199, 200, 201, 202, 203, 193, 194, 195, + 0, 196, 197, 198, 199, 200, 201, 202, 203, 79, + 0, 0, 0, 0, 13, 14, 15, 16, 0, 0, + 19, 0, 21, 0, 0, 0, 0, 0, 0, 0, + 0, 26, 27, 0, 29, 30, 31, 32, 33, 34, + 35, 79, 0, 0, 0, 0, 13, 14, 15, 16, + 0, 0, 19, 0, 21, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, + 33, 34, 35 +}; + +static const yytype_int16 yycheck[] = +{ + 10, 67, 112, 228, 223, 223, 3, 17, 13, 14, + 15, 16, 211, 0, 211, 79, 21, 3, 13, 14, + 15, 16, 12, 48, 129, 79, 21, 48, 24, 39, + 40, 41, 42, 43, 44, 14, 9, 10, 48, 49, + 145, 48, 48, 16, 14, 55, 112, 9, 10, 38, + 12, 40, 79, 15, 16, 24, 9, 10, 59, 12, + 48, 86, 15, 16, 14, 86, 0, 48, 73, 14, + 75, 79, 41, 42, 59, 65, 83, 83, 73, 14, + 75, 9, 10, 11, 12, 59, 48, 15, 16, 86, + 9, 10, 317, 12, 59, 23, 15, 16, 203, 78, + 86, 89, 83, 79, 56, 215, 216, 80, 78, 37, + 38, 39, 40, 79, 219, 43, 68, 316, 80, 316, + 42, 55, 341, 341, 38, 87, 40, 80, 78, 79, + 41, 241, 85, 78, 79, 145, 146, 147, 24, 74, + 75, 76, 77, 78, 79, 0, 212, 252, 9, 10, + 11, 12, 80, 48, 15, 16, 198, 85, 200, 41, + 42, 80, 172, 5, 174, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 173, 41, 42, 199, + 389, 201, 389, 198, 12, 200, 24, 131, 232, 233, + 24, 24, 207, 198, 209, 200, 65, 141, 142, 143, + 144, 65, 207, 147, 209, 202, 65, 33, 228, 80, + 38, 39, 40, 86, 229, 23, 231, 232, 233, 86, + 14, 83, 53, 11, 229, 56, 11, 342, 11, 37, + 11, 40, 40, 9, 10, 11, 12, 68, 59, 15, + 16, 40, 9, 10, 11, 12, 83, 23, 15, 16, + 40, 271, 23, 9, 10, 11, 12, 89, 334, 15, + 16, 37, 38, 39, 40, 12, 37, 43, 40, 40, + 9, 10, 11, 12, 40, 390, 15, 16, 72, 73, + 74, 75, 76, 77, 78, 79, 14, 83, 9, 68, + 305, 38, 39, 40, 68, 24, 311, 317, 40, 86, + 305, 23, 322, 323, 80, 83, 311, 41, 42, 85, + 83, 86, 60, 80, 60, 37, 38, 86, 40, 53, + 60, 43, 56, 399, 80, 53, 86, 60, 56, 349, + 350, 65, 83, 348, 68, 40, 40, 352, 83, 40, + 68, 80, 11, 348, 11, 83, 48, 352, 24, 12, + 78, 79, 83, 83, 17, 18, 19, 20, 11, 86, + 23, 381, 25, 86, 60, 79, 86, 79, 87, 86, + 86, 79, 79, 11, 37, 38, 39, 40, 41, 42, + 43, 352, 206, 219, 29, 399, 221, 407, 203, 200, + 241, 411, 412, 413, 414, 3, 4, 5, 6, 7, + 8, 9, 10, 20, 12, -1, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, + 83, 29, 30, 31, 32, -1, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, -1, 46, 47, + -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, + -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, + 68, -1, -1, -1, 72, 73, -1, -1, -1, -1, + -1, 79, 80, 81, -1, -1, 84, 85, -1, -1, + 88, 3, 4, 5, 6, 7, 8, 9, 10, -1, + 12, -1, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, -1, -1, -1, 29, 30, 31, + 32, -1, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, -1, 46, 47, -1, -1, -1, -1, + -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 66, 67, 68, -1, -1, -1, + 72, 73, -1, -1, -1, -1, -1, 79, 80, 81, + -1, -1, 84, 85, -1, -1, 88, 3, 4, 5, + 6, 7, 8, 9, 10, -1, 12, -1, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, + 36, 37, 38, 39, 40, 41, 42, 43, 44, -1, + 46, 47, -1, -1, -1, -1, -1, -1, -1, -1, + 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 66, 67, 68, -1, -1, -1, 72, 73, -1, -1, + -1, -1, -1, 79, 80, 81, -1, -1, 84, 85, + -1, -1, 88, 3, 4, 5, 6, 7, 8, 9, + 10, -1, 12, 13, 14, 15, 16, -1, -1, -1, + -1, 21, 22, -1, 24, -1, -1, -1, -1, 29, + 30, 31, 32, -1, -1, -1, 36, -1, -1, -1, + -1, -1, -1, -1, 44, -1, 46, 47, -1, -1, + -1, -1, -1, -1, -1, -1, 56, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 66, 67, 68, -1, + -1, -1, 72, 73, -1, -1, -1, -1, -1, 79, + 80, 81, -1, -1, 84, 85, -1, -1, 88, 3, + 4, 5, 6, 7, 8, 9, 10, -1, 12, -1, + 14, 15, 16, -1, -1, -1, -1, 21, 22, -1, + 24, -1, -1, -1, -1, 29, 30, 31, 32, -1, + -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, + 44, -1, 46, 47, -1, -1, -1, -1, -1, -1, + -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 66, 67, 68, -1, -1, -1, 72, 73, + -1, -1, -1, -1, -1, 79, 80, 81, -1, -1, + 84, 85, -1, -1, 88, 3, 4, 5, 6, 7, + 8, 9, 10, -1, 12, -1, 14, 15, 16, -1, + -1, -1, -1, 21, 22, -1, 24, -1, -1, -1, + -1, 29, 30, 31, 32, -1, -1, -1, 36, -1, + -1, -1, -1, -1, -1, -1, 44, -1, 46, 47, + -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 66, 67, + 68, -1, -1, -1, 72, 73, -1, -1, -1, -1, + -1, 79, 80, 81, -1, -1, 84, 85, -1, 12, + 88, 14, -1, -1, 17, 18, 19, 20, -1, -1, + 23, -1, 25, -1, 27, 28, -1, -1, -1, -1, + -1, -1, -1, -1, 37, 38, 39, 40, 41, 42, + 43, -1, 45, -1, -1, 48, -1, 50, 14, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, -1, 66, 67, 68, 69, 70, -1, 72, + 73, 74, 75, -1, -1, 78, 79, -1, -1, 45, + -1, 84, 85, -1, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, -1, 72, 73, 74, 75, + 76, 77, 78, 79, -1, -1, -1, 12, -1, 14, + -1, 87, 17, 18, 19, 20, 12, -1, 23, -1, + 25, 17, 18, 19, 20, -1, -1, 23, -1, 25, + -1, -1, 37, 38, 39, 40, 41, 42, 43, -1, + -1, 37, 38, 39, 40, 41, 42, 43, 53, -1, + -1, 56, -1, -1, 12, -1, -1, 14, -1, 17, + 18, 19, 20, 68, -1, 23, -1, 25, -1, 65, + -1, -1, -1, 78, 79, -1, -1, -1, 83, 37, + 38, 39, 40, 41, 42, 43, -1, 83, 45, -1, + -1, -1, 14, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, + 77, 78, 79, 45, 82, -1, 83, 14, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, -1, + 72, 73, 74, 75, 76, 77, 78, 79, 45, -1, + -1, 83, 14, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, + 77, 78, 79, 45, -1, -1, 83, 14, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, -1, + 72, 73, 74, 75, 76, 77, 78, 79, 45, -1, + -1, 83, 14, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, + 77, 78, 79, 45, -1, -1, 83, 14, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, -1, + 72, 73, 74, 75, 76, 77, 78, 79, 45, -1, + -1, 83, 14, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, -1, 72, 73, 74, 75, 76, + 77, 78, 79, 45, 14, -1, 83, -1, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, -1, + 72, 73, 74, 75, 76, 77, 78, 79, 14, -1, + -1, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, -1, 72, 73, 74, 75, 76, 77, 78, 79, + 14, -1, -1, -1, -1, -1, -1, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 14, 72, 73, 74, 75, + 76, 77, 78, 79, -1, -1, -1, -1, -1, -1, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 14, 72, 73, + 74, 75, 76, 77, 78, 79, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 14, 72, 73, 74, 75, 76, 77, 78, + 79, -1, -1, -1, -1, -1, -1, -1, -1, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 14, 72, 73, 74, 75, 76, + 77, 78, 79, -1, -1, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 14, + 72, 73, 74, 75, 76, 77, 78, 79, -1, -1, + -1, -1, -1, -1, 14, -1, -1, -1, -1, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 14, 72, 73, 74, 75, 76, 77, 78, 79, + -1, -1, -1, 14, -1, -1, -1, -1, 63, 64, + 65, 66, 67, 68, 69, 70, -1, 72, 73, 74, + 75, 76, 77, 78, 79, 65, 66, 67, 68, 69, + 70, -1, 72, 73, 74, 75, 76, 77, 78, 79, + -1, -1, -1, 66, 67, 68, 69, 70, -1, 72, + 73, 74, 75, 76, 77, 78, 79, 68, 69, 70, + -1, 72, 73, 74, 75, 76, 77, 78, 79, 12, + -1, -1, -1, -1, 17, 18, 19, 20, -1, -1, + 23, -1, 25, -1, -1, -1, -1, -1, -1, -1, + -1, 34, 35, -1, 37, 38, 39, 40, 41, 42, + 43, 12, -1, -1, -1, -1, 17, 18, 19, 20, + -1, -1, 23, -1, 25, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 37, 38, 39, 40, + 41, 42, 43 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 4, 5, 6, 7, 8, 9, 10, 12, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 29, 30, 31, 32, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 46, 47, 56, + 66, 67, 68, 72, 73, 79, 80, 81, 84, 85, + 88, 91, 92, 93, 94, 103, 105, 106, 107, 109, + 110, 111, 112, 114, 115, 116, 126, 127, 131, 134, + 135, 136, 139, 79, 79, 24, 12, 13, 94, 12, + 14, 27, 28, 45, 48, 50, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, + 67, 68, 69, 70, 72, 73, 74, 75, 78, 79, + 84, 85, 127, 132, 9, 10, 11, 12, 15, 80, + 136, 138, 11, 138, 11, 138, 11, 138, 12, 79, + 94, 79, 12, 38, 39, 40, 128, 10, 80, 139, + 138, 59, 59, 59, 59, 79, 79, 79, 38, 39, + 128, 23, 37, 38, 40, 43, 23, 37, 40, 42, + 41, 94, 94, 94, 94, 94, 94, 92, 93, 94, + 94, 0, 48, 14, 45, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, + 76, 77, 78, 79, 92, 94, 104, 24, 5, 24, + 65, 113, 127, 116, 14, 53, 56, 68, 78, 79, + 118, 121, 122, 123, 124, 125, 33, 138, 102, 85, + 138, 95, 96, 97, 86, 14, 78, 14, 78, 86, + 83, 118, 133, 11, 11, 11, 11, 126, 92, 38, + 40, 40, 59, 92, 92, 92, 92, 94, 126, 94, + 92, 94, 38, 40, 40, 40, 23, 37, 40, 40, + 40, 83, 83, 94, 93, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 11, 12, 23, + 37, 38, 39, 40, 43, 85, 112, 137, 138, 94, + 11, 85, 112, 137, 94, 93, 83, 101, 126, 129, + 130, 89, 108, 48, 108, 138, 138, 9, 114, 135, + 3, 86, 118, 118, 120, 3, 86, 83, 122, 129, + 68, 123, 79, 124, 125, 83, 104, 138, 24, 48, + 87, 98, 99, 100, 138, 98, 98, 86, 86, 86, + 86, 68, 133, 83, 83, 40, 126, 60, 60, 60, + 60, 83, 83, 83, 83, 83, 40, 40, 40, 94, + 86, 87, 138, 11, 138, 11, 86, 114, 104, 83, + 48, 94, 94, 86, 116, 117, 86, 83, 83, 119, + 83, 138, 94, 94, 86, 100, 138, 87, 86, 86, + 60, 79, 79, 79, 79, 94, 11, 11, 83, 114, + 82, 126, 117, 94, 94, 94, 94, 94, 83, 83, + 83, 83 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 90, 91, 91, 92, 92, 92, 92, 93, 93, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 95, 94, 96, 94, 97, 94, 98, 98, 99, 99, + 100, 100, 100, 101, 94, 94, 102, 94, 103, 104, + 104, 104, 105, 106, 94, 107, 107, 94, 108, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 109, 109, 94, + 94, 94, 94, 110, 110, 110, 111, 111, 112, 112, + 112, 111, 111, 111, 113, 114, 114, 115, 116, 116, + 117, 117, 119, 118, 120, 118, 118, 118, 118, 118, + 121, 122, 122, 122, 123, 123, 123, 123, 123, 124, + 124, 124, 124, 125, 125, 126, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 128, 128, 128, 128, 129, 129, + 130, 130, 131, 131, 132, 133, 133, 134, 134, 135, + 135, 135, 136, 136, 136, 136, 136, 136, 136, 136, + 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, + 136, 136, 136, 136, 136, 136, 136, 136, 136, 136, + 136, 136, 136, 136, 136, 136, 136, 136, 136, 137, + 137, 137, 137, 137, 137, 137, 138, 138, 138, 138, + 138, 138, 139, 139, 139, 139 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 4, 4, 4, 1, 3, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 4, 4, 2, 4, 3, 4, 3, 4, 5, 3, + 3, 3, 4, 3, 4, 5, 3, 3, 4, 4, + 0, 5, 0, 5, 0, 5, 1, 1, 1, 2, + 3, 2, 2, 0, 5, 3, 0, 5, 1, 0, + 1, 3, 5, 4, 1, 1, 1, 3, 1, 3, + 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 5, 3, 3, 1, 1, 1, 1, 1, + 1, 4, 4, 7, 7, 7, 7, 1, 2, 1, + 1, 1, 1, 1, 1, 3, 2, 3, 3, 4, + 5, 1, 2, 1, 2, 1, 0, 3, 1, 1, + 1, 0, 0, 4, 0, 3, 1, 2, 1, 2, + 1, 2, 1, 1, 3, 2, 1, 2, 1, 2, + 2, 3, 3, 2, 3, 1, 1, 1, 1, 1, + 2, 3, 2, 3, 3, 3, 2, 2, 3, 4, + 3, 3, 4, 3, 4, 3, 4, 2, 3, 2, + 3, 2, 3, 1, 2, 2, 2, 3, 2, 2, + 3, 2, 2, 3, 2, 2, 3, 2, 1, 2, + 1, 5, 2, 2, 1, 1, 1, 1, 1, 3, + 1, 3, 1, 2, 2, 0, 2, 2, 2, 1, + 1, 1, 2, 2, 4, 4, 4, 4, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 3, 3, 3, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTRPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTRPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTRPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +{ + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to xreallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to xreallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: +#line 278 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode(pstate, OP_TYPE); + write_exp_elt_type(pstate, (yyvsp[0].tval)); + write_exp_elt_opcode(pstate, OP_TYPE);} +#line 2050 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 5: +#line 282 "c-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_TYPEOF); + } +#line 2058 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 6: +#line 286 "c-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_TYPE); + write_exp_elt_type (pstate, (yyvsp[-1].tval)); + write_exp_elt_opcode (pstate, OP_TYPE); + } +#line 2068 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 7: +#line 292 "c-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_DECLTYPE); + } +#line 2076 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 9: +#line 300 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_COMMA); } +#line 2082 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 10: +#line 305 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_IND); } +#line 2088 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 11: +#line 309 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ADDR); } +#line 2094 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 12: +#line 313 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_NEG); } +#line 2100 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 13: +#line 317 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PLUS); } +#line 2106 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 14: +#line 321 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); } +#line 2112 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 15: +#line 325 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_COMPLEMENT); } +#line 2118 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 16: +#line 329 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PREINCREMENT); } +#line 2124 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 17: +#line 333 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PREDECREMENT); } +#line 2130 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 18: +#line 337 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_POSTINCREMENT); } +#line 2136 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 19: +#line 341 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_POSTDECREMENT); } +#line 2142 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 20: +#line 345 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_TYPEID); } +#line 2148 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 21: +#line 349 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_TYPEID); } +#line 2154 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 22: +#line 353 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_SIZEOF); } +#line 2160 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 23: +#line 357 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ALIGNOF); } +#line 2166 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 24: +#line 361 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_PTR); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); } +#line 2174 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 25: +#line 367 "c-exp.y" /* yacc.c:1646 */ + { mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); + write_exp_string (pstate, (yyvsp[-1].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); } +#line 2183 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 26: +#line 374 "c-exp.y" /* yacc.c:1646 */ + { struct stoken s; + mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); + s.ptr = ""; + s.length = 0; + write_exp_string (pstate, s); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); } +#line 2195 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 27: +#line 384 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_PTR); + write_destructor_name (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); } +#line 2203 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 28: +#line 390 "c-exp.y" /* yacc.c:1646 */ + { mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); + write_destructor_name (pstate, (yyvsp[-1].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); } +#line 2212 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 29: +#line 397 "c-exp.y" /* yacc.c:1646 */ + { /* exp->type::name becomes exp->*(&type::name) */ + /* Note: this doesn't work if name is a + static member! FIXME */ + write_exp_elt_opcode (pstate, UNOP_ADDR); + write_exp_elt_opcode (pstate, STRUCTOP_MPTR); } +#line 2222 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 30: +#line 405 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_MPTR); } +#line 2228 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 31: +#line 409 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 2236 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 32: +#line 415 "c-exp.y" /* yacc.c:1646 */ + { mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, (yyvsp[-1].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 2245 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 33: +#line 422 "c-exp.y" /* yacc.c:1646 */ + { struct stoken s; + mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + s.ptr = ""; + s.length = 0; + write_exp_string (pstate, s); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 2257 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 34: +#line 432 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_destructor_name (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 2265 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 35: +#line 438 "c-exp.y" /* yacc.c:1646 */ + { mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_destructor_name (pstate, (yyvsp[-1].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 2274 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 36: +#line 445 "c-exp.y" /* yacc.c:1646 */ + { /* exp.type::name becomes exp.*(&type::name) */ + /* Note: this doesn't work if name is a + static member! FIXME */ + write_exp_elt_opcode (pstate, UNOP_ADDR); + write_exp_elt_opcode (pstate, STRUCTOP_MEMBER); } +#line 2284 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 37: +#line 453 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_MEMBER); } +#line 2290 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 38: +#line 457 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); } +#line 2296 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 39: +#line 461 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); } +#line 2302 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 40: +#line 470 "c-exp.y" /* yacc.c:1646 */ + { + CORE_ADDR theclass; + + theclass = lookup_objc_class (parse_gdbarch (pstate), + copy_name ((yyvsp[0].tsym).stoken)); + if (theclass == 0) + error (_("%s is not an ObjC Class"), + copy_name ((yyvsp[0].tsym).stoken)); + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_type (pstate)->builtin_int); + write_exp_elt_longcst (pstate, (LONGEST) theclass); + write_exp_elt_opcode (pstate, OP_LONG); + start_msglist(); + } +#line 2322 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 41: +#line 486 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_OBJC_MSGCALL); + end_msglist (pstate); + write_exp_elt_opcode (pstate, OP_OBJC_MSGCALL); + } +#line 2331 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 42: +#line 493 "c-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_type (pstate)->builtin_int); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].theclass).theclass); + write_exp_elt_opcode (pstate, OP_LONG); + start_msglist(); + } +#line 2344 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 43: +#line 502 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_OBJC_MSGCALL); + end_msglist (pstate); + write_exp_elt_opcode (pstate, OP_OBJC_MSGCALL); + } +#line 2353 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 44: +#line 509 "c-exp.y" /* yacc.c:1646 */ + { start_msglist(); } +#line 2359 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 45: +#line 511 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_OBJC_MSGCALL); + end_msglist (pstate); + write_exp_elt_opcode (pstate, OP_OBJC_MSGCALL); + } +#line 2368 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 46: +#line 518 "c-exp.y" /* yacc.c:1646 */ + { add_msglist(&(yyvsp[0].sval), 0); } +#line 2374 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 50: +#line 527 "c-exp.y" /* yacc.c:1646 */ + { add_msglist(&(yyvsp[-2].sval), 1); } +#line 2380 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 51: +#line 529 "c-exp.y" /* yacc.c:1646 */ + { add_msglist(0, 1); } +#line 2386 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 52: +#line 531 "c-exp.y" /* yacc.c:1646 */ + { add_msglist(0, 0); } +#line 2392 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 53: +#line 537 "c-exp.y" /* yacc.c:1646 */ + { start_arglist (); } +#line 2398 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 54: +#line 539 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FUNCALL); + write_exp_elt_longcst (pstate, + (LONGEST) end_arglist ()); + write_exp_elt_opcode (pstate, OP_FUNCALL); } +#line 2407 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 55: +#line 549 "c-exp.y" /* yacc.c:1646 */ + { start_arglist (); + write_exp_elt_opcode (pstate, OP_FUNCALL); + write_exp_elt_longcst (pstate, + (LONGEST) end_arglist ()); + write_exp_elt_opcode (pstate, OP_FUNCALL); } +#line 2417 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 56: +#line 558 "c-exp.y" /* yacc.c:1646 */ + { + /* This could potentially be a an argument defined + lookup function (Koenig). */ + write_exp_elt_opcode (pstate, OP_ADL_FUNC); + write_exp_elt_block (pstate, + expression_context_block); + write_exp_elt_sym (pstate, + NULL); /* Placeholder. */ + write_exp_string (pstate, (yyvsp[-1].ssym).stoken); + write_exp_elt_opcode (pstate, OP_ADL_FUNC); + + /* This is to save the value of arglist_len + being accumulated by an outer function call. */ + + start_arglist (); + } +#line 2438 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 57: +#line 575 "c-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_FUNCALL); + write_exp_elt_longcst (pstate, + (LONGEST) end_arglist ()); + write_exp_elt_opcode (pstate, OP_FUNCALL); + } +#line 2449 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 58: +#line 584 "c-exp.y" /* yacc.c:1646 */ + { start_arglist (); } +#line 2455 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 60: +#line 591 "c-exp.y" /* yacc.c:1646 */ + { arglist_len = 1; } +#line 2461 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 61: +#line 595 "c-exp.y" /* yacc.c:1646 */ + { arglist_len++; } +#line 2467 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 62: +#line 599 "c-exp.y" /* yacc.c:1646 */ + { + std::vector *type_list = (yyvsp[-2].tvec); + LONGEST len = type_list->size (); + + write_exp_elt_opcode (pstate, TYPE_INSTANCE); + /* Save the const/volatile qualifiers as + recorded by the const_or_volatile + production's actions. */ + write_exp_elt_longcst (pstate, + follow_type_instance_flags ()); + write_exp_elt_longcst (pstate, len); + for (type *type_elt : *type_list) + write_exp_elt_type (pstate, type_elt); + write_exp_elt_longcst(pstate, len); + write_exp_elt_opcode (pstate, TYPE_INSTANCE); + } +#line 2488 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 63: +#line 618 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, TYPE_INSTANCE); + /* See above. */ + write_exp_elt_longcst (pstate, + follow_type_instance_flags ()); + write_exp_elt_longcst (pstate, 0); + write_exp_elt_longcst (pstate, 0); + write_exp_elt_opcode (pstate, TYPE_INSTANCE); + } +#line 2501 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 67: +#line 640 "c-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_FUNC_STATIC_VAR); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, OP_FUNC_STATIC_VAR); + } +#line 2511 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 68: +#line 648 "c-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = end_arglist () - 1; } +#line 2517 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 69: +#line 651 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_ARRAY); + write_exp_elt_longcst (pstate, (LONGEST) 0); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval)); + write_exp_elt_opcode (pstate, OP_ARRAY); } +#line 2526 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 70: +#line 658 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_MEMVAL_TYPE); } +#line 2532 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 71: +#line 662 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_CAST_TYPE); } +#line 2538 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 72: +#line 666 "c-exp.y" /* yacc.c:1646 */ + { } +#line 2544 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 73: +#line 672 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_REPEAT); } +#line 2550 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 74: +#line 676 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_MUL); } +#line 2556 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 75: +#line 680 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_DIV); } +#line 2562 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 76: +#line 684 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_REM); } +#line 2568 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 77: +#line 688 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ADD); } +#line 2574 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 78: +#line 692 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUB); } +#line 2580 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 79: +#line 696 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LSH); } +#line 2586 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 80: +#line 700 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_RSH); } +#line 2592 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 81: +#line 704 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_EQUAL); } +#line 2598 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 82: +#line 708 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); } +#line 2604 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 83: +#line 712 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LEQ); } +#line 2610 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 84: +#line 716 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GEQ); } +#line 2616 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 85: +#line 720 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LESS); } +#line 2622 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 86: +#line 724 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GTR); } +#line 2628 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 87: +#line 728 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); } +#line 2634 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 88: +#line 732 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); } +#line 2640 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 89: +#line 736 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); } +#line 2646 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 90: +#line 740 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); } +#line 2652 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 91: +#line 744 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); } +#line 2658 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 92: +#line 748 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, TERNOP_COND); } +#line 2664 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 93: +#line 752 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN); } +#line 2670 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 94: +#line 756 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); + write_exp_elt_opcode (pstate, (yyvsp[-1].opcode)); + write_exp_elt_opcode (pstate, + BINOP_ASSIGN_MODIFY); } +#line 2679 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 95: +#line 763 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, (yyvsp[0].typed_val_int).type); + write_exp_elt_longcst (pstate, (LONGEST) ((yyvsp[0].typed_val_int).val)); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 2688 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 96: +#line 770 "c-exp.y" /* yacc.c:1646 */ + { + struct stoken_vector vec; + vec.len = 1; + vec.tokens = &(yyvsp[0].tsval); + write_exp_string_vector (pstate, (yyvsp[0].tsval).type, &vec); + } +#line 2699 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 97: +#line 779 "c-exp.y" /* yacc.c:1646 */ + { YYSTYPE val; + parse_number (pstate, (yyvsp[0].ssym).stoken.ptr, + (yyvsp[0].ssym).stoken.length, 0, &val); + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, val.typed_val_int.type); + write_exp_elt_longcst (pstate, + (LONGEST) val.typed_val_int.val); + write_exp_elt_opcode (pstate, OP_LONG); + } +#line 2713 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 98: +#line 792 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FLOAT); + write_exp_elt_type (pstate, (yyvsp[0].typed_val_float).type); + write_exp_elt_floatcst (pstate, (yyvsp[0].typed_val_float).val); + write_exp_elt_opcode (pstate, OP_FLOAT); } +#line 2722 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 100: +#line 802 "c-exp.y" /* yacc.c:1646 */ + { + write_dollar_variable (pstate, (yyvsp[0].sval)); + } +#line 2730 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 101: +#line 808 "c-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_OBJC_SELECTOR); + write_exp_string (pstate, (yyvsp[-1].sval)); + write_exp_elt_opcode (pstate, OP_OBJC_SELECTOR); } +#line 2739 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 102: +#line 815 "c-exp.y" /* yacc.c:1646 */ + { struct type *type = (yyvsp[-1].tval); + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, lookup_signed_typename + (parse_language (pstate), + parse_gdbarch (pstate), + "int")); + type = check_typedef (type); + + /* $5.3.3/2 of the C++ Standard (n3290 draft) + says of sizeof: "When applied to a reference + or a reference type, the result is the size of + the referenced type." */ + if (TYPE_IS_REFERENCE (type)) + type = check_typedef (TYPE_TARGET_TYPE (type)); + write_exp_elt_longcst (pstate, + (LONGEST) TYPE_LENGTH (type)); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 2761 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 103: +#line 835 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, + UNOP_REINTERPRET_CAST); } +#line 2768 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 104: +#line 840 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_CAST_TYPE); } +#line 2774 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 105: +#line 844 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_DYNAMIC_CAST); } +#line 2780 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 106: +#line 848 "c-exp.y" /* yacc.c:1646 */ + { /* We could do more error checking here, but + it doesn't seem worthwhile. */ + write_exp_elt_opcode (pstate, UNOP_CAST_TYPE); } +#line 2788 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 107: +#line 855 "c-exp.y" /* yacc.c:1646 */ + { + /* We copy the string here, and not in the + lexer, to guarantee that we do not leak a + string. Note that we follow the + NUL-termination convention of the + lexer. */ + struct typed_stoken *vec = XNEW (struct typed_stoken); + (yyval.svec).len = 1; + (yyval.svec).tokens = vec; + + vec->type = (yyvsp[0].tsval).type; + vec->length = (yyvsp[0].tsval).length; + vec->ptr = (char *) xmalloc ((yyvsp[0].tsval).length + 1); + memcpy (vec->ptr, (yyvsp[0].tsval).ptr, (yyvsp[0].tsval).length + 1); + } +#line 2808 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 108: +#line 872 "c-exp.y" /* yacc.c:1646 */ + { + /* Note that we NUL-terminate here, but just + for convenience. */ + char *p; + ++(yyval.svec).len; + (yyval.svec).tokens = XRESIZEVEC (struct typed_stoken, + (yyval.svec).tokens, (yyval.svec).len); + + p = (char *) xmalloc ((yyvsp[0].tsval).length + 1); + memcpy (p, (yyvsp[0].tsval).ptr, (yyvsp[0].tsval).length + 1); + + (yyval.svec).tokens[(yyval.svec).len - 1].type = (yyvsp[0].tsval).type; + (yyval.svec).tokens[(yyval.svec).len - 1].length = (yyvsp[0].tsval).length; + (yyval.svec).tokens[(yyval.svec).len - 1].ptr = p; + } +#line 2828 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 109: +#line 890 "c-exp.y" /* yacc.c:1646 */ + { + int i; + c_string_type type = C_STRING; + + for (i = 0; i < (yyvsp[0].svec).len; ++i) + { + switch ((yyvsp[0].svec).tokens[i].type) + { + case C_STRING: + break; + case C_WIDE_STRING: + case C_STRING_16: + case C_STRING_32: + if (type != C_STRING + && type != (yyvsp[0].svec).tokens[i].type) + error (_("Undefined string concatenation.")); + type = (enum c_string_type_values) (yyvsp[0].svec).tokens[i].type; + break; + default: + /* internal error */ + internal_error (__FILE__, __LINE__, + "unrecognized type in string concatenation"); + } + } + + write_exp_string_vector (pstate, type, &(yyvsp[0].svec)); + for (i = 0; i < (yyvsp[0].svec).len; ++i) + xfree ((yyvsp[0].svec).tokens[i].ptr); + xfree ((yyvsp[0].svec).tokens); + } +#line 2863 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 110: +#line 925 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_OBJC_NSSTRING); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, OP_OBJC_NSSTRING); } +#line 2871 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 111: +#line 932 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_type (pstate)->builtin_bool); + write_exp_elt_longcst (pstate, (LONGEST) 1); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 2881 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 112: +#line 940 "c-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_type (pstate)->builtin_bool); + write_exp_elt_longcst (pstate, (LONGEST) 0); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 2891 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 113: +#line 950 "c-exp.y" /* yacc.c:1646 */ + { + if ((yyvsp[0].ssym).sym.symbol) + (yyval.bval) = SYMBOL_BLOCK_VALUE ((yyvsp[0].ssym).sym.symbol); + else + error (_("No file or function \"%s\"."), + copy_name ((yyvsp[0].ssym).stoken)); + } +#line 2903 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 114: +#line 958 "c-exp.y" /* yacc.c:1646 */ + { + (yyval.bval) = (yyvsp[0].bval); + } +#line 2911 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 115: +#line 964 "c-exp.y" /* yacc.c:1646 */ + { struct symbol *tem + = lookup_symbol (copy_name ((yyvsp[0].sval)), (yyvsp[-2].bval), + VAR_DOMAIN, NULL).symbol; + + if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) + error (_("No function \"%s\" in specified context."), + copy_name ((yyvsp[0].sval))); + (yyval.bval) = SYMBOL_BLOCK_VALUE (tem); } +#line 2924 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 116: +#line 975 "c-exp.y" /* yacc.c:1646 */ + { struct symbol *sym = (yyvsp[-1].ssym).sym.symbol; + + if (sym == NULL || !SYMBOL_IS_ARGUMENT (sym) + || !symbol_read_needs_frame (sym)) + error (_("@entry can be used only for function " + "parameters, not for \"%s\""), + copy_name ((yyvsp[-1].ssym).stoken)); + + write_exp_elt_opcode (pstate, OP_VAR_ENTRY_VALUE); + write_exp_elt_sym (pstate, sym); + write_exp_elt_opcode (pstate, OP_VAR_ENTRY_VALUE); + } +#line 2941 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 117: +#line 990 "c-exp.y" /* yacc.c:1646 */ + { struct block_symbol sym + = lookup_symbol (copy_name ((yyvsp[0].sval)), (yyvsp[-2].bval), + VAR_DOMAIN, NULL); + + if (sym.symbol == 0) + error (_("No symbol \"%s\" in specified context."), + copy_name ((yyvsp[0].sval))); + if (symbol_read_needs_frame (sym.symbol)) + + innermost_block.update (sym); + + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, sym.block); + write_exp_elt_sym (pstate, sym.symbol); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); } +#line 2961 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 118: +#line 1008 "c-exp.y" /* yacc.c:1646 */ + { + struct type *type = (yyvsp[-2].tsym).type; + type = check_typedef (type); + if (!type_aggregate_p (type)) + error (_("`%s' is not defined as an aggregate type."), + TYPE_SAFE_NAME (type)); + + write_exp_elt_opcode (pstate, OP_SCOPE); + write_exp_elt_type (pstate, type); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, OP_SCOPE); + } +#line 2978 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 119: +#line 1021 "c-exp.y" /* yacc.c:1646 */ + { + struct type *type = (yyvsp[-3].tsym).type; + struct stoken tmp_token; + char *buf; + + type = check_typedef (type); + if (!type_aggregate_p (type)) + error (_("`%s' is not defined as an aggregate type."), + TYPE_SAFE_NAME (type)); + buf = (char *) alloca ((yyvsp[0].sval).length + 2); + tmp_token.ptr = buf; + tmp_token.length = (yyvsp[0].sval).length + 1; + buf[0] = '~'; + memcpy (buf+1, (yyvsp[0].sval).ptr, (yyvsp[0].sval).length); + buf[tmp_token.length] = 0; + + /* Check for valid destructor name. */ + destructor_name_p (tmp_token.ptr, (yyvsp[-3].tsym).type); + write_exp_elt_opcode (pstate, OP_SCOPE); + write_exp_elt_type (pstate, type); + write_exp_string (pstate, tmp_token); + write_exp_elt_opcode (pstate, OP_SCOPE); + } +#line 3006 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 120: +#line 1045 "c-exp.y" /* yacc.c:1646 */ + { + char *copy = copy_name ((yyvsp[-2].sval)); + error (_("No type \"%s\" within class " + "or namespace \"%s\"."), + copy, TYPE_SAFE_NAME ((yyvsp[-4].tsym).type)); + } +#line 3017 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 122: +#line 1055 "c-exp.y" /* yacc.c:1646 */ + { + char *name = copy_name ((yyvsp[0].ssym).stoken); + struct symbol *sym; + struct bound_minimal_symbol msymbol; + + sym + = lookup_symbol (name, (const struct block *) NULL, + VAR_DOMAIN, NULL).symbol; + if (sym) + { + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, NULL); + write_exp_elt_sym (pstate, sym); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + break; + } + + msymbol = lookup_bound_minimal_symbol (name); + if (msymbol.minsym != NULL) + write_exp_msymbol (pstate, msymbol); + else if (!have_full_symbols () && !have_partial_symbols ()) + error (_("No symbol table is loaded. Use the \"file\" command.")); + else + error (_("No symbol \"%s\" in current context."), name); + } +#line 3047 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 123: +#line 1083 "c-exp.y" /* yacc.c:1646 */ + { struct block_symbol sym = (yyvsp[0].ssym).sym; + + if (sym.symbol) + { + if (symbol_read_needs_frame (sym.symbol)) + innermost_block.update (sym); + + /* If we found a function, see if it's + an ifunc resolver that has the same + address as the ifunc symbol itself. + If so, prefer the ifunc symbol. */ + + bound_minimal_symbol resolver + = find_gnu_ifunc (sym.symbol); + if (resolver.minsym != NULL) + write_exp_msymbol (pstate, resolver); + else + { + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, sym.block); + write_exp_elt_sym (pstate, sym.symbol); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + } + } + else if ((yyvsp[0].ssym).is_a_field_of_this) + { + /* C++: it hangs off of `this'. Must + not inadvertently convert from a method call + to data ref. */ + innermost_block.update (sym); + write_exp_elt_opcode (pstate, OP_THIS); + write_exp_elt_opcode (pstate, OP_THIS); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); + write_exp_string (pstate, (yyvsp[0].ssym).stoken); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); + } + else + { + char *arg = copy_name ((yyvsp[0].ssym).stoken); + + bound_minimal_symbol msymbol + = lookup_bound_minimal_symbol (arg); + if (msymbol.minsym == NULL) + { + if (!have_full_symbols () && !have_partial_symbols ()) + error (_("No symbol table is loaded. Use the \"file\" command.")); + else + error (_("No symbol \"%s\" in current context."), + copy_name ((yyvsp[0].ssym).stoken)); + } + + /* This minsym might be an alias for + another function. See if we can find + the debug symbol for the target, and + if so, use it instead, since it has + return type / prototype info. This + is important for example for "p + *__errno_location()". */ + symbol *alias_target + = ((msymbol.minsym->type != mst_text_gnu_ifunc + && msymbol.minsym->type != mst_data_gnu_ifunc) + ? find_function_alias_target (msymbol) + : NULL); + if (alias_target != NULL) + { + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block + (pstate, SYMBOL_BLOCK_VALUE (alias_target)); + write_exp_elt_sym (pstate, alias_target); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + } + else + write_exp_msymbol (pstate, msymbol); + } + } +#line 3127 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 124: +#line 1161 "c-exp.y" /* yacc.c:1646 */ + { insert_type_address_space (pstate, copy_name ((yyvsp[0].ssym).stoken)); } +#line 3133 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 132: +#line 1182 "c-exp.y" /* yacc.c:1646 */ + { insert_type (tp_pointer); } +#line 3139 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 134: +#line 1185 "c-exp.y" /* yacc.c:1646 */ + { insert_type (tp_pointer); } +#line 3145 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 136: +#line 1188 "c-exp.y" /* yacc.c:1646 */ + { insert_type (tp_reference); } +#line 3151 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 137: +#line 1190 "c-exp.y" /* yacc.c:1646 */ + { insert_type (tp_reference); } +#line 3157 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 138: +#line 1192 "c-exp.y" /* yacc.c:1646 */ + { insert_type (tp_rvalue_reference); } +#line 3163 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 139: +#line 1194 "c-exp.y" /* yacc.c:1646 */ + { insert_type (tp_rvalue_reference); } +#line 3169 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 140: +#line 1198 "c-exp.y" /* yacc.c:1646 */ + { + (yyval.type_stack) = get_type_stack (); + cpstate->type_stacks.emplace_back ((yyval.type_stack)); + } +#line 3178 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 141: +#line 1205 "c-exp.y" /* yacc.c:1646 */ + { (yyval.type_stack) = append_type_stack ((yyvsp[0].type_stack), (yyvsp[-1].type_stack)); } +#line 3184 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 144: +#line 1211 "c-exp.y" /* yacc.c:1646 */ + { (yyval.type_stack) = (yyvsp[-1].type_stack); } +#line 3190 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 145: +#line 1213 "c-exp.y" /* yacc.c:1646 */ + { + push_type_stack ((yyvsp[-1].type_stack)); + push_type_int ((yyvsp[0].lval)); + push_type (tp_array); + (yyval.type_stack) = get_type_stack (); + cpstate->type_stacks.emplace_back ((yyval.type_stack)); + } +#line 3202 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 146: +#line 1221 "c-exp.y" /* yacc.c:1646 */ + { + push_type_int ((yyvsp[0].lval)); + push_type (tp_array); + (yyval.type_stack) = get_type_stack (); + cpstate->type_stacks.emplace_back ((yyval.type_stack)); + } +#line 3213 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 147: +#line 1229 "c-exp.y" /* yacc.c:1646 */ + { + push_type_stack ((yyvsp[-1].type_stack)); + push_typelist ((yyvsp[0].tvec)); + (yyval.type_stack) = get_type_stack (); + cpstate->type_stacks.emplace_back ((yyval.type_stack)); + } +#line 3224 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 148: +#line 1236 "c-exp.y" /* yacc.c:1646 */ + { + push_typelist ((yyvsp[0].tvec)); + (yyval.type_stack) = get_type_stack (); + cpstate->type_stacks.emplace_back ((yyval.type_stack)); + } +#line 3234 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 149: +#line 1244 "c-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = -1; } +#line 3240 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 150: +#line 1246 "c-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = -1; } +#line 3246 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 151: +#line 1248 "c-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[-1].typed_val_int).val; } +#line 3252 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 152: +#line 1250 "c-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[-1].typed_val_int).val; } +#line 3258 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 153: +#line 1254 "c-exp.y" /* yacc.c:1646 */ + { + (yyval.tvec) = new std::vector; + cpstate->type_lists.emplace_back ((yyval.tvec)); + } +#line 3267 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 154: +#line 1259 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tvec) = (yyvsp[-1].tvec); } +#line 3273 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 156: +#line 1285 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = (yyvsp[0].tsym).type; } +#line 3279 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 157: +#line 1287 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "int"); } +#line 3287 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 158: +#line 1291 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long"); } +#line 3295 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 159: +#line 1295 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "short"); } +#line 3303 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 160: +#line 1299 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long"); } +#line 3311 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 161: +#line 1303 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long"); } +#line 3319 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 162: +#line 1307 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long"); } +#line 3327 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 163: +#line 1311 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long"); } +#line 3335 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 164: +#line 1315 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long"); } +#line 3343 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 165: +#line 1319 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long"); } +#line 3351 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 166: +#line 1323 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long"); } +#line 3359 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 167: +#line 1327 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long long"); } +#line 3367 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 168: +#line 1331 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long long"); } +#line 3375 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 169: +#line 1335 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long long"); } +#line 3383 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 170: +#line 1339 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long long"); } +#line 3391 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 171: +#line 1343 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long long"); } +#line 3399 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 172: +#line 1347 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long long"); } +#line 3407 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 173: +#line 1351 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long long"); } +#line 3415 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 174: +#line 1355 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long long"); } +#line 3423 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 175: +#line 1359 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long long"); } +#line 3431 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 176: +#line 1363 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long long"); } +#line 3439 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 177: +#line 1367 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "short"); } +#line 3447 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 178: +#line 1371 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "short"); } +#line 3455 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 179: +#line 1375 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "short"); } +#line 3463 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 180: +#line 1379 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + "short"); } +#line 3471 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 181: +#line 1383 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + "short"); } +#line 3479 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 182: +#line 1387 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + "short"); } +#line 3487 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 183: +#line 1391 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_typename (parse_language (pstate), + parse_gdbarch (pstate), + "double", + (struct block *) NULL, + 0); } +#line 3497 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 184: +#line 1397 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long double", + (struct block *) NULL, + 0); } +#line 3507 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 185: +#line 1403 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_struct (copy_name ((yyvsp[0].sval)), + expression_context_block); } +#line 3514 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 186: +#line 1406 "c-exp.y" /* yacc.c:1646 */ + { + mark_completion_tag (TYPE_CODE_STRUCT, "", 0); + (yyval.tval) = NULL; + } +#line 3523 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 187: +#line 1411 "c-exp.y" /* yacc.c:1646 */ + { + mark_completion_tag (TYPE_CODE_STRUCT, (yyvsp[-1].sval).ptr, + (yyvsp[-1].sval).length); + (yyval.tval) = NULL; + } +#line 3533 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 188: +#line 1417 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_struct (copy_name ((yyvsp[0].sval)), + expression_context_block); } +#line 3540 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 189: +#line 1420 "c-exp.y" /* yacc.c:1646 */ + { + mark_completion_tag (TYPE_CODE_STRUCT, "", 0); + (yyval.tval) = NULL; + } +#line 3549 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 190: +#line 1425 "c-exp.y" /* yacc.c:1646 */ + { + mark_completion_tag (TYPE_CODE_STRUCT, (yyvsp[-1].sval).ptr, + (yyvsp[-1].sval).length); + (yyval.tval) = NULL; + } +#line 3559 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 191: +#line 1431 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_union (copy_name ((yyvsp[0].sval)), + expression_context_block); } +#line 3566 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 192: +#line 1434 "c-exp.y" /* yacc.c:1646 */ + { + mark_completion_tag (TYPE_CODE_UNION, "", 0); + (yyval.tval) = NULL; + } +#line 3575 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 193: +#line 1439 "c-exp.y" /* yacc.c:1646 */ + { + mark_completion_tag (TYPE_CODE_UNION, (yyvsp[-1].sval).ptr, + (yyvsp[-1].sval).length); + (yyval.tval) = NULL; + } +#line 3585 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 194: +#line 1445 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_enum (copy_name ((yyvsp[0].sval)), + expression_context_block); } +#line 3592 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 195: +#line 1448 "c-exp.y" /* yacc.c:1646 */ + { + mark_completion_tag (TYPE_CODE_ENUM, "", 0); + (yyval.tval) = NULL; + } +#line 3601 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 196: +#line 1453 "c-exp.y" /* yacc.c:1646 */ + { + mark_completion_tag (TYPE_CODE_ENUM, (yyvsp[-1].sval).ptr, + (yyvsp[-1].sval).length); + (yyval.tval) = NULL; + } +#line 3611 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 197: +#line 1459 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + TYPE_NAME((yyvsp[0].tsym).type)); } +#line 3619 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 198: +#line 1463 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_unsigned_typename (parse_language (pstate), + parse_gdbarch (pstate), + "int"); } +#line 3627 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 199: +#line 1467 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + TYPE_NAME((yyvsp[0].tsym).type)); } +#line 3635 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 200: +#line 1471 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "int"); } +#line 3643 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 201: +#line 1478 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_template_type(copy_name((yyvsp[-3].sval)), (yyvsp[-1].tval), + expression_context_block); + } +#line 3651 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 202: +#line 1482 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = follow_types ((yyvsp[0].tval)); } +#line 3657 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 203: +#line 1484 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = follow_types ((yyvsp[-1].tval)); } +#line 3663 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 205: +#line 1489 "c-exp.y" /* yacc.c:1646 */ + { + (yyval.tsym).stoken.ptr = "int"; + (yyval.tsym).stoken.length = 3; + (yyval.tsym).type = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "int"); + } +#line 3675 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 206: +#line 1497 "c-exp.y" /* yacc.c:1646 */ + { + (yyval.tsym).stoken.ptr = "long"; + (yyval.tsym).stoken.length = 4; + (yyval.tsym).type = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "long"); + } +#line 3687 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 207: +#line 1505 "c-exp.y" /* yacc.c:1646 */ + { + (yyval.tsym).stoken.ptr = "short"; + (yyval.tsym).stoken.length = 5; + (yyval.tsym).type = lookup_signed_typename (parse_language (pstate), + parse_gdbarch (pstate), + "short"); + } +#line 3699 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 208: +#line 1516 "c-exp.y" /* yacc.c:1646 */ + { check_parameter_typelist ((yyvsp[0].tvec)); } +#line 3705 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 209: +#line 1518 "c-exp.y" /* yacc.c:1646 */ + { + (yyvsp[-2].tvec)->push_back (NULL); + check_parameter_typelist ((yyvsp[-2].tvec)); + (yyval.tvec) = (yyvsp[-2].tvec); + } +#line 3715 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 210: +#line 1527 "c-exp.y" /* yacc.c:1646 */ + { + std::vector *typelist + = new std::vector; + cpstate->type_lists.emplace_back (typelist); + + typelist->push_back ((yyvsp[0].tval)); + (yyval.tvec) = typelist; + } +#line 3728 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 211: +#line 1536 "c-exp.y" /* yacc.c:1646 */ + { + (yyvsp[-2].tvec)->push_back ((yyvsp[0].tval)); + (yyval.tvec) = (yyvsp[-2].tvec); + } +#line 3737 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 213: +#line 1544 "c-exp.y" /* yacc.c:1646 */ + { + push_type_stack ((yyvsp[0].type_stack)); + (yyval.tval) = follow_types ((yyvsp[-1].tval)); + } +#line 3746 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 214: +#line 1551 "c-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = follow_types ((yyvsp[-1].tval)); } +#line 3752 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 219: +#line 1563 "c-exp.y" /* yacc.c:1646 */ + { insert_type (tp_const); + insert_type (tp_volatile); + } +#line 3760 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 220: +#line 1567 "c-exp.y" /* yacc.c:1646 */ + { insert_type (tp_const); } +#line 3766 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 221: +#line 1569 "c-exp.y" /* yacc.c:1646 */ + { insert_type (tp_volatile); } +#line 3772 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 222: +#line 1573 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken (" new"); } +#line 3778 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 223: +#line 1575 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken (" delete"); } +#line 3784 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 224: +#line 1577 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken (" new[]"); } +#line 3790 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 225: +#line 1579 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken (" delete[]"); } +#line 3796 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 226: +#line 1581 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken (" new[]"); } +#line 3802 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 227: +#line 1583 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken (" delete[]"); } +#line 3808 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 228: +#line 1585 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("+"); } +#line 3814 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 229: +#line 1587 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("-"); } +#line 3820 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 230: +#line 1589 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("*"); } +#line 3826 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 231: +#line 1591 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("/"); } +#line 3832 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 232: +#line 1593 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("%"); } +#line 3838 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 233: +#line 1595 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("^"); } +#line 3844 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 234: +#line 1597 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("&"); } +#line 3850 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 235: +#line 1599 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("|"); } +#line 3856 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 236: +#line 1601 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("~"); } +#line 3862 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 237: +#line 1603 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("!"); } +#line 3868 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 238: +#line 1605 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("="); } +#line 3874 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 239: +#line 1607 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("<"); } +#line 3880 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 240: +#line 1609 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken (">"); } +#line 3886 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 241: +#line 1611 "c-exp.y" /* yacc.c:1646 */ + { const char *op = " unknown"; + switch ((yyvsp[0].opcode)) + { + case BINOP_RSH: + op = ">>="; + break; + case BINOP_LSH: + op = "<<="; + break; + case BINOP_ADD: + op = "+="; + break; + case BINOP_SUB: + op = "-="; + break; + case BINOP_MUL: + op = "*="; + break; + case BINOP_DIV: + op = "/="; + break; + case BINOP_REM: + op = "%="; + break; + case BINOP_BITWISE_IOR: + op = "|="; + break; + case BINOP_BITWISE_AND: + op = "&="; + break; + case BINOP_BITWISE_XOR: + op = "^="; + break; + default: + break; + } + + (yyval.sval) = operator_stoken (op); + } +#line 3930 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 242: +#line 1651 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("<<"); } +#line 3936 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 243: +#line 1653 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken (">>"); } +#line 3942 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 244: +#line 1655 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("=="); } +#line 3948 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 245: +#line 1657 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("!="); } +#line 3954 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 246: +#line 1659 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("<="); } +#line 3960 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 247: +#line 1661 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken (">="); } +#line 3966 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 248: +#line 1663 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("&&"); } +#line 3972 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 249: +#line 1665 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("||"); } +#line 3978 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 250: +#line 1667 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("++"); } +#line 3984 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 251: +#line 1669 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("--"); } +#line 3990 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 252: +#line 1671 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken (","); } +#line 3996 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 253: +#line 1673 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("->*"); } +#line 4002 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 254: +#line 1675 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("->"); } +#line 4008 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 255: +#line 1677 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("()"); } +#line 4014 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 256: +#line 1679 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("[]"); } +#line 4020 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 257: +#line 1681 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = operator_stoken ("[]"); } +#line 4026 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 258: +#line 1683 "c-exp.y" /* yacc.c:1646 */ + { string_file buf; + + c_print_type ((yyvsp[0].tval), NULL, &buf, -1, 0, + &type_print_raw_options); + + /* This also needs canonicalization. */ + std::string canon + = cp_canonicalize_string (buf.c_str ()); + if (canon.empty ()) + canon = std::move (buf.string ()); + (yyval.sval) = operator_stoken ((" " + canon).c_str ()); + } +#line 4043 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 260: +#line 1706 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = typename_stoken ("double"); } +#line 4049 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 261: +#line 1707 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = typename_stoken ("int"); } +#line 4055 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 262: +#line 1708 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = typename_stoken ("long"); } +#line 4061 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 263: +#line 1709 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = typename_stoken ("short"); } +#line 4067 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 264: +#line 1710 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = typename_stoken ("signed"); } +#line 4073 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 265: +#line 1711 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = typename_stoken ("unsigned"); } +#line 4079 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 266: +#line 1714 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].ssym).stoken; } +#line 4085 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 267: +#line 1715 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].ssym).stoken; } +#line 4091 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 268: +#line 1716 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].tsym).stoken; } +#line 4097 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 269: +#line 1717 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].ssym).stoken; } +#line 4103 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 270: +#line 1718 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].ssym).stoken; } +#line 4109 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 271: +#line 1719 "c-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].sval); } +#line 4115 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 274: +#line 1732 "c-exp.y" /* yacc.c:1646 */ + { + struct field_of_this_result is_a_field_of_this; + + (yyval.ssym).stoken = (yyvsp[0].sval); + (yyval.ssym).sym = lookup_symbol ((yyvsp[0].sval).ptr, + expression_context_block, + VAR_DOMAIN, + &is_a_field_of_this); + (yyval.ssym).is_a_field_of_this + = is_a_field_of_this.type != NULL; + } +#line 4131 "c-exp.c.tmp" /* yacc.c:1646 */ + break; + + +#line 4135 "c-exp.c.tmp" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 1746 "c-exp.y" /* yacc.c:1906 */ + + +/* Like write_exp_string, but prepends a '~'. */ + +static void +write_destructor_name (struct parser_state *par_state, struct stoken token) +{ + char *copy = (char *) alloca (token.length + 1); + + copy[0] = '~'; + memcpy (©[1], token.ptr, token.length); + + token.ptr = copy; + ++token.length; + + write_exp_string (par_state, token); +} + +/* Returns a stoken of the operator name given by OP (which does not + include the string "operator"). */ + +static struct stoken +operator_stoken (const char *op) +{ + struct stoken st = { NULL, 0 }; + char *buf; + + st.length = CP_OPERATOR_LEN + strlen (op); + buf = (char *) xmalloc (st.length + 1); + strcpy (buf, CP_OPERATOR_STR); + strcat (buf, op); + st.ptr = buf; + + /* The toplevel (c_parse) will free the memory allocated here. */ + cpstate->strings.emplace_back (buf); + return st; +}; + +/* Returns a stoken of the type named TYPE. */ + +static struct stoken +typename_stoken (const char *type) +{ + struct stoken st = { type, 0 }; + st.length = strlen (type); + return st; +}; + +/* Return true if the type is aggregate-like. */ + +static int +type_aggregate_p (struct type *type) +{ + return (TYPE_CODE (type) == TYPE_CODE_STRUCT + || TYPE_CODE (type) == TYPE_CODE_UNION + || TYPE_CODE (type) == TYPE_CODE_NAMESPACE + || (TYPE_CODE (type) == TYPE_CODE_ENUM + && TYPE_DECLARED_CLASS (type))); +} + +/* Validate a parameter typelist. */ + +static void +check_parameter_typelist (std::vector *params) +{ + struct type *type; + int ix; + + for (ix = 0; ix < params->size (); ++ix) + { + type = (*params)[ix]; + if (type != NULL && TYPE_CODE (check_typedef (type)) == TYPE_CODE_VOID) + { + if (ix == 0) + { + if (params->size () == 1) + { + /* Ok. */ + break; + } + error (_("parameter types following 'void'")); + } + else + error (_("'void' invalid as parameter type")); + } + } +} + +/* Take care of parsing a number (anything that starts with a digit). + Set yylval and return the token type; update lexptr. + LEN is the number of characters in it. */ + +/*** Needs some error checking for the float case ***/ + +static int +parse_number (struct parser_state *par_state, + const char *buf, int len, int parsed_float, YYSTYPE *putithere) +{ + ULONGEST n = 0; + ULONGEST prevn = 0; + ULONGEST un; + + int i = 0; + int c; + int base = input_radix; + int unsigned_p = 0; + + /* Number of "L" suffixes encountered. */ + int long_p = 0; + + /* We have found a "L" or "U" suffix. */ + int found_suffix = 0; + + ULONGEST high_bit; + struct type *signed_type; + struct type *unsigned_type; + char *p; + + p = (char *) alloca (len); + memcpy (p, buf, len); + + if (parsed_float) + { + /* Handle suffixes for decimal floating-point: "df", "dd" or "dl". */ + if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'f') + { + putithere->typed_val_float.type + = parse_type (par_state)->builtin_decfloat; + len -= 2; + } + else if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'd') + { + putithere->typed_val_float.type + = parse_type (par_state)->builtin_decdouble; + len -= 2; + } + else if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'l') + { + putithere->typed_val_float.type + = parse_type (par_state)->builtin_declong; + len -= 2; + } + /* Handle suffixes: 'f' for float, 'l' for long double. */ + else if (len >= 1 && TOLOWER (p[len - 1]) == 'f') + { + putithere->typed_val_float.type + = parse_type (par_state)->builtin_float; + len -= 1; + } + else if (len >= 1 && TOLOWER (p[len - 1]) == 'l') + { + putithere->typed_val_float.type + = parse_type (par_state)->builtin_long_double; + len -= 1; + } + /* Default type for floating-point literals is double. */ + else + { + putithere->typed_val_float.type + = parse_type (par_state)->builtin_double; + } + + if (!parse_float (p, len, + putithere->typed_val_float.type, + putithere->typed_val_float.val)) + return ERROR; + return FLOAT; + } + + /* Handle base-switching prefixes 0x, 0t, 0d, 0 */ + if (p[0] == '0' && len > 1) + switch (p[1]) + { + case 'x': + case 'X': + if (len >= 3) + { + p += 2; + base = 16; + len -= 2; + } + break; + + case 'b': + case 'B': + if (len >= 3) + { + p += 2; + base = 2; + len -= 2; + } + break; + + case 't': + case 'T': + case 'd': + case 'D': + if (len >= 3) + { + p += 2; + base = 10; + len -= 2; + } + break; + + default: + base = 8; + break; + } + + while (len-- > 0) + { + c = *p++; + if (c >= 'A' && c <= 'Z') + c += 'a' - 'A'; + if (c != 'l' && c != 'u') + n *= base; + if (c >= '0' && c <= '9') + { + if (found_suffix) + return ERROR; + n += i = c - '0'; + } + else + { + if (base > 10 && c >= 'a' && c <= 'f') + { + if (found_suffix) + return ERROR; + n += i = c - 'a' + 10; + } + else if (c == 'l') + { + ++long_p; + found_suffix = 1; + } + else if (c == 'u') + { + unsigned_p = 1; + found_suffix = 1; + } + else + return ERROR; /* Char not a digit */ + } + if (i >= base) + return ERROR; /* Invalid digit in this base */ + + /* Portably test for overflow (only works for nonzero values, so make + a second check for zero). FIXME: Can't we just make n and prevn + unsigned and avoid this? */ + if (c != 'l' && c != 'u' && (prevn >= n) && n != 0) + unsigned_p = 1; /* Try something unsigned */ + + /* Portably test for unsigned overflow. + FIXME: This check is wrong; for example it doesn't find overflow + on 0x123456789 when LONGEST is 32 bits. */ + if (c != 'l' && c != 'u' && n != 0) + { + if (unsigned_p && prevn >= n) + error (_("Numeric constant too large.")); + } + prevn = n; + } + + /* An integer constant is an int, a long, or a long long. An L + suffix forces it to be long; an LL suffix forces it to be long + long. If not forced to a larger size, it gets the first type of + the above that it fits in. To figure out whether it fits, we + shift it right and see whether anything remains. Note that we + can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one + operation, because many compilers will warn about such a shift + (which always produces a zero result). Sometimes gdbarch_int_bit + or gdbarch_long_bit will be that big, sometimes not. To deal with + the case where it is we just always shift the value more than + once, with fewer bits each time. */ + + un = n >> 2; + if (long_p == 0 + && (un >> (gdbarch_int_bit (parse_gdbarch (par_state)) - 2)) == 0) + { + high_bit + = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch (par_state)) - 1); + + /* A large decimal (not hex or octal) constant (between INT_MAX + and UINT_MAX) is a long or unsigned long, according to ANSI, + never an unsigned int, but this code treats it as unsigned + int. This probably should be fixed. GCC gives a warning on + such constants. */ + + unsigned_type = parse_type (par_state)->builtin_unsigned_int; + signed_type = parse_type (par_state)->builtin_int; + } + else if (long_p <= 1 + && (un >> (gdbarch_long_bit (parse_gdbarch (par_state)) - 2)) == 0) + { + high_bit + = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch (par_state)) - 1); + unsigned_type = parse_type (par_state)->builtin_unsigned_long; + signed_type = parse_type (par_state)->builtin_long; + } + else + { + int shift; + if (sizeof (ULONGEST) * HOST_CHAR_BIT + < gdbarch_long_long_bit (parse_gdbarch (par_state))) + /* A long long does not fit in a LONGEST. */ + shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1); + else + shift = (gdbarch_long_long_bit (parse_gdbarch (par_state)) - 1); + high_bit = (ULONGEST) 1 << shift; + unsigned_type = parse_type (par_state)->builtin_unsigned_long_long; + signed_type = parse_type (par_state)->builtin_long_long; + } + + putithere->typed_val_int.val = n; + + /* If the high bit of the worked out type is set then this number + has to be unsigned. */ + + if (unsigned_p || (n & high_bit)) + { + putithere->typed_val_int.type = unsigned_type; + } + else + { + putithere->typed_val_int.type = signed_type; + } + + return INT; +} + +/* Temporary obstack used for holding strings. */ +static struct obstack tempbuf; +static int tempbuf_init; + +/* Parse a C escape sequence. The initial backslash of the sequence + is at (*PTR)[-1]. *PTR will be updated to point to just after the + last character of the sequence. If OUTPUT is not NULL, the + translated form of the escape sequence will be written there. If + OUTPUT is NULL, no output is written and the call will only affect + *PTR. If an escape sequence is expressed in target bytes, then the + entire sequence will simply be copied to OUTPUT. Return 1 if any + character was emitted, 0 otherwise. */ + +int +c_parse_escape (const char **ptr, struct obstack *output) +{ + const char *tokptr = *ptr; + int result = 1; + + /* Some escape sequences undergo character set conversion. Those we + translate here. */ + switch (*tokptr) + { + /* Hex escapes do not undergo character set conversion, so keep + the escape sequence for later. */ + case 'x': + if (output) + obstack_grow_str (output, "\\x"); + ++tokptr; + if (!ISXDIGIT (*tokptr)) + error (_("\\x escape without a following hex digit")); + while (ISXDIGIT (*tokptr)) + { + if (output) + obstack_1grow (output, *tokptr); + ++tokptr; + } + break; + + /* Octal escapes do not undergo character set conversion, so + keep the escape sequence for later. */ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + { + int i; + if (output) + obstack_grow_str (output, "\\"); + for (i = 0; + i < 3 && ISDIGIT (*tokptr) && *tokptr != '8' && *tokptr != '9'; + ++i) + { + if (output) + obstack_1grow (output, *tokptr); + ++tokptr; + } + } + break; + + /* We handle UCNs later. We could handle them here, but that + would mean a spurious error in the case where the UCN could + be converted to the target charset but not the host + charset. */ + case 'u': + case 'U': + { + char c = *tokptr; + int i, len = c == 'U' ? 8 : 4; + if (output) + { + obstack_1grow (output, '\\'); + obstack_1grow (output, *tokptr); + } + ++tokptr; + if (!ISXDIGIT (*tokptr)) + error (_("\\%c escape without a following hex digit"), c); + for (i = 0; i < len && ISXDIGIT (*tokptr); ++i) + { + if (output) + obstack_1grow (output, *tokptr); + ++tokptr; + } + } + break; + + /* We must pass backslash through so that it does not + cause quoting during the second expansion. */ + case '\\': + if (output) + obstack_grow_str (output, "\\\\"); + ++tokptr; + break; + + /* Escapes which undergo conversion. */ + case 'a': + if (output) + obstack_1grow (output, '\a'); + ++tokptr; + break; + case 'b': + if (output) + obstack_1grow (output, '\b'); + ++tokptr; + break; + case 'f': + if (output) + obstack_1grow (output, '\f'); + ++tokptr; + break; + case 'n': + if (output) + obstack_1grow (output, '\n'); + ++tokptr; + break; + case 'r': + if (output) + obstack_1grow (output, '\r'); + ++tokptr; + break; + case 't': + if (output) + obstack_1grow (output, '\t'); + ++tokptr; + break; + case 'v': + if (output) + obstack_1grow (output, '\v'); + ++tokptr; + break; + + /* GCC extension. */ + case 'e': + if (output) + obstack_1grow (output, HOST_ESCAPE_CHAR); + ++tokptr; + break; + + /* Backslash-newline expands to nothing at all. */ + case '\n': + ++tokptr; + result = 0; + break; + + /* A few escapes just expand to the character itself. */ + case '\'': + case '\"': + case '?': + /* GCC extensions. */ + case '(': + case '{': + case '[': + case '%': + /* Unrecognized escapes turn into the character itself. */ + default: + if (output) + obstack_1grow (output, *tokptr); + ++tokptr; + break; + } + *ptr = tokptr; + return result; +} + +/* Parse a string or character literal from TOKPTR. The string or + character may be wide or unicode. *OUTPTR is set to just after the + end of the literal in the input string. The resulting token is + stored in VALUE. This returns a token value, either STRING or + CHAR, depending on what was parsed. *HOST_CHARS is set to the + number of host characters in the literal. */ + +static int +parse_string_or_char (const char *tokptr, const char **outptr, + struct typed_stoken *value, int *host_chars) +{ + int quote; + c_string_type type; + int is_objc = 0; + + /* Build the gdb internal form of the input string in tempbuf. Note + that the buffer is null byte terminated *only* for the + convenience of debugging gdb itself and printing the buffer + contents when the buffer contains no embedded nulls. Gdb does + not depend upon the buffer being null byte terminated, it uses + the length string instead. This allows gdb to handle C strings + (as well as strings in other languages) with embedded null + bytes */ + + if (!tempbuf_init) + tempbuf_init = 1; + else + obstack_free (&tempbuf, NULL); + obstack_init (&tempbuf); + + /* Record the string type. */ + if (*tokptr == 'L') + { + type = C_WIDE_STRING; + ++tokptr; + } + else if (*tokptr == 'u') + { + type = C_STRING_16; + ++tokptr; + } + else if (*tokptr == 'U') + { + type = C_STRING_32; + ++tokptr; + } + else if (*tokptr == '@') + { + /* An Objective C string. */ + is_objc = 1; + type = C_STRING; + ++tokptr; + } + else + type = C_STRING; + + /* Skip the quote. */ + quote = *tokptr; + if (quote == '\'') + type |= C_CHAR; + ++tokptr; + + *host_chars = 0; + + while (*tokptr) + { + char c = *tokptr; + if (c == '\\') + { + ++tokptr; + *host_chars += c_parse_escape (&tokptr, &tempbuf); + } + else if (c == quote) + break; + else + { + obstack_1grow (&tempbuf, c); + ++tokptr; + /* FIXME: this does the wrong thing with multi-byte host + characters. We could use mbrlen here, but that would + make "set host-charset" a bit less useful. */ + ++*host_chars; + } + } + + if (*tokptr != quote) + { + if (quote == '"') + error (_("Unterminated string in expression.")); + else + error (_("Unmatched single quote.")); + } + ++tokptr; + + value->type = type; + value->ptr = (char *) obstack_base (&tempbuf); + value->length = obstack_object_size (&tempbuf); + + *outptr = tokptr; + + return quote == '"' ? (is_objc ? NSSTRING : STRING) : CHAR; +} + +/* This is used to associate some attributes with a token. */ + +enum token_flag +{ + /* If this bit is set, the token is C++-only. */ + + FLAG_CXX = 1, + + /* If this bit is set, the token is conditional: if there is a + symbol of the same name, then the token is a symbol; otherwise, + the token is a keyword. */ + + FLAG_SHADOW = 2 +}; +DEF_ENUM_FLAGS_TYPE (enum token_flag, token_flags); + +struct token +{ + const char *oper; + int token; + enum exp_opcode opcode; + token_flags flags; +}; + +static const struct token tokentab3[] = + { + {">>=", ASSIGN_MODIFY, BINOP_RSH, 0}, + {"<<=", ASSIGN_MODIFY, BINOP_LSH, 0}, + {"->*", ARROW_STAR, BINOP_END, FLAG_CXX}, + {"...", DOTDOTDOT, BINOP_END, 0} + }; + +static const struct token tokentab2[] = + { + {"+=", ASSIGN_MODIFY, BINOP_ADD, 0}, + {"-=", ASSIGN_MODIFY, BINOP_SUB, 0}, + {"*=", ASSIGN_MODIFY, BINOP_MUL, 0}, + {"/=", ASSIGN_MODIFY, BINOP_DIV, 0}, + {"%=", ASSIGN_MODIFY, BINOP_REM, 0}, + {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR, 0}, + {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND, 0}, + {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR, 0}, + {"++", INCREMENT, BINOP_END, 0}, + {"--", DECREMENT, BINOP_END, 0}, + {"->", ARROW, BINOP_END, 0}, + {"&&", ANDAND, BINOP_END, 0}, + {"||", OROR, BINOP_END, 0}, + /* "::" is *not* only C++: gdb overrides its meaning in several + different ways, e.g., 'filename'::func, function::variable. */ + {"::", COLONCOLON, BINOP_END, 0}, + {"<<", LSH, BINOP_END, 0}, + {">>", RSH, BINOP_END, 0}, + {"==", EQUAL, BINOP_END, 0}, + {"!=", NOTEQUAL, BINOP_END, 0}, + {"<=", LEQ, BINOP_END, 0}, + {">=", GEQ, BINOP_END, 0}, + {".*", DOT_STAR, BINOP_END, FLAG_CXX} + }; + +/* Identifier-like tokens. Only type-specifiers than can appear in + multi-word type names (for example 'double' can appear in 'long + double') need to be listed here. type-specifiers that are only ever + single word (like 'float') are handled by the classify_name function. */ +static const struct token ident_tokens[] = + { + {"unsigned", UNSIGNED, OP_NULL, 0}, + {"template", TEMPLATE, OP_NULL, FLAG_CXX}, + {"volatile", VOLATILE_KEYWORD, OP_NULL, 0}, + {"struct", STRUCT, OP_NULL, 0}, + {"signed", SIGNED_KEYWORD, OP_NULL, 0}, + {"sizeof", SIZEOF, OP_NULL, 0}, + {"_Alignof", ALIGNOF, OP_NULL, 0}, + {"alignof", ALIGNOF, OP_NULL, FLAG_CXX}, + {"double", DOUBLE_KEYWORD, OP_NULL, 0}, + {"false", FALSEKEYWORD, OP_NULL, FLAG_CXX}, + {"class", CLASS, OP_NULL, FLAG_CXX}, + {"union", UNION, OP_NULL, 0}, + {"short", SHORT, OP_NULL, 0}, + {"const", CONST_KEYWORD, OP_NULL, 0}, + {"enum", ENUM, OP_NULL, 0}, + {"long", LONG, OP_NULL, 0}, + {"true", TRUEKEYWORD, OP_NULL, FLAG_CXX}, + {"int", INT_KEYWORD, OP_NULL, 0}, + {"new", NEW, OP_NULL, FLAG_CXX}, + {"delete", DELETE, OP_NULL, FLAG_CXX}, + {"operator", OPERATOR, OP_NULL, FLAG_CXX}, + + {"and", ANDAND, BINOP_END, FLAG_CXX}, + {"and_eq", ASSIGN_MODIFY, BINOP_BITWISE_AND, FLAG_CXX}, + {"bitand", '&', OP_NULL, FLAG_CXX}, + {"bitor", '|', OP_NULL, FLAG_CXX}, + {"compl", '~', OP_NULL, FLAG_CXX}, + {"not", '!', OP_NULL, FLAG_CXX}, + {"not_eq", NOTEQUAL, BINOP_END, FLAG_CXX}, + {"or", OROR, BINOP_END, FLAG_CXX}, + {"or_eq", ASSIGN_MODIFY, BINOP_BITWISE_IOR, FLAG_CXX}, + {"xor", '^', OP_NULL, FLAG_CXX}, + {"xor_eq", ASSIGN_MODIFY, BINOP_BITWISE_XOR, FLAG_CXX}, + + {"const_cast", CONST_CAST, OP_NULL, FLAG_CXX }, + {"dynamic_cast", DYNAMIC_CAST, OP_NULL, FLAG_CXX }, + {"static_cast", STATIC_CAST, OP_NULL, FLAG_CXX }, + {"reinterpret_cast", REINTERPRET_CAST, OP_NULL, FLAG_CXX }, + + {"__typeof__", TYPEOF, OP_TYPEOF, 0 }, + {"__typeof", TYPEOF, OP_TYPEOF, 0 }, + {"typeof", TYPEOF, OP_TYPEOF, FLAG_SHADOW }, + {"__decltype", DECLTYPE, OP_DECLTYPE, FLAG_CXX }, + {"decltype", DECLTYPE, OP_DECLTYPE, FLAG_CXX | FLAG_SHADOW }, + + {"typeid", TYPEID, OP_TYPEID, FLAG_CXX} + }; + + +static void +scan_macro_expansion (char *expansion) +{ + char *copy; + + /* We'd better not be trying to push the stack twice. */ + gdb_assert (! cpstate->macro_original_text); + + /* Copy to the obstack, and then free the intermediate + expansion. */ + copy = (char *) obstack_copy0 (&cpstate->expansion_obstack, expansion, + strlen (expansion)); + xfree (expansion); + + /* Save the old lexptr value, so we can return to it when we're done + parsing the expanded text. */ + cpstate->macro_original_text = lexptr; + lexptr = copy; +} + +static int +scanning_macro_expansion (void) +{ + return cpstate->macro_original_text != 0; +} + +static void +finished_macro_expansion (void) +{ + /* There'd better be something to pop back to. */ + gdb_assert (cpstate->macro_original_text); + + /* Pop back to the original text. */ + lexptr = cpstate->macro_original_text; + cpstate->macro_original_text = 0; +} + +/* Return true iff the token represents a C++ cast operator. */ + +static int +is_cast_operator (const char *token, int len) +{ + return (! strncmp (token, "dynamic_cast", len) + || ! strncmp (token, "static_cast", len) + || ! strncmp (token, "reinterpret_cast", len) + || ! strncmp (token, "const_cast", len)); +} + +/* The scope used for macro expansion. */ +static struct macro_scope *expression_macro_scope; + +/* This is set if a NAME token appeared at the very end of the input + string, with no whitespace separating the name from the EOF. This + is used only when parsing to do field name completion. */ +static int saw_name_at_eof; + +/* This is set if the previously-returned token was a structure + operator -- either '.' or ARROW. */ +static bool last_was_structop; + +/* Read one token, getting characters through lexptr. */ + +static int +lex_one_token (struct parser_state *par_state, bool *is_quoted_name) +{ + int c; + int namelen; + unsigned int i; + const char *tokstart; + bool saw_structop = last_was_structop; + char *copy; + + last_was_structop = false; + *is_quoted_name = false; + + retry: + + /* Check if this is a macro invocation that we need to expand. */ + if (! scanning_macro_expansion ()) + { + char *expanded = macro_expand_next (&lexptr, + standard_macro_lookup, + expression_macro_scope); + + if (expanded) + scan_macro_expansion (expanded); + } + + prev_lexptr = lexptr; + + tokstart = lexptr; + /* See if it is a special token of length 3. */ + for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) + if (strncmp (tokstart, tokentab3[i].oper, 3) == 0) + { + if ((tokentab3[i].flags & FLAG_CXX) != 0 + && parse_language (par_state)->la_language != language_cplus) + break; + + lexptr += 3; + yylval.opcode = tokentab3[i].opcode; + return tokentab3[i].token; + } + + /* See if it is a special token of length 2. */ + for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) + if (strncmp (tokstart, tokentab2[i].oper, 2) == 0) + { + if ((tokentab2[i].flags & FLAG_CXX) != 0 + && parse_language (par_state)->la_language != language_cplus) + break; + + lexptr += 2; + yylval.opcode = tokentab2[i].opcode; + if (tokentab2[i].token == ARROW) + last_was_structop = 1; + return tokentab2[i].token; + } + + switch (c = *tokstart) + { + case 0: + /* If we were just scanning the result of a macro expansion, + then we need to resume scanning the original text. + If we're parsing for field name completion, and the previous + token allows such completion, return a COMPLETE token. + Otherwise, we were already scanning the original text, and + we're really done. */ + if (scanning_macro_expansion ()) + { + finished_macro_expansion (); + goto retry; + } + else if (saw_name_at_eof) + { + saw_name_at_eof = 0; + return COMPLETE; + } + else if (parse_completion && saw_structop) + return COMPLETE; + else + return 0; + + case ' ': + case '\t': + case '\n': + lexptr++; + goto retry; + + case '[': + case '(': + paren_depth++; + lexptr++; + if (parse_language (par_state)->la_language == language_objc + && c == '[') + return OBJC_LBRAC; + return c; + + case ']': + case ')': + if (paren_depth == 0) + return 0; + paren_depth--; + lexptr++; + return c; + + case ',': + if (comma_terminates + && paren_depth == 0 + && ! scanning_macro_expansion ()) + return 0; + lexptr++; + return c; + + case '.': + /* Might be a floating point number. */ + if (lexptr[1] < '0' || lexptr[1] > '9') + { + last_was_structop = true; + goto symbol; /* Nope, must be a symbol. */ + } + /* FALL THRU. */ + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + /* It's a number. */ + int got_dot = 0, got_e = 0, toktype; + const char *p = tokstart; + int hex = input_radix > 10; + + if (c == '0' && (p[1] == 'x' || p[1] == 'X')) + { + p += 2; + hex = 1; + } + else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D')) + { + p += 2; + hex = 0; + } + + for (;; ++p) + { + /* This test includes !hex because 'e' is a valid hex digit + and thus does not indicate a floating point number when + the radix is hex. */ + if (!hex && !got_e && (*p == 'e' || *p == 'E')) + got_dot = got_e = 1; + /* This test does not include !hex, because a '.' always indicates + a decimal floating point number regardless of the radix. */ + else if (!got_dot && *p == '.') + got_dot = 1; + else if (got_e && (p[-1] == 'e' || p[-1] == 'E') + && (*p == '-' || *p == '+')) + /* This is the sign of the exponent, not the end of the + number. */ + continue; + /* We will take any letters or digits. parse_number will + complain if past the radix, or if L or U are not final. */ + else if ((*p < '0' || *p > '9') + && ((*p < 'a' || *p > 'z') + && (*p < 'A' || *p > 'Z'))) + break; + } + toktype = parse_number (par_state, tokstart, p - tokstart, + got_dot|got_e, &yylval); + if (toktype == ERROR) + { + char *err_copy = (char *) alloca (p - tokstart + 1); + + memcpy (err_copy, tokstart, p - tokstart); + err_copy[p - tokstart] = 0; + error (_("Invalid number \"%s\"."), err_copy); + } + lexptr = p; + return toktype; + } + + case '@': + { + const char *p = &tokstart[1]; + + if (parse_language (par_state)->la_language == language_objc) + { + size_t len = strlen ("selector"); + + if (strncmp (p, "selector", len) == 0 + && (p[len] == '\0' || ISSPACE (p[len]))) + { + lexptr = p + len; + return SELECTOR; + } + else if (*p == '"') + goto parse_string; + } + + while (ISSPACE (*p)) + p++; + size_t len = strlen ("entry"); + if (strncmp (p, "entry", len) == 0 && !c_ident_is_alnum (p[len]) + && p[len] != '_') + { + lexptr = &p[len]; + return ENTRY; + } + } + /* FALLTHRU */ + case '+': + case '-': + case '*': + case '/': + case '%': + case '|': + case '&': + case '^': + case '~': + case '!': + case '<': + case '>': + case '?': + case ':': + case '=': + case '{': + case '}': + symbol: + lexptr++; + return c; + + case 'L': + case 'u': + case 'U': + if (tokstart[1] != '"' && tokstart[1] != '\'') + break; + /* Fall through. */ + case '\'': + case '"': + + parse_string: + { + int host_len; + int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval, + &host_len); + if (result == CHAR) + { + if (host_len == 0) + error (_("Empty character constant.")); + else if (host_len > 2 && c == '\'') + { + ++tokstart; + namelen = lexptr - tokstart - 1; + *is_quoted_name = true; + + goto tryname; + } + else if (host_len > 1) + error (_("Invalid character constant.")); + } + return result; + } + } + + if (!(c == '_' || c == '$' || c_ident_is_alpha (c))) + /* We must have come across a bad character (e.g. ';'). */ + error (_("Invalid character '%c' in expression."), c); + + /* It's a name. See how long it is. */ + namelen = 0; + for (c = tokstart[namelen]; + (c == '_' || c == '$' || c_ident_is_alnum (c) || c == '<');) + { + /* Template parameter lists are part of the name. + FIXME: This mishandles `print $a<4&&$a>3'. */ + + if (c == '<') + { + if (! is_cast_operator (tokstart, namelen)) + { + /* Scan ahead to get rest of the template specification. Note + that we look ahead only when the '<' adjoins non-whitespace + characters; for comparison expressions, e.g. "a < b > c", + there must be spaces before the '<', etc. */ + const char *p = find_template_name_end (tokstart + namelen); + + if (p) + namelen = p - tokstart; + } + break; + } + c = tokstart[++namelen]; + } + + /* The token "if" terminates the expression and is NOT removed from + the input stream. It doesn't count if it appears in the + expansion of a macro. */ + if (namelen == 2 + && tokstart[0] == 'i' + && tokstart[1] == 'f' + && ! scanning_macro_expansion ()) + { + return 0; + } + + /* For the same reason (breakpoint conditions), "thread N" + terminates the expression. "thread" could be an identifier, but + an identifier is never followed by a number without intervening + punctuation. "task" is similar. Handle abbreviations of these, + similarly to breakpoint.c:find_condition_and_thread. */ + if (namelen >= 1 + && (strncmp (tokstart, "thread", namelen) == 0 + || strncmp (tokstart, "task", namelen) == 0) + && (tokstart[namelen] == ' ' || tokstart[namelen] == '\t') + && ! scanning_macro_expansion ()) + { + const char *p = tokstart + namelen + 1; + + while (*p == ' ' || *p == '\t') + p++; + if (*p >= '0' && *p <= '9') + return 0; + } + + lexptr += namelen; + + tryname: + + yylval.sval.ptr = tokstart; + yylval.sval.length = namelen; + + /* Catch specific keywords. */ + copy = copy_name (yylval.sval); + for (i = 0; i < sizeof ident_tokens / sizeof ident_tokens[0]; i++) + if (strcmp (copy, ident_tokens[i].oper) == 0) + { + if ((ident_tokens[i].flags & FLAG_CXX) != 0 + && parse_language (par_state)->la_language != language_cplus) + break; + + if ((ident_tokens[i].flags & FLAG_SHADOW) != 0) + { + struct field_of_this_result is_a_field_of_this; + + if (lookup_symbol (copy, expression_context_block, + VAR_DOMAIN, + (parse_language (par_state)->la_language + == language_cplus ? &is_a_field_of_this + : NULL)).symbol + != NULL) + { + /* The keyword is shadowed. */ + break; + } + } + + /* It is ok to always set this, even though we don't always + strictly need to. */ + yylval.opcode = ident_tokens[i].opcode; + return ident_tokens[i].token; + } + + if (*tokstart == '$') + return DOLLAR_VARIABLE; + + if (parse_completion && *lexptr == '\0') + saw_name_at_eof = 1; + + yylval.ssym.stoken = yylval.sval; + yylval.ssym.sym.symbol = NULL; + yylval.ssym.sym.block = NULL; + yylval.ssym.is_a_field_of_this = 0; + return NAME; +} + +/* An object of this type is pushed on a FIFO by the "outer" lexer. */ +struct token_and_value +{ + int token; + YYSTYPE value; +}; + +/* A FIFO of tokens that have been read but not yet returned to the + parser. */ +static std::vector token_fifo; + +/* Non-zero if the lexer should return tokens from the FIFO. */ +static int popping; + +/* Temporary storage for c_lex; this holds symbol names as they are + built up. */ +auto_obstack name_obstack; + +/* Classify a NAME token. The contents of the token are in `yylval'. + Updates yylval and returns the new token type. BLOCK is the block + in which lookups start; this can be NULL to mean the global scope. + IS_QUOTED_NAME is non-zero if the name token was originally quoted + in single quotes. IS_AFTER_STRUCTOP is true if this name follows + a structure operator -- either '.' or ARROW */ + +static int +classify_name (struct parser_state *par_state, const struct block *block, + bool is_quoted_name, bool is_after_structop) +{ + struct block_symbol bsym; + char *copy; + struct field_of_this_result is_a_field_of_this; + + copy = copy_name (yylval.sval); + + /* Initialize this in case we *don't* use it in this call; that way + we can refer to it unconditionally below. */ + memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this)); + + bsym = lookup_symbol (copy, block, VAR_DOMAIN, + parse_language (par_state)->la_name_of_this + ? &is_a_field_of_this : NULL); + + if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK) + { + yylval.ssym.sym = bsym; + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + return BLOCKNAME; + } + else if (!bsym.symbol) + { + /* If we found a field of 'this', we might have erroneously + found a constructor where we wanted a type name. Handle this + case by noticing that we found a constructor and then look up + the type tag instead. */ + if (is_a_field_of_this.type != NULL + && is_a_field_of_this.fn_field != NULL + && TYPE_FN_FIELD_CONSTRUCTOR (is_a_field_of_this.fn_field->fn_fields, + 0)) + { + struct field_of_this_result inner_is_a_field_of_this; + + bsym = lookup_symbol (copy, block, STRUCT_DOMAIN, + &inner_is_a_field_of_this); + if (bsym.symbol != NULL) + { + yylval.tsym.type = SYMBOL_TYPE (bsym.symbol); + return TYPENAME; + } + } + + /* If we found a field on the "this" object, or we are looking + up a field on a struct, then we want to prefer it over a + filename. However, if the name was quoted, then it is better + to check for a filename or a block, since this is the only + way the user has of requiring the extension to be used. */ + if ((is_a_field_of_this.type == NULL && !is_after_structop) + || is_quoted_name) + { + /* See if it's a file name. */ + struct symtab *symtab; + + symtab = lookup_symtab (copy); + if (symtab) + { + yylval.bval = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), + STATIC_BLOCK); + return FILENAME; + } + } + } + + if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_TYPEDEF) + { + yylval.tsym.type = SYMBOL_TYPE (bsym.symbol); + return TYPENAME; + } + + /* See if it's an ObjC classname. */ + if (parse_language (par_state)->la_language == language_objc && !bsym.symbol) + { + CORE_ADDR Class = lookup_objc_class (parse_gdbarch (par_state), copy); + if (Class) + { + struct symbol *sym; + + yylval.theclass.theclass = Class; + sym = lookup_struct_typedef (copy, expression_context_block, 1); + if (sym) + yylval.theclass.type = SYMBOL_TYPE (sym); + return CLASSNAME; + } + } + + /* Input names that aren't symbols but ARE valid hex numbers, when + the input radix permits them, can be names or numbers depending + on the parse. Note we support radixes > 16 here. */ + if (!bsym.symbol + && ((copy[0] >= 'a' && copy[0] < 'a' + input_radix - 10) + || (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10))) + { + YYSTYPE newlval; /* Its value is ignored. */ + int hextype = parse_number (par_state, copy, yylval.sval.length, + 0, &newlval); + + if (hextype == INT) + { + yylval.ssym.sym = bsym; + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + return NAME_OR_INT; + } + } + + /* Any other kind of symbol */ + yylval.ssym.sym = bsym; + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + + if (bsym.symbol == NULL + && parse_language (par_state)->la_language == language_cplus + && is_a_field_of_this.type == NULL + && lookup_minimal_symbol (copy, NULL, NULL).minsym == NULL) + return UNKNOWN_CPP_NAME; + + return NAME; +} + +/* Like classify_name, but used by the inner loop of the lexer, when a + name might have already been seen. CONTEXT is the context type, or + NULL if this is the first component of a name. */ + +static int +classify_inner_name (struct parser_state *par_state, + const struct block *block, struct type *context) +{ + struct type *type; + char *copy; + + if (context == NULL) + return classify_name (par_state, block, false, false); + + type = check_typedef (context); + if (!type_aggregate_p (type)) + return ERROR; + + copy = copy_name (yylval.ssym.stoken); + /* N.B. We assume the symbol can only be in VAR_DOMAIN. */ + yylval.ssym.sym = cp_lookup_nested_symbol (type, copy, block, VAR_DOMAIN); + + /* If no symbol was found, search for a matching base class named + COPY. This will allow users to enter qualified names of class members + relative to the `this' pointer. */ + if (yylval.ssym.sym.symbol == NULL) + { + struct type *base_type = cp_find_type_baseclass_by_name (type, copy); + + if (base_type != NULL) + { + yylval.tsym.type = base_type; + return TYPENAME; + } + + return ERROR; + } + + switch (SYMBOL_CLASS (yylval.ssym.sym.symbol)) + { + case LOC_BLOCK: + case LOC_LABEL: + /* cp_lookup_nested_symbol might have accidentally found a constructor + named COPY when we really wanted a base class of the same name. + Double-check this case by looking for a base class. */ + { + struct type *base_type = cp_find_type_baseclass_by_name (type, copy); + + if (base_type != NULL) + { + yylval.tsym.type = base_type; + return TYPENAME; + } + } + return ERROR; + + case LOC_TYPEDEF: + yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym.symbol); + return TYPENAME; + + default: + return NAME; + } + internal_error (__FILE__, __LINE__, _("not reached")); +} + +/* The outer level of a two-level lexer. This calls the inner lexer + to return tokens. It then either returns these tokens, or + aggregates them into a larger token. This lets us work around a + problem in our parsing approach, where the parser could not + distinguish between qualified names and qualified types at the + right point. + + This approach is still not ideal, because it mishandles template + types. See the comment in lex_one_token for an example. However, + this is still an improvement over the earlier approach, and will + suffice until we move to better parsing technology. */ + +static int +yylex (void) +{ + token_and_value current; + int first_was_coloncolon, last_was_coloncolon; + struct type *context_type = NULL; + int last_to_examine, next_to_examine, checkpoint; + const struct block *search_block; + bool is_quoted_name, last_lex_was_structop; + + if (popping && !token_fifo.empty ()) + goto do_pop; + popping = 0; + + last_lex_was_structop = last_was_structop; + + /* Read the first token and decide what to do. Most of the + subsequent code is C++-only; but also depends on seeing a "::" or + name-like token. */ + current.token = lex_one_token (pstate, &is_quoted_name); + if (current.token == NAME) + current.token = classify_name (pstate, expression_context_block, + is_quoted_name, last_lex_was_structop); + if (parse_language (pstate)->la_language != language_cplus + || (current.token != TYPENAME && current.token != COLONCOLON + && current.token != FILENAME)) + return current.token; + + /* Read any sequence of alternating "::" and name-like tokens into + the token FIFO. */ + current.value = yylval; + token_fifo.push_back (current); + last_was_coloncolon = current.token == COLONCOLON; + while (1) + { + bool ignore; + + /* We ignore quoted names other than the very first one. + Subsequent ones do not have any special meaning. */ + current.token = lex_one_token (pstate, &ignore); + current.value = yylval; + token_fifo.push_back (current); + + if ((last_was_coloncolon && current.token != NAME) + || (!last_was_coloncolon && current.token != COLONCOLON)) + break; + last_was_coloncolon = !last_was_coloncolon; + } + popping = 1; + + /* We always read one extra token, so compute the number of tokens + to examine accordingly. */ + last_to_examine = token_fifo.size () - 2; + next_to_examine = 0; + + current = token_fifo[next_to_examine]; + ++next_to_examine; + + name_obstack.clear (); + checkpoint = 0; + if (current.token == FILENAME) + search_block = current.value.bval; + else if (current.token == COLONCOLON) + search_block = NULL; + else + { + gdb_assert (current.token == TYPENAME); + search_block = expression_context_block; + obstack_grow (&name_obstack, current.value.sval.ptr, + current.value.sval.length); + context_type = current.value.tsym.type; + checkpoint = 1; + } + + first_was_coloncolon = current.token == COLONCOLON; + last_was_coloncolon = first_was_coloncolon; + + while (next_to_examine <= last_to_examine) + { + token_and_value next; + + next = token_fifo[next_to_examine]; + ++next_to_examine; + + if (next.token == NAME && last_was_coloncolon) + { + int classification; + + yylval = next.value; + classification = classify_inner_name (pstate, search_block, + context_type); + /* We keep going until we either run out of names, or until + we have a qualified name which is not a type. */ + if (classification != TYPENAME && classification != NAME) + break; + + /* Accept up to this token. */ + checkpoint = next_to_examine; + + /* Update the partial name we are constructing. */ + if (context_type != NULL) + { + /* We don't want to put a leading "::" into the name. */ + obstack_grow_str (&name_obstack, "::"); + } + obstack_grow (&name_obstack, next.value.sval.ptr, + next.value.sval.length); + + yylval.sval.ptr = (const char *) obstack_base (&name_obstack); + yylval.sval.length = obstack_object_size (&name_obstack); + current.value = yylval; + current.token = classification; + + last_was_coloncolon = 0; + + if (classification == NAME) + break; + + context_type = yylval.tsym.type; + } + else if (next.token == COLONCOLON && !last_was_coloncolon) + last_was_coloncolon = 1; + else + { + /* We've reached the end of the name. */ + break; + } + } + + /* If we have a replacement token, install it as the first token in + the FIFO, and delete the other constituent tokens. */ + if (checkpoint > 0) + { + current.value.sval.ptr + = (const char *) obstack_copy0 (&cpstate->expansion_obstack, + current.value.sval.ptr, + current.value.sval.length); + + token_fifo[0] = current; + if (checkpoint > 1) + token_fifo.erase (token_fifo.begin () + 1, + token_fifo.begin () + checkpoint); + } + + do_pop: + current = token_fifo[0]; + token_fifo.erase (token_fifo.begin ()); + yylval = current.value; + return current.token; +} + +int +c_parse (struct parser_state *par_state) +{ + /* Setting up the parser state. */ + scoped_restore pstate_restore = make_scoped_restore (&pstate); + gdb_assert (par_state != NULL); + pstate = par_state; + + c_parse_state cstate; + scoped_restore cstate_restore = make_scoped_restore (&cpstate, &cstate); + + gdb::unique_xmalloc_ptr macro_scope; + + if (expression_context_block) + macro_scope = sal_macro_scope (find_pc_line (expression_context_pc, 0)); + else + macro_scope = default_macro_scope (); + if (! macro_scope) + macro_scope = user_macro_scope (); + + scoped_restore restore_macro_scope + = make_scoped_restore (&expression_macro_scope, macro_scope.get ()); + + scoped_restore restore_yydebug = make_scoped_restore (&yydebug, + parser_debug); + + /* Initialize some state used by the lexer. */ + last_was_structop = false; + saw_name_at_eof = 0; + + token_fifo.clear (); + popping = 0; + name_obstack.clear (); + + return yyparse (); +} + +#ifdef YYBISON + +/* This is called via the YYPRINT macro when parser debugging is + enabled. It prints a token's value. */ + +static void +c_print_token (FILE *file, int type, YYSTYPE value) +{ + switch (type) + { + case INT: + parser_fprintf (file, "typed_val_int<%s, %s>", + TYPE_SAFE_NAME (value.typed_val_int.type), + pulongest (value.typed_val_int.val)); + break; + + case CHAR: + case STRING: + { + char *copy = (char *) alloca (value.tsval.length + 1); + + memcpy (copy, value.tsval.ptr, value.tsval.length); + copy[value.tsval.length] = '\0'; + + parser_fprintf (file, "tsval", value.tsval.type, copy); + } + break; + + case NSSTRING: + case DOLLAR_VARIABLE: + parser_fprintf (file, "sval<%s>", copy_name (value.sval)); + break; + + case TYPENAME: + parser_fprintf (file, "tsym", + TYPE_SAFE_NAME (value.tsym.type), + copy_name (value.tsym.stoken)); + break; + + case NAME: + case UNKNOWN_CPP_NAME: + case NAME_OR_INT: + case BLOCKNAME: + parser_fprintf (file, "ssym", + copy_name (value.ssym.stoken), + (value.ssym.sym.symbol == NULL + ? "(null)" : SYMBOL_PRINT_NAME (value.ssym.sym.symbol)), + value.ssym.is_a_field_of_this); + break; + + case FILENAME: + parser_fprintf (file, "bval<%s>", host_address_to_string (value.bval)); + break; + } +} + +#endif + +static void +yyerror (const char *msg) +{ + if (prev_lexptr) + lexptr = prev_lexptr; + + error (_("A %s in expression, near `%s'."), msg, lexptr); +} diff --git a/gdb-8.3.1/gdb/cp-name-parser.c b/gdb-8.3.1/gdb/cp-name-parser.c new file mode 100644 index 0000000000000000000000000000000000000000..9824e58f603533112481d769f7c8aa005bc0b8d6 --- /dev/null +++ b/gdb-8.3.1/gdb/cp-name-parser.c @@ -0,0 +1,4386 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* Copy the first part of user declarations. */ +#line 38 "cp-name-parser.y" /* yacc.c:339 */ + + +#include "defs.h" + +#include +#include "safe-ctype.h" +#include "demangle.h" +#include "cp-support.h" +#include "c-support.h" +#include "parser-defs.h" + +#define GDB_YY_REMAP_PREFIX cpname +#include "yy-remap.h" + +/* The components built by the parser are allocated ahead of time, + and cached in this structure. */ + +#define ALLOC_CHUNK 100 + +struct demangle_info { + int used; + struct demangle_info *next; + struct demangle_component comps[ALLOC_CHUNK]; +}; + + +#line 93 "cp-name-parser.c.tmp" /* yacc.c:339 */ + +# ifndef YY_NULLPTRPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTRPTR nullptr +# else +# define YY_NULLPTRPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + INT = 258, + FLOAT = 259, + NAME = 260, + STRUCT = 261, + CLASS = 262, + UNION = 263, + ENUM = 264, + SIZEOF = 265, + UNSIGNED = 266, + COLONCOLON = 267, + TEMPLATE = 268, + ERROR = 269, + NEW = 270, + DELETE = 271, + OPERATOR = 272, + STATIC_CAST = 273, + REINTERPRET_CAST = 274, + DYNAMIC_CAST = 275, + SIGNED_KEYWORD = 276, + LONG = 277, + SHORT = 278, + INT_KEYWORD = 279, + CONST_KEYWORD = 280, + VOLATILE_KEYWORD = 281, + DOUBLE_KEYWORD = 282, + BOOL = 283, + ELLIPSIS = 284, + RESTRICT = 285, + VOID = 286, + FLOAT_KEYWORD = 287, + CHAR = 288, + WCHAR_T = 289, + ASSIGN_MODIFY = 290, + TRUEKEYWORD = 291, + FALSEKEYWORD = 292, + DEMANGLER_SPECIAL = 293, + CONSTRUCTION_VTABLE = 294, + CONSTRUCTION_IN = 295, + OROR = 296, + ANDAND = 297, + EQUAL = 298, + NOTEQUAL = 299, + LEQ = 300, + GEQ = 301, + LSH = 302, + RSH = 303, + UNARY = 304, + INCREMENT = 305, + DECREMENT = 306, + ARROW = 307 + }; +#endif +/* Tokens. */ +#define INT 258 +#define FLOAT 259 +#define NAME 260 +#define STRUCT 261 +#define CLASS 262 +#define UNION 263 +#define ENUM 264 +#define SIZEOF 265 +#define UNSIGNED 266 +#define COLONCOLON 267 +#define TEMPLATE 268 +#define ERROR 269 +#define NEW 270 +#define DELETE 271 +#define OPERATOR 272 +#define STATIC_CAST 273 +#define REINTERPRET_CAST 274 +#define DYNAMIC_CAST 275 +#define SIGNED_KEYWORD 276 +#define LONG 277 +#define SHORT 278 +#define INT_KEYWORD 279 +#define CONST_KEYWORD 280 +#define VOLATILE_KEYWORD 281 +#define DOUBLE_KEYWORD 282 +#define BOOL 283 +#define ELLIPSIS 284 +#define RESTRICT 285 +#define VOID 286 +#define FLOAT_KEYWORD 287 +#define CHAR 288 +#define WCHAR_T 289 +#define ASSIGN_MODIFY 290 +#define TRUEKEYWORD 291 +#define FALSEKEYWORD 292 +#define DEMANGLER_SPECIAL 293 +#define CONSTRUCTION_VTABLE 294 +#define CONSTRUCTION_IN 295 +#define OROR 296 +#define ANDAND 297 +#define EQUAL 298 +#define NOTEQUAL 299 +#define LEQ 300 +#define GEQ 301 +#define LSH 302 +#define RSH 303 +#define UNARY 304 +#define INCREMENT 305 +#define DECREMENT 306 +#define ARROW 307 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE +{ +#line 66 "cp-name-parser.y" /* yacc.c:355 */ + + struct demangle_component *comp; + struct nested { + struct demangle_component *comp; + struct demangle_component **last; + } nested; + struct { + struct demangle_component *comp, *last; + } nested1; + struct { + struct demangle_component *comp, **last; + struct nested fn; + struct demangle_component *start; + int fold_flag; + } abstract; + int lval; + const char *opname; + + +#line 254 "cp-name-parser.c.tmp" /* yacc.c:355 */ +}; + +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +int yyparse (struct cpname_state *state); + + + +/* Copy the second part of user declarations. */ +#line 85 "cp-name-parser.y" /* yacc.c:358 */ + + +struct cpname_state +{ + /* LEXPTR is the current pointer into our lex buffer. PREV_LEXPTR + is the start of the last token lexed, only used for diagnostics. + ERROR_LEXPTR is the first place an error occurred. GLOBAL_ERRMSG + is the first error message encountered. */ + + const char *lexptr, *prev_lexptr, *error_lexptr, *global_errmsg; + + struct demangle_info *demangle_info; + + /* The parse tree created by the parser is stored here after a + successful parse. */ + + struct demangle_component *global_result; + + struct demangle_component *d_grab (); + + /* Helper functions. These wrap the demangler tree interface, + handle allocation from our global store, and return the allocated + component. */ + + struct demangle_component *fill_comp (enum demangle_component_type d_type, + struct demangle_component *lhs, + struct demangle_component *rhs); + + struct demangle_component *make_operator (const char *name, int args); + + struct demangle_component *make_dtor (enum gnu_v3_dtor_kinds kind, + struct demangle_component *name); + + struct demangle_component *make_builtin_type (const char *name); + + struct demangle_component *make_name (const char *name, int len); + + struct demangle_component *d_qualify (struct demangle_component *lhs, + int qualifiers, int is_method); + + struct demangle_component *d_int_type (int flags); + + struct demangle_component *d_unary (const char *name, + struct demangle_component *lhs); + + struct demangle_component *d_binary (const char *name, + struct demangle_component *lhs, + struct demangle_component *rhs); + + int parse_number (const char *p, int len, int parsed_float, YYSTYPE *lvalp); +}; + +struct demangle_component * +cpname_state::d_grab () +{ + struct demangle_info *more; + + if (demangle_info->used >= ALLOC_CHUNK) + { + if (demangle_info->next == NULL) + { + more = XNEW (struct demangle_info); + more->next = NULL; + demangle_info->next = more; + } + else + more = demangle_info->next; + + more->used = 0; + demangle_info = more; + } + return &demangle_info->comps[demangle_info->used++]; +} + +/* Flags passed to d_qualify. */ + +#define QUAL_CONST 1 +#define QUAL_RESTRICT 2 +#define QUAL_VOLATILE 4 + +/* Flags passed to d_int_type. */ + +#define INT_CHAR (1 << 0) +#define INT_SHORT (1 << 1) +#define INT_LONG (1 << 2) +#define INT_LLONG (1 << 3) + +#define INT_SIGNED (1 << 4) +#define INT_UNSIGNED (1 << 5) + +/* Enable yydebug for the stand-alone parser. */ +#ifdef TEST_CPNAMES +# define YYDEBUG 1 +#endif + +/* Helper functions. These wrap the demangler tree interface, handle + allocation from our global store, and return the allocated component. */ + +struct demangle_component * +cpname_state::fill_comp (enum demangle_component_type d_type, + struct demangle_component *lhs, + struct demangle_component *rhs) +{ + struct demangle_component *ret = d_grab (); + int i; + + i = cplus_demangle_fill_component (ret, d_type, lhs, rhs); + gdb_assert (i); + + return ret; +} + +struct demangle_component * +cpname_state::make_operator (const char *name, int args) +{ + struct demangle_component *ret = d_grab (); + int i; + + i = cplus_demangle_fill_operator (ret, name, args); + gdb_assert (i); + + return ret; +} + +struct demangle_component * +cpname_state::make_dtor (enum gnu_v3_dtor_kinds kind, + struct demangle_component *name) +{ + struct demangle_component *ret = d_grab (); + int i; + + i = cplus_demangle_fill_dtor (ret, kind, name); + gdb_assert (i); + + return ret; +} + +struct demangle_component * +cpname_state::make_builtin_type (const char *name) +{ + struct demangle_component *ret = d_grab (); + int i; + + i = cplus_demangle_fill_builtin_type (ret, name); + gdb_assert (i); + + return ret; +} + +struct demangle_component * +cpname_state::make_name (const char *name, int len) +{ + struct demangle_component *ret = d_grab (); + int i; + + i = cplus_demangle_fill_name (ret, name, len); + gdb_assert (i); + + return ret; +} + +#define d_left(dc) (dc)->u.s_binary.left +#define d_right(dc) (dc)->u.s_binary.right + +static int yylex (YYSTYPE *, cpname_state *); +static void yyerror (cpname_state *, const char *); + +#line 437 "cp-name-parser.c.tmp" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or xmalloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined xmalloc) \ + && (defined YYFREE || defined xfree))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC xmalloc +# if ! defined xmalloc && ! defined EXIT_SUCCESS +void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE xfree +# if ! defined xfree && ! defined EXIT_SUCCESS +void xfree (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 84 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 1137 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 75 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 40 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 195 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 325 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 307 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 72, 2, 2, 2, 63, 49, 2, + 73, 41, 61, 59, 42, 60, 68, 62, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 74, 2, + 52, 43, 53, 44, 58, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 69, 2, 70, 48, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 47, 2, 71, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 45, 46, 50, 51, + 54, 55, 56, 57, 64, 65, 66, 67 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 348, 348, 352, 354, 356, 361, 362, 369, 378, + 385, 389, 392, 411, 413, 417, 423, 429, 435, 441, + 443, 445, 447, 449, 451, 453, 455, 457, 459, 461, + 463, 465, 467, 469, 471, 473, 475, 477, 479, 481, + 483, 485, 487, 489, 491, 493, 495, 497, 505, 510, + 515, 519, 524, 532, 533, 535, 547, 548, 554, 556, + 557, 559, 562, 563, 566, 567, 571, 573, 576, 580, + 585, 589, 598, 602, 605, 616, 617, 621, 623, 625, + 628, 632, 637, 642, 648, 658, 662, 666, 674, 675, + 678, 680, 682, 686, 687, 694, 696, 698, 700, 702, + 704, 708, 709, 713, 715, 717, 719, 721, 723, 725, + 729, 734, 737, 740, 746, 754, 756, 770, 772, 773, + 775, 778, 780, 781, 783, 786, 788, 790, 792, 797, + 800, 805, 812, 816, 827, 833, 851, 854, 862, 864, + 875, 882, 883, 889, 893, 897, 899, 904, 909, 921, + 925, 929, 937, 942, 951, 955, 960, 965, 969, 975, + 981, 984, 991, 993, 998, 1002, 1006, 1013, 1029, 1036, + 1043, 1062, 1066, 1070, 1074, 1078, 1082, 1086, 1090, 1094, + 1098, 1102, 1106, 1110, 1114, 1118, 1122, 1126, 1131, 1135, + 1139, 1146, 1150, 1153, 1162, 1171 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "INT", "FLOAT", "NAME", "STRUCT", + "CLASS", "UNION", "ENUM", "SIZEOF", "UNSIGNED", "COLONCOLON", "TEMPLATE", + "ERROR", "NEW", "DELETE", "OPERATOR", "STATIC_CAST", "REINTERPRET_CAST", + "DYNAMIC_CAST", "SIGNED_KEYWORD", "LONG", "SHORT", "INT_KEYWORD", + "CONST_KEYWORD", "VOLATILE_KEYWORD", "DOUBLE_KEYWORD", "BOOL", + "ELLIPSIS", "RESTRICT", "VOID", "FLOAT_KEYWORD", "CHAR", "WCHAR_T", + "ASSIGN_MODIFY", "TRUEKEYWORD", "FALSEKEYWORD", "DEMANGLER_SPECIAL", + "CONSTRUCTION_VTABLE", "CONSTRUCTION_IN", "')'", "','", "'='", "'?'", + "OROR", "ANDAND", "'|'", "'^'", "'&'", "EQUAL", "NOTEQUAL", "'<'", "'>'", + "LEQ", "GEQ", "LSH", "RSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'", + "UNARY", "INCREMENT", "DECREMENT", "ARROW", "'.'", "'['", "']'", "'~'", + "'!'", "'('", "':'", "$accept", "result", "start", "start_opt", + "function", "demangler_special", "oper", "conversion_op", + "conversion_op_name", "unqualified_name", "colon_name", "name", + "colon_ext_name", "colon_ext_only", "ext_only_name", "nested_name", + "templ", "template_params", "template_arg", "function_args", + "function_arglist", "qualifiers_opt", "qualifier", "qualifiers", + "int_part", "int_seq", "builtin_type", "ptr_operator", "array_indicator", + "typespec_2", "abstract_declarator", "direct_abstract_declarator", + "abstract_declarator_fn", "type", "declarator", "direct_declarator", + "declarator_1", "direct_declarator_1", "exp", "exp1", YY_NULLPTRPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 41, 44, 61, 63, 296, 297, 124, 94, 38, + 298, 299, 60, 62, 300, 301, 302, 303, 64, 43, + 45, 42, 47, 37, 304, 305, 306, 307, 46, 91, + 93, 126, 33, 40, 58 +}; +# endif + +#define YYPACT_NINF -187 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-187))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 833, 39, -187, 42, 540, -187, -12, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, 833, 833, + 27, 41, -187, -187, -187, 5, -187, 710, -187, 36, + -5, -187, 43, 65, 36, 506, -187, 120, 36, 711, + -187, -187, 329, -187, 36, -187, 43, 73, 16, 21, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, -187, -187, -187, -187, -187, -187, -187, + -187, -187, -187, 34, 30, -187, -187, 64, 115, -187, + -187, -187, 83, -187, -187, 329, 39, 833, -187, -187, + 36, 6, 603, -187, 12, 65, 98, 750, -187, -49, + -187, -187, 857, 98, 70, -187, -187, 124, -187, -187, + 73, 36, 36, -187, -187, -187, 48, 860, 603, -187, + -187, -49, -187, 23, 98, 720, -187, -49, -187, -49, + -187, -187, 53, 80, 87, 95, -187, -187, 656, 476, + 476, 476, 428, 10, -187, 780, 325, -187, -187, 79, + 82, -187, -187, -187, 833, 22, -187, 28, -187, -187, + 89, -187, 73, 116, 36, 780, 37, 114, 780, 780, + 123, 70, 36, 124, 833, -187, 161, -187, 166, -187, + -187, -187, -187, 36, -187, -187, -187, 50, 729, 168, + -187, -187, 780, -187, -187, -187, 169, -187, 979, 979, + 979, 979, 833, -187, 105, 105, 105, 680, 780, 142, + 970, 143, 329, -187, -187, 476, 476, 476, 476, 476, + 476, 476, 476, 476, 476, 476, 476, 476, 476, 476, + 476, 476, 476, 180, 181, -187, -187, -187, -187, 36, + -187, 45, 36, -187, 36, 949, -187, -187, -187, 51, + 833, -187, 729, -187, 729, 148, -49, 833, 833, 152, + 138, 141, 144, 154, 833, -187, 476, 476, -187, -187, + 890, 993, 1015, 1036, 1056, 359, 753, 753, 1069, 1069, + 1069, 241, 241, 178, 178, 105, 105, 105, -187, -187, + -187, -187, -187, -187, 780, -187, 157, -187, -187, -187, + -187, -187, -187, -187, 126, 128, 131, -187, 164, 105, + 325, 476, -187, -187, 471, 471, 471, -187, 325, 188, + 189, 192, -187, -187, -187 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 59, 97, 0, 0, 96, 99, 100, 95, 92, + 91, 105, 107, 90, 109, 104, 98, 108, 0, 0, + 0, 0, 2, 5, 4, 53, 50, 6, 67, 122, + 0, 64, 0, 61, 93, 0, 101, 103, 118, 141, + 3, 68, 0, 52, 126, 65, 0, 0, 15, 16, + 32, 43, 29, 40, 39, 26, 24, 25, 35, 36, + 30, 31, 37, 38, 33, 34, 19, 20, 21, 22, + 23, 41, 42, 45, 0, 27, 28, 0, 0, 48, + 106, 13, 0, 55, 1, 0, 0, 0, 112, 111, + 88, 0, 0, 11, 0, 0, 6, 136, 135, 138, + 12, 121, 0, 6, 58, 49, 66, 60, 70, 94, + 0, 124, 120, 99, 102, 117, 0, 0, 0, 62, + 56, 150, 63, 0, 6, 129, 142, 131, 8, 151, + 191, 192, 0, 0, 0, 0, 194, 195, 0, 0, + 0, 0, 0, 0, 73, 75, 79, 125, 51, 0, + 0, 44, 47, 46, 0, 0, 7, 0, 110, 89, + 0, 115, 0, 109, 88, 0, 0, 0, 129, 80, + 0, 0, 88, 0, 0, 140, 0, 137, 133, 134, + 10, 69, 71, 128, 123, 119, 57, 0, 129, 157, + 158, 9, 0, 130, 149, 133, 155, 156, 0, 0, + 0, 0, 0, 77, 164, 166, 165, 0, 141, 0, + 160, 0, 0, 72, 76, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 17, 18, 14, 54, 88, + 116, 0, 88, 87, 88, 0, 81, 132, 113, 0, + 0, 127, 0, 148, 129, 0, 144, 0, 0, 0, + 0, 0, 0, 0, 0, 162, 0, 0, 159, 74, + 0, 187, 186, 185, 184, 183, 178, 179, 182, 180, + 181, 176, 177, 174, 175, 171, 172, 173, 188, 189, + 114, 86, 85, 84, 82, 139, 0, 143, 154, 146, + 147, 152, 153, 193, 0, 0, 0, 78, 0, 167, + 161, 0, 83, 145, 0, 0, 0, 163, 190, 0, + 0, 0, 168, 170, 169 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -187, -187, 25, -66, -187, -187, -187, 3, -187, -20, + -187, -1, -32, 15, 1, 0, 150, 149, 31, -187, + -25, -156, -187, 234, 205, -187, 213, -17, -98, 196, + -18, -16, 158, -129, -106, -187, 134, -187, -6, -186 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 21, 156, 93, 23, 24, 25, 26, 27, 28, + 119, 29, 253, 30, 31, 78, 33, 143, 144, 167, + 96, 158, 34, 35, 36, 37, 38, 168, 98, 39, + 170, 127, 100, 40, 255, 256, 128, 129, 210, 211 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint16 yytable[] = +{ + 32, 179, 44, 46, 45, 103, 43, 121, 243, 160, + 97, 99, 106, 209, 124, 80, 248, 171, 32, 32, + 91, 126, 125, 190, 102, 22, 106, 94, 104, 179, + 175, 197, 83, 104, 111, 105, 146, 180, 120, 123, + 117, 84, 104, 81, 82, 4, 44, 1, 104, 148, + 104, 41, 212, 1, 122, 104, 171, 85, 191, 4, + 4, 9, 10, 213, 212, 117, 13, 117, 102, 259, + 260, 261, 262, 172, 178, 238, 161, 108, 1, 146, + 97, 99, 181, 290, 172, 149, 291, 157, 292, 239, + 150, 42, 166, 121, 20, 151, 189, 94, 172, 20, + 152, 188, 195, 106, 196, 153, 239, 193, 125, 183, + 174, 239, 239, 20, 20, 186, 187, 45, 166, 20, + 104, 20, 42, 154, 120, 123, 198, 214, 319, 320, + 321, 2, 199, 204, 205, 206, 182, 106, 32, 200, + 122, 5, 113, 7, 8, 94, 296, 201, 297, 235, + 193, 246, 236, 16, 32, 244, 245, 242, 300, 240, + 105, 44, 241, 203, 247, 94, 86, 106, 94, 94, + 193, 254, 233, 234, 32, 188, 249, 95, 250, 237, + 257, 258, 107, 266, 268, 288, 289, 120, 123, 298, + 126, 304, 94, 303, 305, 307, 107, 306, 313, 314, + 79, 315, 32, 122, 316, 317, 146, 32, 94, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 263, 107, 322, + 323, 299, 265, 324, 155, 254, 193, 254, 145, 230, + 231, 232, 114, 269, 173, 233, 234, 95, 112, 0, + 32, 120, 123, 120, 123, 177, 0, 32, 32, 194, + 309, 310, 0, 101, 32, 0, 0, 122, 109, 122, + 0, 0, 115, 107, 0, 295, 312, 0, 147, 0, + 0, 145, 301, 302, 0, 0, 0, 0, 169, 308, + 0, 0, 0, 0, 94, 95, 0, 0, 169, 0, + 228, 229, 230, 231, 232, 318, 0, 107, 233, 234, + 0, 0, 0, 0, 169, 95, 107, 0, 95, 95, + 0, 0, 0, 0, 159, 0, 95, 0, 0, 0, + 0, 0, 130, 131, 1, 0, 0, 107, 208, 132, + 2, 47, 95, 0, 0, 184, 185, 133, 134, 135, + 5, 6, 7, 8, 9, 10, 11, 12, 95, 13, + 14, 15, 16, 17, 0, 136, 137, 0, 0, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 138, 224, + 225, 226, 227, 0, 228, 229, 230, 231, 232, 139, + 0, 107, 233, 234, 208, 208, 208, 208, 159, 173, + 140, 141, 142, 0, 0, 0, 159, 0, 145, 221, + 222, 223, 0, 224, 225, 226, 227, 251, 228, 229, + 230, 231, 232, 0, 0, 0, 233, 234, 0, 0, + 0, 130, 131, 1, 0, 0, 0, 0, 132, 2, + 47, 294, 0, 0, 95, 0, 133, 134, 135, 5, + 6, 7, 8, 9, 10, 11, 12, 0, 13, 14, + 15, 16, 17, 0, 136, 137, 0, 0, 0, 0, + 0, 0, 0, 159, 130, 131, 159, 207, 159, 130, + 131, 132, 0, 0, 0, 0, 132, 0, 139, 133, + 134, 135, 0, 0, 133, 134, 135, 0, 0, 140, + 141, 142, 0, 0, 0, 0, 0, 136, 137, 0, + 0, 1, 136, 137, 0, 0, 0, 2, 110, 0, + 207, 0, 0, 0, 0, 0, 0, 5, 6, 7, + 8, 139, 0, 11, 12, 0, 139, 14, 15, 16, + 17, 0, 140, 141, 142, 1, 0, 140, 141, 142, + 0, 2, 47, 0, 0, 48, 49, 0, 0, 0, + 0, 5, 6, 7, 8, 9, 10, 11, 12, 0, + 13, 14, 15, 16, 17, 50, 0, 0, 0, 0, + 0, 0, 51, 52, 0, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 0, 66, + 67, 68, 69, 70, 0, 71, 72, 73, 1, 74, + 0, 75, 76, 77, 2, 162, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 6, 7, 8, 9, 10, + 11, 12, 0, 13, 163, 15, 16, 17, 0, 0, + 0, 0, 0, 0, 164, 0, 0, 0, 0, 88, + 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 90, 0, 0, 2, 3, 0, + 0, 0, 91, 4, 0, 0, 165, 5, 6, 7, + 8, 9, 10, 11, 12, 1, 13, 14, 15, 16, + 17, 2, 3, 0, 18, 19, 0, 4, 0, 0, + 0, 5, 6, 7, 8, 9, 10, 11, 12, 0, + 13, 14, 15, 16, 17, 86, 1, 0, 18, 19, + 0, 0, 87, 116, 0, 1, 0, 20, 117, 202, + 0, 0, 116, 0, 1, 0, 0, 117, 0, 0, + 0, 116, 0, 0, 0, 0, 117, 0, 0, 0, + 0, 20, 0, 264, 0, 86, 88, 88, 0, 89, + 89, 0, 176, 0, 0, 0, 88, 0, 0, 89, + 0, 90, 90, 0, 0, 88, 0, 0, 89, 91, + 91, 90, 20, 92, 118, 86, 0, 0, 0, 91, + 90, 20, 176, 192, 0, 0, 88, 0, 91, 89, + 20, 0, 252, 0, 0, 223, 0, 224, 225, 226, + 227, 90, 228, 229, 230, 231, 232, 0, 0, 91, + 233, 234, 0, 92, 0, 0, 88, 0, 0, 89, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 90, 0, 0, 2, 3, 0, 0, 0, 91, + 4, 0, 0, 165, 5, 6, 7, 8, 9, 10, + 11, 12, 1, 13, 14, 15, 16, 17, 2, 47, + 0, 18, 19, 0, 0, 48, 49, 0, 5, 6, + 7, 8, 9, 10, 11, 12, 0, 13, 163, 15, + 16, 17, 0, 0, 0, 50, 0, 0, 164, 0, + 0, 0, 51, 52, 20, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 0, 66, + 67, 68, 69, 70, 0, 71, 72, 73, 0, 74, + 0, 75, 76, 77, 215, 216, 217, 218, 219, 220, + 221, 222, 223, 0, 224, 225, 226, 227, 0, 228, + 229, 230, 231, 232, 1, 0, 0, 233, 234, 0, + 2, 47, 0, 0, 311, 0, 0, 0, 0, 0, + 5, 6, 7, 8, 9, 10, 11, 12, 293, 13, + 14, 15, 16, 17, 1, 0, 0, 0, 0, 0, + 2, 47, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 6, 7, 8, 9, 10, 11, 12, 0, 13, + 14, 15, 16, 17, 215, 216, 217, 218, 219, 220, + 221, 222, 223, 267, 224, 225, 226, 227, 0, 228, + 229, 230, 231, 232, 0, 0, 0, 233, 234, 217, + 218, 219, 220, 221, 222, 223, 0, 224, 225, 226, + 227, 0, 228, 229, 230, 231, 232, 0, 0, 0, + 233, 234, 218, 219, 220, 221, 222, 223, 0, 224, + 225, 226, 227, 0, 228, 229, 230, 231, 232, 0, + 0, 0, 233, 234, 219, 220, 221, 222, 223, 0, + 224, 225, 226, 227, 0, 228, 229, 230, 231, 232, + 0, 0, 0, 233, 234, 220, 221, 222, 223, 0, + 224, 225, 226, 227, 0, 228, 229, 230, 231, 232, + 0, 0, 0, 233, 234, 226, 227, 0, 228, 229, + 230, 231, 232, 0, 0, 0, 233, 234 +}; + +static const yytype_int16 yycheck[] = +{ + 0, 99, 3, 3, 3, 30, 3, 39, 164, 3, + 27, 27, 32, 142, 39, 27, 172, 5, 18, 19, + 69, 39, 39, 121, 73, 0, 46, 27, 5, 127, + 96, 129, 5, 5, 35, 32, 42, 103, 39, 39, + 17, 0, 5, 18, 19, 17, 47, 5, 5, 46, + 5, 12, 42, 5, 39, 5, 5, 52, 124, 17, + 17, 25, 26, 53, 42, 17, 30, 17, 73, 198, + 199, 200, 201, 61, 99, 53, 70, 12, 5, 85, + 97, 97, 12, 239, 61, 69, 242, 87, 244, 61, + 69, 52, 92, 125, 71, 61, 121, 97, 61, 71, + 70, 118, 127, 123, 129, 41, 61, 125, 125, 110, + 12, 61, 61, 71, 71, 116, 116, 116, 118, 71, + 5, 71, 52, 40, 125, 125, 73, 145, 314, 315, + 316, 11, 52, 139, 140, 141, 12, 157, 138, 52, + 125, 21, 22, 23, 24, 145, 252, 52, 254, 70, + 168, 169, 70, 33, 154, 41, 42, 41, 256, 70, + 157, 162, 162, 138, 41, 165, 5, 187, 168, 169, + 188, 188, 67, 68, 174, 192, 176, 27, 12, 154, + 12, 12, 32, 41, 41, 5, 5, 188, 188, 41, + 208, 53, 192, 41, 53, 41, 46, 53, 41, 73, + 4, 73, 202, 188, 73, 41, 212, 207, 208, 215, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 231, 232, 202, 78, 41, + 41, 256, 207, 41, 85, 252, 254, 254, 42, 61, + 62, 63, 37, 212, 94, 67, 68, 97, 35, -1, + 250, 252, 252, 254, 254, 97, -1, 257, 258, 125, + 266, 267, -1, 29, 264, -1, -1, 252, 34, 254, + -1, -1, 38, 123, -1, 250, 294, -1, 44, -1, + -1, 85, 257, 258, -1, -1, -1, -1, 92, 264, + -1, -1, -1, -1, 294, 145, -1, -1, 102, -1, + 59, 60, 61, 62, 63, 311, -1, 157, 67, 68, + -1, -1, -1, -1, 118, 165, 166, -1, 168, 169, + -1, -1, -1, -1, 90, -1, 176, -1, -1, -1, + -1, -1, 3, 4, 5, -1, -1, 187, 142, 10, + 11, 12, 192, -1, -1, 111, 112, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 208, 30, + 31, 32, 33, 34, -1, 36, 37, -1, -1, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 49, 54, + 55, 56, 57, -1, 59, 60, 61, 62, 63, 60, + -1, 241, 67, 68, 198, 199, 200, 201, 164, 249, + 71, 72, 73, -1, -1, -1, 172, -1, 212, 50, + 51, 52, -1, 54, 55, 56, 57, 183, 59, 60, + 61, 62, 63, -1, -1, -1, 67, 68, -1, -1, + -1, 3, 4, 5, -1, -1, -1, -1, 10, 11, + 12, 245, -1, -1, 294, -1, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, -1, 30, 31, + 32, 33, 34, -1, 36, 37, -1, -1, -1, -1, + -1, -1, -1, 239, 3, 4, 242, 49, 244, 3, + 4, 10, -1, -1, -1, -1, 10, -1, 60, 18, + 19, 20, -1, -1, 18, 19, 20, -1, -1, 71, + 72, 73, -1, -1, -1, -1, -1, 36, 37, -1, + -1, 5, 36, 37, -1, -1, -1, 11, 12, -1, + 49, -1, -1, -1, -1, -1, -1, 21, 22, 23, + 24, 60, -1, 27, 28, -1, 60, 31, 32, 33, + 34, -1, 71, 72, 73, 5, -1, 71, 72, 73, + -1, 11, 12, -1, -1, 15, 16, -1, -1, -1, + -1, 21, 22, 23, 24, 25, 26, 27, 28, -1, + 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, + -1, -1, 42, 43, -1, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, + 60, 61, 62, 63, -1, 65, 66, 67, 5, 69, + -1, 71, 72, 73, 11, 12, -1, -1, -1, -1, + -1, -1, -1, -1, 21, 22, 23, 24, 25, 26, + 27, 28, -1, 30, 31, 32, 33, 34, -1, -1, + -1, -1, -1, -1, 41, -1, -1, -1, -1, 46, + -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, + -1, 5, -1, -1, 61, -1, -1, 11, 12, -1, + -1, -1, 69, 17, -1, -1, 73, 21, 22, 23, + 24, 25, 26, 27, 28, 5, 30, 31, 32, 33, + 34, 11, 12, -1, 38, 39, -1, 17, -1, -1, + -1, 21, 22, 23, 24, 25, 26, 27, 28, -1, + 30, 31, 32, 33, 34, 5, 5, -1, 38, 39, + -1, -1, 12, 12, -1, 5, -1, 71, 17, 73, + -1, -1, 12, -1, 5, -1, -1, 17, -1, -1, + -1, 12, -1, -1, -1, -1, 17, -1, -1, -1, + -1, 71, -1, 73, -1, 5, 46, 46, -1, 49, + 49, -1, 12, -1, -1, -1, 46, -1, -1, 49, + -1, 61, 61, -1, -1, 46, -1, -1, 49, 69, + 69, 61, 71, 73, 73, 5, -1, -1, -1, 69, + 61, 71, 12, 73, -1, -1, 46, -1, 69, 49, + 71, -1, 73, -1, -1, 52, -1, 54, 55, 56, + 57, 61, 59, 60, 61, 62, 63, -1, -1, 69, + 67, 68, -1, 73, -1, -1, 46, -1, -1, 49, + -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, + -1, 61, -1, -1, 11, 12, -1, -1, -1, 69, + 17, -1, -1, 73, 21, 22, 23, 24, 25, 26, + 27, 28, 5, 30, 31, 32, 33, 34, 11, 12, + -1, 38, 39, -1, -1, 15, 16, -1, 21, 22, + 23, 24, 25, 26, 27, 28, -1, 30, 31, 32, + 33, 34, -1, -1, -1, 35, -1, -1, 41, -1, + -1, -1, 42, 43, 71, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, + 60, 61, 62, 63, -1, 65, 66, 67, -1, 69, + -1, 71, 72, 73, 44, 45, 46, 47, 48, 49, + 50, 51, 52, -1, 54, 55, 56, 57, -1, 59, + 60, 61, 62, 63, 5, -1, -1, 67, 68, -1, + 11, 12, -1, -1, 74, -1, -1, -1, -1, -1, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 5, -1, -1, -1, -1, -1, + 11, 12, -1, -1, -1, -1, -1, -1, -1, -1, + 21, 22, 23, 24, 25, 26, 27, 28, -1, 30, + 31, 32, 33, 34, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, -1, 59, + 60, 61, 62, 63, -1, -1, -1, 67, 68, 46, + 47, 48, 49, 50, 51, 52, -1, 54, 55, 56, + 57, -1, 59, 60, 61, 62, 63, -1, -1, -1, + 67, 68, 47, 48, 49, 50, 51, 52, -1, 54, + 55, 56, 57, -1, 59, 60, 61, 62, 63, -1, + -1, -1, 67, 68, 48, 49, 50, 51, 52, -1, + 54, 55, 56, 57, -1, 59, 60, 61, 62, 63, + -1, -1, -1, 67, 68, 49, 50, 51, 52, -1, + 54, 55, 56, 57, -1, 59, 60, 61, 62, 63, + -1, -1, -1, 67, 68, 56, 57, -1, 59, 60, + 61, 62, 63, -1, -1, -1, 67, 68 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 5, 11, 12, 17, 21, 22, 23, 24, 25, + 26, 27, 28, 30, 31, 32, 33, 34, 38, 39, + 71, 76, 77, 79, 80, 81, 82, 83, 84, 86, + 88, 89, 90, 91, 97, 98, 99, 100, 101, 104, + 108, 12, 52, 82, 86, 89, 90, 12, 15, 16, + 35, 42, 43, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 59, 60, 61, 62, + 63, 65, 66, 67, 69, 71, 72, 73, 90, 104, + 27, 77, 77, 5, 0, 52, 5, 12, 46, 49, + 61, 69, 73, 78, 90, 91, 95, 102, 103, 106, + 107, 98, 73, 95, 5, 82, 84, 91, 12, 98, + 12, 86, 101, 22, 99, 98, 12, 17, 73, 85, + 86, 87, 88, 90, 95, 102, 105, 106, 111, 112, + 3, 4, 10, 18, 19, 20, 36, 37, 49, 60, + 71, 72, 73, 92, 93, 104, 113, 98, 82, 69, + 69, 61, 70, 41, 40, 92, 77, 90, 96, 98, + 3, 70, 12, 31, 41, 73, 90, 94, 102, 104, + 105, 5, 61, 91, 12, 78, 12, 107, 95, 103, + 78, 12, 12, 86, 98, 98, 86, 90, 102, 95, + 103, 78, 73, 105, 111, 95, 95, 103, 73, 52, + 52, 52, 73, 77, 113, 113, 113, 49, 104, 108, + 113, 114, 42, 53, 105, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 54, 55, 56, 57, 59, 60, + 61, 62, 63, 67, 68, 70, 70, 77, 53, 61, + 70, 90, 41, 96, 41, 42, 105, 41, 96, 90, + 12, 98, 73, 87, 102, 109, 110, 12, 12, 108, + 108, 108, 108, 77, 73, 77, 41, 53, 41, 93, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 5, 5, + 96, 96, 96, 29, 104, 77, 109, 109, 41, 95, + 103, 77, 77, 41, 53, 53, 53, 41, 77, 113, + 113, 74, 105, 41, 73, 73, 73, 41, 113, 114, + 114, 114, 41, 41, 41 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 75, 76, 77, 77, 77, 78, 78, 79, 79, + 79, 79, 79, 80, 80, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 81, 81, 82, 83, + 83, 83, 83, 84, 84, 84, 85, 85, 86, 86, + 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, + 90, 90, 91, 92, 92, 93, 93, 93, 93, 93, + 94, 94, 94, 94, 94, 95, 95, 95, 96, 96, + 97, 97, 97, 98, 98, 99, 99, 99, 99, 99, + 99, 100, 100, 101, 101, 101, 101, 101, 101, 101, + 102, 102, 102, 102, 102, 103, 103, 104, 104, 104, + 104, 104, 104, 104, 104, 104, 104, 104, 104, 105, + 105, 105, 106, 106, 106, 106, 107, 107, 107, 107, + 107, 108, 108, 109, 109, 110, 110, 110, 110, 111, + 111, 111, 111, 111, 112, 112, 112, 112, 112, 113, + 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 1, 0, 2, 2, 3, + 3, 2, 2, 2, 4, 2, 2, 4, 4, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 3, 2, 3, 3, 2, 2, + 1, 3, 2, 1, 4, 2, 1, 2, 2, 1, + 2, 1, 1, 1, 1, 2, 2, 1, 2, 3, + 2, 3, 4, 1, 3, 1, 2, 2, 4, 1, + 1, 2, 3, 4, 3, 4, 4, 3, 0, 1, + 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, + 2, 1, 1, 3, 4, 2, 3, 2, 1, 3, + 2, 2, 1, 3, 2, 3, 2, 4, 3, 1, + 2, 1, 3, 2, 2, 1, 1, 2, 1, 4, + 2, 1, 2, 2, 1, 3, 2, 2, 1, 2, + 1, 1, 4, 4, 4, 2, 2, 2, 2, 3, + 1, 3, 2, 4, 2, 2, 2, 4, 7, 7, + 7, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 5, 1, 1, 4, 1, 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (state, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, state); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct cpname_state *state) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (state); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct cpname_state *state) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep, state); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, struct cpname_state *state) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , state); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule, state); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTRPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTRPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTRPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct cpname_state *state) +{ + YYUSE (yyvaluep); + YYUSE (state); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (struct cpname_state *state) +{ +/* The lookahead symbol. */ +int yychar; + + +/* The semantic value of the lookahead symbol. */ +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to xreallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to xreallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (&yylval, state); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 349 "cp-name-parser.y" /* yacc.c:1646 */ + { state->global_result = (yyvsp[0].comp); } +#line 1924 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 6: +#line 361 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = NULL; } +#line 1930 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 7: +#line 363 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[0].comp); } +#line 1936 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 8: +#line 370 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[0].nested).comp; + *(yyvsp[0].nested).last = (yyvsp[-1].comp); + } +#line 1944 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 9: +#line 379 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, + (yyvsp[-2].comp), (yyvsp[-1].nested).comp); + if ((yyvsp[0].comp)) + (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, + (yyval.comp), (yyvsp[0].comp)); + } +#line 1955 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 10: +#line 386 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, (yyvsp[-2].comp), (yyvsp[-1].nested).comp); + if ((yyvsp[0].comp)) (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, (yyval.comp), (yyvsp[0].comp)); } +#line 1962 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 11: +#line 390 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[-1].nested).comp; + if ((yyvsp[0].comp)) (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, (yyval.comp), (yyvsp[0].comp)); } +#line 1969 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 12: +#line 393 "cp-name-parser.y" /* yacc.c:1646 */ + { if ((yyvsp[0].abstract).last) + { + /* First complete the abstract_declarator's type using + the typespec from the conversion_op_name. */ + *(yyvsp[0].abstract).last = *(yyvsp[-1].nested).last; + /* Then complete the conversion_op_name with the type. */ + *(yyvsp[-1].nested).last = (yyvsp[0].abstract).comp; + } + /* If we have an arglist, build a function type. */ + if ((yyvsp[0].abstract).fn.comp) + (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, (yyvsp[-1].nested).comp, (yyvsp[0].abstract).fn.comp); + else + (yyval.comp) = (yyvsp[-1].nested).comp; + if ((yyvsp[0].abstract).start) (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, (yyval.comp), (yyvsp[0].abstract).start); + } +#line 1989 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 13: +#line 412 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp ((enum demangle_component_type) (yyvsp[-1].lval), (yyvsp[0].comp), NULL); } +#line 1995 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 14: +#line 414 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE, (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 2001 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 15: +#line 418 "cp-name-parser.y" /* yacc.c:1646 */ + { + /* Match the whitespacing of cplus_demangle_operators. + It would abort on unrecognized string otherwise. */ + (yyval.comp) = state->make_operator ("new", 3); + } +#line 2011 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 16: +#line 424 "cp-name-parser.y" /* yacc.c:1646 */ + { + /* Match the whitespacing of cplus_demangle_operators. + It would abort on unrecognized string otherwise. */ + (yyval.comp) = state->make_operator ("delete ", 1); + } +#line 2021 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 17: +#line 430 "cp-name-parser.y" /* yacc.c:1646 */ + { + /* Match the whitespacing of cplus_demangle_operators. + It would abort on unrecognized string otherwise. */ + (yyval.comp) = state->make_operator ("new[]", 3); + } +#line 2031 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 18: +#line 436 "cp-name-parser.y" /* yacc.c:1646 */ + { + /* Match the whitespacing of cplus_demangle_operators. + It would abort on unrecognized string otherwise. */ + (yyval.comp) = state->make_operator ("delete[] ", 1); + } +#line 2041 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 19: +#line 442 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("+", 2); } +#line 2047 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 20: +#line 444 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("-", 2); } +#line 2053 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 21: +#line 446 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("*", 2); } +#line 2059 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 22: +#line 448 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("/", 2); } +#line 2065 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 23: +#line 450 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("%", 2); } +#line 2071 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 24: +#line 452 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("^", 2); } +#line 2077 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 25: +#line 454 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("&", 2); } +#line 2083 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 26: +#line 456 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("|", 2); } +#line 2089 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 27: +#line 458 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("~", 1); } +#line 2095 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 28: +#line 460 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("!", 1); } +#line 2101 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 29: +#line 462 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("=", 2); } +#line 2107 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 30: +#line 464 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("<", 2); } +#line 2113 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 31: +#line 466 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator (">", 2); } +#line 2119 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 32: +#line 468 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ((yyvsp[0].opname), 2); } +#line 2125 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 33: +#line 470 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("<<", 2); } +#line 2131 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 34: +#line 472 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator (">>", 2); } +#line 2137 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 35: +#line 474 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("==", 2); } +#line 2143 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 36: +#line 476 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("!=", 2); } +#line 2149 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 37: +#line 478 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("<=", 2); } +#line 2155 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 38: +#line 480 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator (">=", 2); } +#line 2161 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 39: +#line 482 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("&&", 2); } +#line 2167 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 40: +#line 484 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("||", 2); } +#line 2173 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 41: +#line 486 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("++", 1); } +#line 2179 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 42: +#line 488 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("--", 1); } +#line 2185 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 43: +#line 490 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator (",", 2); } +#line 2191 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 44: +#line 492 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("->*", 2); } +#line 2197 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 45: +#line 494 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("->", 2); } +#line 2203 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 46: +#line 496 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("()", 2); } +#line 2209 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 47: +#line 498 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_operator ("[]", 2); } +#line 2215 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 48: +#line 506 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_CONVERSION, (yyvsp[0].comp), NULL); } +#line 2221 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 49: +#line 511 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[-1].nested1).comp; + d_right ((yyvsp[-1].nested1).last) = (yyvsp[0].comp); + (yyval.nested).last = &d_left ((yyvsp[0].comp)); + } +#line 2230 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 50: +#line 516 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[0].comp); + (yyval.nested).last = &d_left ((yyvsp[0].comp)); + } +#line 2238 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 51: +#line 520 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[-1].nested1).comp; + d_right ((yyvsp[-1].nested1).last) = (yyvsp[0].comp); + (yyval.nested).last = &d_left ((yyvsp[0].comp)); + } +#line 2247 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 52: +#line 525 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[0].comp); + (yyval.nested).last = &d_left ((yyvsp[0].comp)); + } +#line 2255 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 54: +#line 534 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_TEMPLATE, (yyvsp[-3].comp), (yyvsp[-1].nested).comp); } +#line 2261 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 55: +#line 536 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_dtor (gnu_v3_complete_object_dtor, (yyvsp[0].comp)); } +#line 2267 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 57: +#line 549 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[0].comp); } +#line 2273 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 58: +#line 555 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[-1].nested1).comp; d_right ((yyvsp[-1].nested1).last) = (yyvsp[0].comp); } +#line 2279 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 60: +#line 558 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[-1].nested1).comp; d_right ((yyvsp[-1].nested1).last) = (yyvsp[0].comp); } +#line 2285 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 65: +#line 568 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[0].comp); } +#line 2291 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 66: +#line 572 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[-1].nested1).comp; d_right ((yyvsp[-1].nested1).last) = (yyvsp[0].comp); } +#line 2297 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 68: +#line 577 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested1).comp = state->fill_comp (DEMANGLE_COMPONENT_QUAL_NAME, (yyvsp[-1].comp), NULL); + (yyval.nested1).last = (yyval.nested1).comp; + } +#line 2305 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 69: +#line 581 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested1).comp = (yyvsp[-2].nested1).comp; + d_right ((yyvsp[-2].nested1).last) = state->fill_comp (DEMANGLE_COMPONENT_QUAL_NAME, (yyvsp[-1].comp), NULL); + (yyval.nested1).last = d_right ((yyvsp[-2].nested1).last); + } +#line 2314 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 70: +#line 586 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested1).comp = state->fill_comp (DEMANGLE_COMPONENT_QUAL_NAME, (yyvsp[-1].comp), NULL); + (yyval.nested1).last = (yyval.nested1).comp; + } +#line 2322 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 71: +#line 590 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested1).comp = (yyvsp[-2].nested1).comp; + d_right ((yyvsp[-2].nested1).last) = state->fill_comp (DEMANGLE_COMPONENT_QUAL_NAME, (yyvsp[-1].comp), NULL); + (yyval.nested1).last = d_right ((yyvsp[-2].nested1).last); + } +#line 2331 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 72: +#line 599 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_TEMPLATE, (yyvsp[-3].comp), (yyvsp[-1].nested).comp); } +#line 2337 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 73: +#line 603 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, (yyvsp[0].comp), NULL); + (yyval.nested).last = &d_right ((yyval.nested).comp); } +#line 2344 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 74: +#line 606 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[-2].nested).comp; + *(yyvsp[-2].nested).last = state->fill_comp (DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, (yyvsp[0].comp), NULL); + (yyval.nested).last = &d_right (*(yyvsp[-2].nested).last); + } +#line 2353 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 76: +#line 618 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[0].abstract).comp; + *(yyvsp[0].abstract).last = (yyvsp[-1].comp); + } +#line 2361 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 77: +#line 622 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_UNARY, state->make_operator ("&", 1), (yyvsp[0].comp)); } +#line 2367 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 78: +#line 624 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_UNARY, state->make_operator ("&", 1), (yyvsp[-1].comp)); } +#line 2373 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 80: +#line 629 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_ARGLIST, (yyvsp[0].comp), NULL); + (yyval.nested).last = &d_right ((yyval.nested).comp); + } +#line 2381 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 81: +#line 633 "cp-name-parser.y" /* yacc.c:1646 */ + { *(yyvsp[0].abstract).last = (yyvsp[-1].comp); + (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_ARGLIST, (yyvsp[0].abstract).comp, NULL); + (yyval.nested).last = &d_right ((yyval.nested).comp); + } +#line 2390 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 82: +#line 638 "cp-name-parser.y" /* yacc.c:1646 */ + { *(yyvsp[-2].nested).last = state->fill_comp (DEMANGLE_COMPONENT_ARGLIST, (yyvsp[0].comp), NULL); + (yyval.nested).comp = (yyvsp[-2].nested).comp; + (yyval.nested).last = &d_right (*(yyvsp[-2].nested).last); + } +#line 2399 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 83: +#line 643 "cp-name-parser.y" /* yacc.c:1646 */ + { *(yyvsp[0].abstract).last = (yyvsp[-1].comp); + *(yyvsp[-3].nested).last = state->fill_comp (DEMANGLE_COMPONENT_ARGLIST, (yyvsp[0].abstract).comp, NULL); + (yyval.nested).comp = (yyvsp[-3].nested).comp; + (yyval.nested).last = &d_right (*(yyvsp[-3].nested).last); + } +#line 2409 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 84: +#line 649 "cp-name-parser.y" /* yacc.c:1646 */ + { *(yyvsp[-2].nested).last + = state->fill_comp (DEMANGLE_COMPONENT_ARGLIST, + state->make_builtin_type ("..."), + NULL); + (yyval.nested).comp = (yyvsp[-2].nested).comp; + (yyval.nested).last = &d_right (*(yyvsp[-2].nested).last); + } +#line 2421 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 85: +#line 659 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, (yyvsp[-2].nested).comp); + (yyval.nested).last = &d_left ((yyval.nested).comp); + (yyval.nested).comp = state->d_qualify ((yyval.nested).comp, (yyvsp[0].lval), 1); } +#line 2429 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 86: +#line 663 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, NULL); + (yyval.nested).last = &d_left ((yyval.nested).comp); + (yyval.nested).comp = state->d_qualify ((yyval.nested).comp, (yyvsp[0].lval), 1); } +#line 2437 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 87: +#line 667 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, NULL); + (yyval.nested).last = &d_left ((yyval.nested).comp); + (yyval.nested).comp = state->d_qualify ((yyval.nested).comp, (yyvsp[0].lval), 1); } +#line 2445 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 88: +#line 674 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = 0; } +#line 2451 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 90: +#line 679 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = QUAL_RESTRICT; } +#line 2457 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 91: +#line 681 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = QUAL_VOLATILE; } +#line 2463 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 92: +#line 683 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = QUAL_CONST; } +#line 2469 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 94: +#line 688 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[-1].lval) | (yyvsp[0].lval); } +#line 2475 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 95: +#line 695 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = 0; } +#line 2481 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 96: +#line 697 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = INT_SIGNED; } +#line 2487 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 97: +#line 699 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = INT_UNSIGNED; } +#line 2493 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 98: +#line 701 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = INT_CHAR; } +#line 2499 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 99: +#line 703 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = INT_LONG; } +#line 2505 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 100: +#line 705 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = INT_SHORT; } +#line 2511 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 102: +#line 710 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.lval) = (yyvsp[-1].lval) | (yyvsp[0].lval); if ((yyvsp[-1].lval) & (yyvsp[0].lval) & INT_LONG) (yyval.lval) = (yyvsp[-1].lval) | INT_LLONG; } +#line 2517 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 103: +#line 714 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_int_type ((yyvsp[0].lval)); } +#line 2523 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 104: +#line 716 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_builtin_type ("float"); } +#line 2529 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 105: +#line 718 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_builtin_type ("double"); } +#line 2535 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 106: +#line 720 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_builtin_type ("long double"); } +#line 2541 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 107: +#line 722 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_builtin_type ("bool"); } +#line 2547 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 108: +#line 724 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_builtin_type ("wchar_t"); } +#line 2553 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 109: +#line 726 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->make_builtin_type ("void"); } +#line 2559 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 110: +#line 730 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_POINTER, NULL, NULL); + (yyval.nested).last = &d_left ((yyval.nested).comp); + (yyval.nested).comp = state->d_qualify ((yyval.nested).comp, (yyvsp[0].lval), 0); } +#line 2567 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 111: +#line 735 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_REFERENCE, NULL, NULL); + (yyval.nested).last = &d_left ((yyval.nested).comp); } +#line 2574 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 112: +#line 738 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_RVALUE_REFERENCE, NULL, NULL); + (yyval.nested).last = &d_left ((yyval.nested).comp); } +#line 2581 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 113: +#line 741 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_PTRMEM_TYPE, (yyvsp[-2].nested1).comp, NULL); + /* Convert the innermost DEMANGLE_COMPONENT_QUAL_NAME to a DEMANGLE_COMPONENT_NAME. */ + *(yyvsp[-2].nested1).last = *d_left ((yyvsp[-2].nested1).last); + (yyval.nested).last = &d_right ((yyval.nested).comp); + (yyval.nested).comp = state->d_qualify ((yyval.nested).comp, (yyvsp[0].lval), 0); } +#line 2591 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 114: +#line 747 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_PTRMEM_TYPE, (yyvsp[-2].nested1).comp, NULL); + /* Convert the innermost DEMANGLE_COMPONENT_QUAL_NAME to a DEMANGLE_COMPONENT_NAME. */ + *(yyvsp[-2].nested1).last = *d_left ((yyvsp[-2].nested1).last); + (yyval.nested).last = &d_right ((yyval.nested).comp); + (yyval.nested).comp = state->d_qualify ((yyval.nested).comp, (yyvsp[0].lval), 0); } +#line 2601 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 115: +#line 755 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_ARRAY_TYPE, NULL, NULL); } +#line 2607 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 116: +#line 757 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_ARRAY_TYPE, (yyvsp[-1].comp), NULL); } +#line 2613 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 117: +#line 771 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_qualify ((yyvsp[-1].comp), (yyvsp[0].lval), 0); } +#line 2619 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 119: +#line 774 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_qualify ((yyvsp[-1].comp), (yyvsp[-2].lval) | (yyvsp[0].lval), 0); } +#line 2625 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 120: +#line 776 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_qualify ((yyvsp[0].comp), (yyvsp[-1].lval), 0); } +#line 2631 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 121: +#line 779 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_qualify ((yyvsp[-1].comp), (yyvsp[0].lval), 0); } +#line 2637 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 123: +#line 782 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_qualify ((yyvsp[-1].comp), (yyvsp[-2].lval) | (yyvsp[0].lval), 0); } +#line 2643 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 124: +#line 784 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_qualify ((yyvsp[0].comp), (yyvsp[-1].lval), 0); } +#line 2649 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 125: +#line 787 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_qualify ((yyvsp[-1].comp), (yyvsp[0].lval), 0); } +#line 2655 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 126: +#line 789 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[0].comp); } +#line 2661 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 127: +#line 791 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_qualify ((yyvsp[-1].comp), (yyvsp[-3].lval) | (yyvsp[0].lval), 0); } +#line 2667 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 128: +#line 793 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_qualify ((yyvsp[0].comp), (yyvsp[-2].lval), 0); } +#line 2673 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 129: +#line 798 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract).comp = (yyvsp[0].nested).comp; (yyval.abstract).last = (yyvsp[0].nested).last; + (yyval.abstract).fn.comp = NULL; (yyval.abstract).fn.last = NULL; } +#line 2680 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 130: +#line 801 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract) = (yyvsp[0].abstract); (yyval.abstract).fn.comp = NULL; (yyval.abstract).fn.last = NULL; + if ((yyvsp[0].abstract).fn.comp) { (yyval.abstract).last = (yyvsp[0].abstract).fn.last; *(yyvsp[0].abstract).last = (yyvsp[0].abstract).fn.comp; } + *(yyval.abstract).last = (yyvsp[-1].nested).comp; + (yyval.abstract).last = (yyvsp[-1].nested).last; } +#line 2689 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 131: +#line 806 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract).fn.comp = NULL; (yyval.abstract).fn.last = NULL; + if ((yyvsp[0].abstract).fn.comp) { (yyval.abstract).last = (yyvsp[0].abstract).fn.last; *(yyvsp[0].abstract).last = (yyvsp[0].abstract).fn.comp; } + } +#line 2697 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 132: +#line 813 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract) = (yyvsp[-1].abstract); (yyval.abstract).fn.comp = NULL; (yyval.abstract).fn.last = NULL; (yyval.abstract).fold_flag = 1; + if ((yyvsp[-1].abstract).fn.comp) { (yyval.abstract).last = (yyvsp[-1].abstract).fn.last; *(yyvsp[-1].abstract).last = (yyvsp[-1].abstract).fn.comp; } + } +#line 2705 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 133: +#line 817 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract).fold_flag = 0; + if ((yyvsp[-1].abstract).fn.comp) { (yyval.abstract).last = (yyvsp[-1].abstract).fn.last; *(yyvsp[-1].abstract).last = (yyvsp[-1].abstract).fn.comp; } + if ((yyvsp[-1].abstract).fold_flag) + { + *(yyval.abstract).last = (yyvsp[0].nested).comp; + (yyval.abstract).last = (yyvsp[0].nested).last; + } + else + (yyval.abstract).fn = (yyvsp[0].nested); + } +#line 2720 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 134: +#line 828 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract).fn.comp = NULL; (yyval.abstract).fn.last = NULL; (yyval.abstract).fold_flag = 0; + if ((yyvsp[-1].abstract).fn.comp) { (yyval.abstract).last = (yyvsp[-1].abstract).fn.last; *(yyvsp[-1].abstract).last = (yyvsp[-1].abstract).fn.comp; } + *(yyvsp[-1].abstract).last = (yyvsp[0].comp); + (yyval.abstract).last = &d_right ((yyvsp[0].comp)); + } +#line 2730 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 135: +#line 834 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract).fn.comp = NULL; (yyval.abstract).fn.last = NULL; (yyval.abstract).fold_flag = 0; + (yyval.abstract).comp = (yyvsp[0].comp); + (yyval.abstract).last = &d_right ((yyvsp[0].comp)); + } +#line 2739 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 136: +#line 852 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract).comp = (yyvsp[0].nested).comp; (yyval.abstract).last = (yyvsp[0].nested).last; + (yyval.abstract).fn.comp = NULL; (yyval.abstract).fn.last = NULL; (yyval.abstract).start = NULL; } +#line 2746 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 137: +#line 855 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract) = (yyvsp[0].abstract); + if ((yyvsp[0].abstract).last) + *(yyval.abstract).last = (yyvsp[-1].nested).comp; + else + (yyval.abstract).comp = (yyvsp[-1].nested).comp; + (yyval.abstract).last = (yyvsp[-1].nested).last; + } +#line 2758 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 138: +#line 863 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract).comp = (yyvsp[0].abstract).comp; (yyval.abstract).last = (yyvsp[0].abstract).last; (yyval.abstract).fn = (yyvsp[0].abstract).fn; (yyval.abstract).start = NULL; } +#line 2764 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 139: +#line 865 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract).start = (yyvsp[0].comp); + if ((yyvsp[-3].abstract).fn.comp) { (yyval.abstract).last = (yyvsp[-3].abstract).fn.last; *(yyvsp[-3].abstract).last = (yyvsp[-3].abstract).fn.comp; } + if ((yyvsp[-3].abstract).fold_flag) + { + *(yyval.abstract).last = (yyvsp[-2].nested).comp; + (yyval.abstract).last = (yyvsp[-2].nested).last; + } + else + (yyval.abstract).fn = (yyvsp[-2].nested); + } +#line 2779 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 140: +#line 876 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.abstract).fn = (yyvsp[-1].nested); + (yyval.abstract).start = (yyvsp[0].comp); + (yyval.abstract).comp = NULL; (yyval.abstract).last = NULL; + } +#line 2788 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 142: +#line 884 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[0].abstract).comp; + *(yyvsp[0].abstract).last = (yyvsp[-1].comp); + } +#line 2796 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 143: +#line 890 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[0].nested).comp; + (yyval.nested).last = (yyvsp[-1].nested).last; + *(yyvsp[0].nested).last = (yyvsp[-1].nested).comp; } +#line 2804 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 145: +#line 898 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested) = (yyvsp[-1].nested); } +#line 2810 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 146: +#line 900 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[-1].nested).comp; + *(yyvsp[-1].nested).last = (yyvsp[0].nested).comp; + (yyval.nested).last = (yyvsp[0].nested).last; + } +#line 2819 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 147: +#line 905 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[-1].nested).comp; + *(yyvsp[-1].nested).last = (yyvsp[0].comp); + (yyval.nested).last = &d_right ((yyvsp[0].comp)); + } +#line 2828 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 148: +#line 910 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, (yyvsp[0].comp), NULL); + (yyval.nested).last = &d_right ((yyval.nested).comp); + } +#line 2836 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 149: +#line 922 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[0].nested).comp; + (yyval.nested).last = (yyvsp[-1].nested).last; + *(yyvsp[0].nested).last = (yyvsp[-1].nested).comp; } +#line 2844 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 150: +#line 926 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, (yyvsp[0].comp), NULL); + (yyval.nested).last = &d_right ((yyval.nested).comp); + } +#line 2852 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 152: +#line 938 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, (yyvsp[-3].comp), (yyvsp[-2].nested).comp); + (yyval.nested).last = (yyvsp[-2].nested).last; + (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, (yyval.nested).comp, (yyvsp[0].comp)); + } +#line 2861 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 153: +#line 943 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[-3].nested).comp; + *(yyvsp[-3].nested).last = (yyvsp[-2].nested).comp; + (yyval.nested).last = (yyvsp[-2].nested).last; + (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, (yyval.nested).comp, (yyvsp[0].comp)); + } +#line 2871 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 154: +#line 952 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[-1].nested).comp; + (yyval.nested).last = (yyvsp[-2].nested).last; + *(yyvsp[-1].nested).last = (yyvsp[-2].nested).comp; } +#line 2879 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 155: +#line 956 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[-1].nested).comp; + *(yyvsp[-1].nested).last = (yyvsp[0].nested).comp; + (yyval.nested).last = (yyvsp[0].nested).last; + } +#line 2888 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 156: +#line 961 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = (yyvsp[-1].nested).comp; + *(yyvsp[-1].nested).last = (yyvsp[0].comp); + (yyval.nested).last = &d_right ((yyvsp[0].comp)); + } +#line 2897 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 157: +#line 966 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, (yyvsp[-1].comp), (yyvsp[0].nested).comp); + (yyval.nested).last = (yyvsp[0].nested).last; + } +#line 2905 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 158: +#line 970 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.nested).comp = state->fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, (yyvsp[-1].comp), (yyvsp[0].comp)); + (yyval.nested).last = &d_right ((yyvsp[0].comp)); + } +#line 2913 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 159: +#line 976 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = (yyvsp[-1].comp); } +#line 2919 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 161: +#line 985 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary (">", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 2925 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 162: +#line 992 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_UNARY, state->make_operator ("&", 1), (yyvsp[0].comp)); } +#line 2931 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 163: +#line 994 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_UNARY, state->make_operator ("&", 1), (yyvsp[-1].comp)); } +#line 2937 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 164: +#line 999 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_unary ("-", (yyvsp[0].comp)); } +#line 2943 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 165: +#line 1003 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_unary ("!", (yyvsp[0].comp)); } +#line 2949 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 166: +#line 1007 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_unary ("~", (yyvsp[0].comp)); } +#line 2955 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 167: +#line 1014 "cp-name-parser.y" /* yacc.c:1646 */ + { if ((yyvsp[0].comp)->type == DEMANGLE_COMPONENT_LITERAL + || (yyvsp[0].comp)->type == DEMANGLE_COMPONENT_LITERAL_NEG) + { + (yyval.comp) = (yyvsp[0].comp); + d_left ((yyvsp[0].comp)) = (yyvsp[-2].comp); + } + else + (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_UNARY, + state->fill_comp (DEMANGLE_COMPONENT_CAST, (yyvsp[-2].comp), NULL), + (yyvsp[0].comp)); + } +#line 2971 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 168: +#line 1030 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_UNARY, + state->fill_comp (DEMANGLE_COMPONENT_CAST, (yyvsp[-4].comp), NULL), + (yyvsp[-1].comp)); + } +#line 2980 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 169: +#line 1037 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_UNARY, + state->fill_comp (DEMANGLE_COMPONENT_CAST, (yyvsp[-4].comp), NULL), + (yyvsp[-1].comp)); + } +#line 2989 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 170: +#line 1044 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_UNARY, + state->fill_comp (DEMANGLE_COMPONENT_CAST, (yyvsp[-4].comp), NULL), + (yyvsp[-1].comp)); + } +#line 2998 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 171: +#line 1063 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("*", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3004 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 172: +#line 1067 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("/", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3010 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 173: +#line 1071 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("%", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3016 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 174: +#line 1075 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("+", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3022 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 175: +#line 1079 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("-", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3028 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 176: +#line 1083 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("<<", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3034 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 177: +#line 1087 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary (">>", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3040 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 178: +#line 1091 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("==", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3046 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 179: +#line 1095 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("!=", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3052 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 180: +#line 1099 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("<=", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3058 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 181: +#line 1103 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary (">=", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3064 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 182: +#line 1107 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("<", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3070 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 183: +#line 1111 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("&", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3076 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 184: +#line 1115 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("^", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3082 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 185: +#line 1119 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("|", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3088 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 186: +#line 1123 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("&&", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3094 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 187: +#line 1127 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("||", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3100 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 188: +#line 1132 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary ("->", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3106 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 189: +#line 1136 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->d_binary (".", (yyvsp[-2].comp), (yyvsp[0].comp)); } +#line 3112 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 190: +#line 1140 "cp-name-parser.y" /* yacc.c:1646 */ + { (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_TRINARY, state->make_operator ("?", 3), + state->fill_comp (DEMANGLE_COMPONENT_TRINARY_ARG1, (yyvsp[-4].comp), + state->fill_comp (DEMANGLE_COMPONENT_TRINARY_ARG2, (yyvsp[-2].comp), (yyvsp[0].comp)))); + } +#line 3121 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 193: +#line 1154 "cp-name-parser.y" /* yacc.c:1646 */ + { + /* Match the whitespacing of cplus_demangle_operators. + It would abort on unrecognized string otherwise. */ + (yyval.comp) = state->d_unary ("sizeof ", (yyvsp[-1].comp)); + } +#line 3131 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 194: +#line 1163 "cp-name-parser.y" /* yacc.c:1646 */ + { struct demangle_component *i; + i = state->make_name ("1", 1); + (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_LITERAL, + state->make_builtin_type ( "bool"), + i); + } +#line 3142 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + case 195: +#line 1172 "cp-name-parser.y" /* yacc.c:1646 */ + { struct demangle_component *i; + i = state->make_name ("0", 1); + (yyval.comp) = state->fill_comp (DEMANGLE_COMPONENT_LITERAL, + state->make_builtin_type ("bool"), + i); + } +#line 3153 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + break; + + +#line 3157 "cp-name-parser.c.tmp" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (state, YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (state, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, state); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp, state); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (state, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, state); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, state); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 1182 "cp-name-parser.y" /* yacc.c:1906 */ + + +/* Apply QUALIFIERS to LHS and return a qualified component. IS_METHOD + is set if LHS is a method, in which case the qualifiers are logically + applied to "this". We apply qualifiers in a consistent order; LHS + may already be qualified; duplicate qualifiers are not created. */ + +struct demangle_component * +cpname_state::d_qualify (struct demangle_component *lhs, int qualifiers, + int is_method) +{ + struct demangle_component **inner_p; + enum demangle_component_type type; + + /* For now the order is CONST (innermost), VOLATILE, RESTRICT. */ + +#define HANDLE_QUAL(TYPE, MTYPE, QUAL) \ + if ((qualifiers & QUAL) && (type != TYPE) && (type != MTYPE)) \ + { \ + *inner_p = fill_comp (is_method ? MTYPE : TYPE, \ + *inner_p, NULL); \ + inner_p = &d_left (*inner_p); \ + type = (*inner_p)->type; \ + } \ + else if (type == TYPE || type == MTYPE) \ + { \ + inner_p = &d_left (*inner_p); \ + type = (*inner_p)->type; \ + } + + inner_p = &lhs; + + type = (*inner_p)->type; + + HANDLE_QUAL (DEMANGLE_COMPONENT_RESTRICT, DEMANGLE_COMPONENT_RESTRICT_THIS, QUAL_RESTRICT); + HANDLE_QUAL (DEMANGLE_COMPONENT_VOLATILE, DEMANGLE_COMPONENT_VOLATILE_THIS, QUAL_VOLATILE); + HANDLE_QUAL (DEMANGLE_COMPONENT_CONST, DEMANGLE_COMPONENT_CONST_THIS, QUAL_CONST); + + return lhs; +} + +/* Return a builtin type corresponding to FLAGS. */ + +struct demangle_component * +cpname_state::d_int_type (int flags) +{ + const char *name; + + switch (flags) + { + case INT_SIGNED | INT_CHAR: + name = "signed char"; + break; + case INT_CHAR: + name = "char"; + break; + case INT_UNSIGNED | INT_CHAR: + name = "unsigned char"; + break; + case 0: + case INT_SIGNED: + name = "int"; + break; + case INT_UNSIGNED: + name = "unsigned int"; + break; + case INT_LONG: + case INT_SIGNED | INT_LONG: + name = "long"; + break; + case INT_UNSIGNED | INT_LONG: + name = "unsigned long"; + break; + case INT_SHORT: + case INT_SIGNED | INT_SHORT: + name = "short"; + break; + case INT_UNSIGNED | INT_SHORT: + name = "unsigned short"; + break; + case INT_LLONG | INT_LONG: + case INT_SIGNED | INT_LLONG | INT_LONG: + name = "long long"; + break; + case INT_UNSIGNED | INT_LLONG | INT_LONG: + name = "unsigned long long"; + break; + default: + return NULL; + } + + return make_builtin_type (name); +} + +/* Wrapper to create a unary operation. */ + +struct demangle_component * +cpname_state::d_unary (const char *name, struct demangle_component *lhs) +{ + return fill_comp (DEMANGLE_COMPONENT_UNARY, make_operator (name, 1), lhs); +} + +/* Wrapper to create a binary operation. */ + +struct demangle_component * +cpname_state::d_binary (const char *name, struct demangle_component *lhs, + struct demangle_component *rhs) +{ + return fill_comp (DEMANGLE_COMPONENT_BINARY, make_operator (name, 2), + fill_comp (DEMANGLE_COMPONENT_BINARY_ARGS, lhs, rhs)); +} + +/* Find the end of a symbol name starting at LEXPTR. */ + +static const char * +symbol_end (const char *lexptr) +{ + const char *p = lexptr; + + while (*p && (c_ident_is_alnum (*p) || *p == '_' || *p == '$' || *p == '.')) + p++; + + return p; +} + +/* Take care of parsing a number (anything that starts with a digit). + The number starts at P and contains LEN characters. Store the result in + YYLVAL. */ + +int +cpname_state::parse_number (const char *p, int len, int parsed_float, + YYSTYPE *lvalp) +{ + int unsigned_p = 0; + + /* Number of "L" suffixes encountered. */ + int long_p = 0; + + struct demangle_component *signed_type; + struct demangle_component *unsigned_type; + struct demangle_component *type, *name; + enum demangle_component_type literal_type; + + if (p[0] == '-') + { + literal_type = DEMANGLE_COMPONENT_LITERAL_NEG; + p++; + len--; + } + else + literal_type = DEMANGLE_COMPONENT_LITERAL; + + if (parsed_float) + { + /* It's a float since it contains a point or an exponent. */ + char c; + + /* The GDB lexer checks the result of scanf at this point. Not doing + this leaves our error checking slightly weaker but only for invalid + data. */ + + /* See if it has `f' or `l' suffix (float or long double). */ + + c = TOLOWER (p[len - 1]); + + if (c == 'f') + { + len--; + type = make_builtin_type ("float"); + } + else if (c == 'l') + { + len--; + type = make_builtin_type ("long double"); + } + else if (ISDIGIT (c) || c == '.') + type = make_builtin_type ("double"); + else + return ERROR; + + name = make_name (p, len); + lvalp->comp = fill_comp (literal_type, type, name); + + return FLOAT; + } + + /* This treats 0x1 and 1 as different literals. We also do not + automatically generate unsigned types. */ + + long_p = 0; + unsigned_p = 0; + while (len > 0) + { + if (p[len - 1] == 'l' || p[len - 1] == 'L') + { + len--; + long_p++; + continue; + } + if (p[len - 1] == 'u' || p[len - 1] == 'U') + { + len--; + unsigned_p++; + continue; + } + break; + } + + if (long_p == 0) + { + unsigned_type = make_builtin_type ("unsigned int"); + signed_type = make_builtin_type ("int"); + } + else if (long_p == 1) + { + unsigned_type = make_builtin_type ("unsigned long"); + signed_type = make_builtin_type ("long"); + } + else + { + unsigned_type = make_builtin_type ("unsigned long long"); + signed_type = make_builtin_type ("long long"); + } + + if (unsigned_p) + type = unsigned_type; + else + type = signed_type; + + name = make_name (p, len); + lvalp->comp = fill_comp (literal_type, type, name); + + return INT; +} + +static const char backslashable[] = "abefnrtv"; +static const char represented[] = "\a\b\e\f\n\r\t\v"; + +/* Translate the backslash the way we would in the host character set. */ +static int +c_parse_backslash (int host_char, int *target_char) +{ + const char *ix; + ix = strchr (backslashable, host_char); + if (! ix) + return 0; + else + *target_char = represented[ix - backslashable]; + return 1; +} + +/* Parse a C escape sequence. STRING_PTR points to a variable + containing a pointer to the string to parse. That pointer + should point to the character after the \. That pointer + is updated past the characters we use. The value of the + escape sequence is returned. + + A negative value means the sequence \ newline was seen, + which is supposed to be equivalent to nothing at all. + + If \ is followed by a null character, we return a negative + value and leave the string pointer pointing at the null character. + + If \ is followed by 000, we return 0 and leave the string pointer + after the zeros. A value of 0 does not mean end of string. */ + +static int +cp_parse_escape (const char **string_ptr) +{ + int target_char; + int c = *(*string_ptr)++; + if (c_parse_backslash (c, &target_char)) + return target_char; + else + switch (c) + { + case '\n': + return -2; + case 0: + (*string_ptr)--; + return 0; + case '^': + { + c = *(*string_ptr)++; + + if (c == '?') + return 0177; + else if (c == '\\') + target_char = cp_parse_escape (string_ptr); + else + target_char = c; + + /* Now target_char is something like `c', and we want to find + its control-character equivalent. */ + target_char = target_char & 037; + + return target_char; + } + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + { + int i = c - '0'; + int count = 0; + while (++count < 3) + { + c = (**string_ptr); + if (c >= '0' && c <= '7') + { + (*string_ptr)++; + i *= 8; + i += c - '0'; + } + else + { + break; + } + } + return i; + } + default: + return c; + } +} + +#define HANDLE_SPECIAL(string, comp) \ + if (strncmp (tokstart, string, sizeof (string) - 1) == 0) \ + { \ + state->lexptr = tokstart + sizeof (string) - 1; \ + lvalp->lval = comp; \ + return DEMANGLER_SPECIAL; \ + } + +#define HANDLE_TOKEN2(string, token) \ + if (state->lexptr[1] == string[1]) \ + { \ + state->lexptr += 2; \ + lvalp->opname = string; \ + return token; \ + } + +#define HANDLE_TOKEN3(string, token) \ + if (state->lexptr[1] == string[1] && state->lexptr[2] == string[2]) \ + { \ + state->lexptr += 3; \ + lvalp->opname = string; \ + return token; \ + } + +/* Read one token, getting characters through LEXPTR. */ + +static int +yylex (YYSTYPE *lvalp, cpname_state *state) +{ + int c; + int namelen; + const char *tokstart; + + retry: + state->prev_lexptr = state->lexptr; + tokstart = state->lexptr; + + switch (c = *tokstart) + { + case 0: + return 0; + + case ' ': + case '\t': + case '\n': + state->lexptr++; + goto retry; + + case '\'': + /* We either have a character constant ('0' or '\177' for example) + or we have a quoted symbol reference ('foo(int,int)' in C++ + for example). */ + state->lexptr++; + c = *state->lexptr++; + if (c == '\\') + c = cp_parse_escape (&state->lexptr); + else if (c == '\'') + { + yyerror (state, _("empty character constant")); + return ERROR; + } + + c = *state->lexptr++; + if (c != '\'') + { + yyerror (state, _("invalid character constant")); + return ERROR; + } + + /* FIXME: We should refer to a canonical form of the character, + presumably the same one that appears in manglings - the decimal + representation. But if that isn't in our input then we have to + allocate memory for it somewhere. */ + lvalp->comp + = state->fill_comp (DEMANGLE_COMPONENT_LITERAL, + state->make_builtin_type ("char"), + state->make_name (tokstart, + state->lexptr - tokstart)); + + return INT; + + case '(': + if (strncmp (tokstart, "(anonymous namespace)", 21) == 0) + { + state->lexptr += 21; + lvalp->comp = state->make_name ("(anonymous namespace)", + sizeof "(anonymous namespace)" - 1); + return NAME; + } + /* FALL THROUGH */ + + case ')': + case ',': + state->lexptr++; + return c; + + case '.': + if (state->lexptr[1] == '.' && state->lexptr[2] == '.') + { + state->lexptr += 3; + return ELLIPSIS; + } + + /* Might be a floating point number. */ + if (state->lexptr[1] < '0' || state->lexptr[1] > '9') + goto symbol; /* Nope, must be a symbol. */ + + goto try_number; + + case '-': + HANDLE_TOKEN2 ("-=", ASSIGN_MODIFY); + HANDLE_TOKEN2 ("--", DECREMENT); + HANDLE_TOKEN2 ("->", ARROW); + + /* For construction vtables. This is kind of hokey. */ + if (strncmp (tokstart, "-in-", 4) == 0) + { + state->lexptr += 4; + return CONSTRUCTION_IN; + } + + if (state->lexptr[1] < '0' || state->lexptr[1] > '9') + { + state->lexptr++; + return '-'; + } + /* FALL THRU. */ + + try_number: + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + /* It's a number. */ + int got_dot = 0, got_e = 0, toktype; + const char *p = tokstart; + int hex = 0; + + if (c == '-') + p++; + + if (c == '0' && (p[1] == 'x' || p[1] == 'X')) + { + p += 2; + hex = 1; + } + else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D')) + { + p += 2; + hex = 0; + } + + for (;; ++p) + { + /* This test includes !hex because 'e' is a valid hex digit + and thus does not indicate a floating point number when + the radix is hex. */ + if (!hex && !got_e && (*p == 'e' || *p == 'E')) + got_dot = got_e = 1; + /* This test does not include !hex, because a '.' always indicates + a decimal floating point number regardless of the radix. + + NOTE drow/2005-03-09: This comment is not accurate in C99; + however, it's not clear that all the floating point support + in this file is doing any good here. */ + else if (!got_dot && *p == '.') + got_dot = 1; + else if (got_e && (p[-1] == 'e' || p[-1] == 'E') + && (*p == '-' || *p == '+')) + /* This is the sign of the exponent, not the end of the + number. */ + continue; + /* We will take any letters or digits. parse_number will + complain if past the radix, or if L or U are not final. */ + else if (! ISALNUM (*p)) + break; + } + toktype = state->parse_number (tokstart, p - tokstart, got_dot|got_e, + lvalp); + if (toktype == ERROR) + { + char *err_copy = (char *) alloca (p - tokstart + 1); + + memcpy (err_copy, tokstart, p - tokstart); + err_copy[p - tokstart] = 0; + yyerror (state, _("invalid number")); + return ERROR; + } + state->lexptr = p; + return toktype; + } + + case '+': + HANDLE_TOKEN2 ("+=", ASSIGN_MODIFY); + HANDLE_TOKEN2 ("++", INCREMENT); + state->lexptr++; + return c; + case '*': + HANDLE_TOKEN2 ("*=", ASSIGN_MODIFY); + state->lexptr++; + return c; + case '/': + HANDLE_TOKEN2 ("/=", ASSIGN_MODIFY); + state->lexptr++; + return c; + case '%': + HANDLE_TOKEN2 ("%=", ASSIGN_MODIFY); + state->lexptr++; + return c; + case '|': + HANDLE_TOKEN2 ("|=", ASSIGN_MODIFY); + HANDLE_TOKEN2 ("||", OROR); + state->lexptr++; + return c; + case '&': + HANDLE_TOKEN2 ("&=", ASSIGN_MODIFY); + HANDLE_TOKEN2 ("&&", ANDAND); + state->lexptr++; + return c; + case '^': + HANDLE_TOKEN2 ("^=", ASSIGN_MODIFY); + state->lexptr++; + return c; + case '!': + HANDLE_TOKEN2 ("!=", NOTEQUAL); + state->lexptr++; + return c; + case '<': + HANDLE_TOKEN3 ("<<=", ASSIGN_MODIFY); + HANDLE_TOKEN2 ("<=", LEQ); + HANDLE_TOKEN2 ("<<", LSH); + state->lexptr++; + return c; + case '>': + HANDLE_TOKEN3 (">>=", ASSIGN_MODIFY); + HANDLE_TOKEN2 (">=", GEQ); + HANDLE_TOKEN2 (">>", RSH); + state->lexptr++; + return c; + case '=': + HANDLE_TOKEN2 ("==", EQUAL); + state->lexptr++; + return c; + case ':': + HANDLE_TOKEN2 ("::", COLONCOLON); + state->lexptr++; + return c; + + case '[': + case ']': + case '?': + case '@': + case '~': + case '{': + case '}': + symbol: + state->lexptr++; + return c; + + case '"': + /* These can't occur in C++ names. */ + yyerror (state, _("unexpected string literal")); + return ERROR; + } + + if (!(c == '_' || c == '$' || c_ident_is_alpha (c))) + { + /* We must have come across a bad character (e.g. ';'). */ + yyerror (state, _("invalid character")); + return ERROR; + } + + /* It's a name. See how long it is. */ + namelen = 0; + do + c = tokstart[++namelen]; + while (c_ident_is_alnum (c) || c == '_' || c == '$'); + + state->lexptr += namelen; + + /* Catch specific keywords. Notice that some of the keywords contain + spaces, and are sorted by the length of the first word. They must + all include a trailing space in the string comparison. */ + switch (namelen) + { + case 16: + if (strncmp (tokstart, "reinterpret_cast", 16) == 0) + return REINTERPRET_CAST; + break; + case 12: + if (strncmp (tokstart, "construction vtable for ", 24) == 0) + { + state->lexptr = tokstart + 24; + return CONSTRUCTION_VTABLE; + } + if (strncmp (tokstart, "dynamic_cast", 12) == 0) + return DYNAMIC_CAST; + break; + case 11: + if (strncmp (tokstart, "static_cast", 11) == 0) + return STATIC_CAST; + break; + case 9: + HANDLE_SPECIAL ("covariant return thunk to ", DEMANGLE_COMPONENT_COVARIANT_THUNK); + HANDLE_SPECIAL ("reference temporary for ", DEMANGLE_COMPONENT_REFTEMP); + break; + case 8: + HANDLE_SPECIAL ("typeinfo for ", DEMANGLE_COMPONENT_TYPEINFO); + HANDLE_SPECIAL ("typeinfo fn for ", DEMANGLE_COMPONENT_TYPEINFO_FN); + HANDLE_SPECIAL ("typeinfo name for ", DEMANGLE_COMPONENT_TYPEINFO_NAME); + if (strncmp (tokstart, "operator", 8) == 0) + return OPERATOR; + if (strncmp (tokstart, "restrict", 8) == 0) + return RESTRICT; + if (strncmp (tokstart, "unsigned", 8) == 0) + return UNSIGNED; + if (strncmp (tokstart, "template", 8) == 0) + return TEMPLATE; + if (strncmp (tokstart, "volatile", 8) == 0) + return VOLATILE_KEYWORD; + break; + case 7: + HANDLE_SPECIAL ("virtual thunk to ", DEMANGLE_COMPONENT_VIRTUAL_THUNK); + if (strncmp (tokstart, "wchar_t", 7) == 0) + return WCHAR_T; + break; + case 6: + if (strncmp (tokstart, "global constructors keyed to ", 29) == 0) + { + const char *p; + state->lexptr = tokstart + 29; + lvalp->lval = DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS; + /* Find the end of the symbol. */ + p = symbol_end (state->lexptr); + lvalp->comp = state->make_name (state->lexptr, p - state->lexptr); + state->lexptr = p; + return DEMANGLER_SPECIAL; + } + if (strncmp (tokstart, "global destructors keyed to ", 28) == 0) + { + const char *p; + state->lexptr = tokstart + 28; + lvalp->lval = DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS; + /* Find the end of the symbol. */ + p = symbol_end (state->lexptr); + lvalp->comp = state->make_name (state->lexptr, p - state->lexptr); + state->lexptr = p; + return DEMANGLER_SPECIAL; + } + + HANDLE_SPECIAL ("vtable for ", DEMANGLE_COMPONENT_VTABLE); + if (strncmp (tokstart, "delete", 6) == 0) + return DELETE; + if (strncmp (tokstart, "struct", 6) == 0) + return STRUCT; + if (strncmp (tokstart, "signed", 6) == 0) + return SIGNED_KEYWORD; + if (strncmp (tokstart, "sizeof", 6) == 0) + return SIZEOF; + if (strncmp (tokstart, "double", 6) == 0) + return DOUBLE_KEYWORD; + break; + case 5: + HANDLE_SPECIAL ("guard variable for ", DEMANGLE_COMPONENT_GUARD); + if (strncmp (tokstart, "false", 5) == 0) + return FALSEKEYWORD; + if (strncmp (tokstart, "class", 5) == 0) + return CLASS; + if (strncmp (tokstart, "union", 5) == 0) + return UNION; + if (strncmp (tokstart, "float", 5) == 0) + return FLOAT_KEYWORD; + if (strncmp (tokstart, "short", 5) == 0) + return SHORT; + if (strncmp (tokstart, "const", 5) == 0) + return CONST_KEYWORD; + break; + case 4: + if (strncmp (tokstart, "void", 4) == 0) + return VOID; + if (strncmp (tokstart, "bool", 4) == 0) + return BOOL; + if (strncmp (tokstart, "char", 4) == 0) + return CHAR; + if (strncmp (tokstart, "enum", 4) == 0) + return ENUM; + if (strncmp (tokstart, "long", 4) == 0) + return LONG; + if (strncmp (tokstart, "true", 4) == 0) + return TRUEKEYWORD; + break; + case 3: + HANDLE_SPECIAL ("VTT for ", DEMANGLE_COMPONENT_VTT); + HANDLE_SPECIAL ("non-virtual thunk to ", DEMANGLE_COMPONENT_THUNK); + if (strncmp (tokstart, "new", 3) == 0) + return NEW; + if (strncmp (tokstart, "int", 3) == 0) + return INT_KEYWORD; + break; + default: + break; + } + + lvalp->comp = state->make_name (tokstart, namelen); + return NAME; +} + +static void +yyerror (cpname_state *state, const char *msg) +{ + if (state->global_errmsg) + return; + + state->error_lexptr = state->prev_lexptr; + state->global_errmsg = msg ? msg : "parse error"; +} + +/* Allocate a chunk of the components we'll need to build a tree. We + generally allocate too many components, but the extra memory usage + doesn't hurt because the trees are temporary and the storage is + reused. More may be allocated later, by d_grab. */ +static struct demangle_info * +allocate_info (void) +{ + struct demangle_info *info = XNEW (struct demangle_info); + + info->next = NULL; + info->used = 0; + return info; +} + +/* Convert RESULT to a string. The return value is allocated + using xmalloc. ESTIMATED_LEN is used only as a guide to the + length of the result. This functions handles a few cases that + cplus_demangle_print does not, specifically the global destructor + and constructor labels. */ + +gdb::unique_xmalloc_ptr +cp_comp_to_string (struct demangle_component *result, int estimated_len) +{ + size_t err; + + char *res = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, + result, estimated_len, &err); + return gdb::unique_xmalloc_ptr (res); +} + +/* Constructor for demangle_parse_info. */ + +demangle_parse_info::demangle_parse_info () +: info (NULL), + tree (NULL) +{ + obstack_init (&obstack); +} + +/* Destructor for demangle_parse_info. */ + +demangle_parse_info::~demangle_parse_info () +{ + /* Free any allocated chunks of memory for the parse. */ + while (info != NULL) + { + struct demangle_info *next = info->next; + + xfree (info); + info = next; + } + + /* Free any memory allocated during typedef replacement. */ + obstack_free (&obstack, NULL); +} + +/* Merge the two parse trees given by DEST and SRC. The parse tree + in SRC is attached to DEST at the node represented by TARGET. + + NOTE 1: Since there is no API to merge obstacks, this function does + even attempt to try it. Fortunately, we do not (yet?) need this ability. + The code will assert if SRC->obstack is not empty. + + NOTE 2: The string from which SRC was parsed must not be freed, since + this function will place pointers to that string into DEST. */ + +void +cp_merge_demangle_parse_infos (struct demangle_parse_info *dest, + struct demangle_component *target, + struct demangle_parse_info *src) + +{ + struct demangle_info *di; + + /* Copy the SRC's parse data into DEST. */ + *target = *src->tree; + di = dest->info; + while (di->next != NULL) + di = di->next; + di->next = src->info; + + /* Clear the (pointer to) SRC's parse data so that it is not freed when + cp_demangled_parse_info_free is called. */ + src->info = NULL; +} + +/* Convert a demangled name to a demangle_component tree. On success, + a structure containing the root of the new tree is returned. On + error, NULL is returned, and an error message will be set in + *ERRMSG. */ + +struct std::unique_ptr +cp_demangled_name_to_comp (const char *demangled_name, + std::string *errmsg) +{ + cpname_state state; + + state.prev_lexptr = state.lexptr = demangled_name; + state.error_lexptr = NULL; + state.global_errmsg = NULL; + + state.demangle_info = allocate_info (); + + std::unique_ptr result (new demangle_parse_info); + result->info = state.demangle_info; + + if (yyparse (&state)) + { + if (state.global_errmsg && errmsg) + *errmsg = state.global_errmsg; + return NULL; + } + + result->tree = state.global_result; + + return result; +} + +#ifdef TEST_CPNAMES + +static void +cp_print (struct demangle_component *result) +{ + char *str; + size_t err = 0; + + str = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, result, 64, &err); + if (str == NULL) + return; + + fputs (str, stdout); + + xfree (str); +} + +static char +trim_chars (char *lexptr, char **extra_chars) +{ + char *p = (char *) symbol_end (lexptr); + char c = 0; + + if (*p) + { + c = *p; + *p = 0; + *extra_chars = p + 1; + } + + return c; +} + +/* When this file is built as a standalone program, xmalloc comes from + libiberty --- in which case we have to provide xfree ourselves. */ + +void +xfree (void *ptr) +{ + if (ptr != NULL) + { + /* Literal `free' would get translated back to xfree again. */ + CONCAT2 (fr,ee) (ptr); + } +} + +/* GDB normally defines internal_error itself, but when this file is built + as a standalone program, we must also provide an implementation. */ + +void +internal_error (const char *file, int line, const char *fmt, ...) +{ + va_list ap; + + va_start (ap, fmt); + fprintf (stderr, "%s:%d: internal error: ", file, line); + vfprintf (stderr, fmt, ap); + exit (1); +} + +int +main (int argc, char **argv) +{ + char *str2, *extra_chars, c; + char buf[65536]; + int arg; + + arg = 1; + if (argv[arg] && strcmp (argv[arg], "--debug") == 0) + { + yydebug = 1; + arg++; + } + + if (argv[arg] == NULL) + while (fgets (buf, 65536, stdin) != NULL) + { + int len; + buf[strlen (buf) - 1] = 0; + /* Use DMGL_VERBOSE to get expanded standard substitutions. */ + c = trim_chars (buf, &extra_chars); + str2 = cplus_demangle (buf, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE); + if (str2 == NULL) + { + printf ("Demangling error\n"); + if (c) + printf ("%s%c%s\n", buf, c, extra_chars); + else + printf ("%s\n", buf); + continue; + } + + std::string errmsg; + std::unique_ptr result + = cp_demangled_name_to_comp (str2, &errmsg); + if (result == NULL) + { + fputs (errmsg.c_str (), stderr); + fputc ('\n', stderr); + continue; + } + + cp_print (result->tree); + + xfree (str2); + if (c) + { + putchar (c); + fputs (extra_chars, stdout); + } + putchar ('\n'); + } + else + { + std::string errmsg; + std::unique_ptr result + = cp_demangled_name_to_comp (argv[arg], &errmsg); + if (result == NULL) + { + fputs (errmsg.c_str (), stderr); + fputc ('\n', stderr); + return 0; + } + cp_print (result->tree); + putchar ('\n'); + } + return 0; +} + +#endif diff --git a/gdb-8.3.1/gdb/d-exp.c b/gdb-8.3.1/gdb/d-exp.c new file mode 100644 index 0000000000000000000000000000000000000000..dbe63765cb21ee9c0a4bd1963ba9621db5fa80d2 --- /dev/null +++ b/gdb-8.3.1/gdb/d-exp.c @@ -0,0 +1,3366 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* Copy the first part of user declarations. */ +#line 39 "d-exp.y" /* yacc.c:339 */ + + +#include "defs.h" +#include +#include "expression.h" +#include "value.h" +#include "parser-defs.h" +#include "language.h" +#include "c-lang.h" +#include "d-lang.h" +#include "bfd.h" /* Required by objfiles.h. */ +#include "symfile.h" /* Required by objfiles.h. */ +#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ +#include "charset.h" +#include "block.h" + +#define parse_type(ps) builtin_type (parse_gdbarch (ps)) +#define parse_d_type(ps) builtin_d_type (parse_gdbarch (ps)) + +/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, + etc). */ +#define GDB_YY_REMAP_PREFIX d_ +#include "yy-remap.h" + +/* The state of the parser, used internally when we are parsing the + expression. */ + +static struct parser_state *pstate = NULL; + +int yyparse (void); + +static int yylex (void); + +static void yyerror (const char *); + +static int type_aggregate_p (struct type *); + + +#line 105 "d-exp.c.tmp" /* yacc.c:339 */ + +# ifndef YY_NULLPTRPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTRPTR nullptr +# else +# define YY_NULLPTRPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + IDENTIFIER = 258, + UNKNOWN_NAME = 259, + TYPENAME = 260, + COMPLETE = 261, + NAME_OR_INT = 262, + INTEGER_LITERAL = 263, + FLOAT_LITERAL = 264, + CHARACTER_LITERAL = 265, + STRING_LITERAL = 266, + ENTRY = 267, + ERROR = 268, + TRUE_KEYWORD = 269, + FALSE_KEYWORD = 270, + NULL_KEYWORD = 271, + SUPER_KEYWORD = 272, + CAST_KEYWORD = 273, + SIZEOF_KEYWORD = 274, + TYPEOF_KEYWORD = 275, + TYPEID_KEYWORD = 276, + INIT_KEYWORD = 277, + IMMUTABLE_KEYWORD = 278, + CONST_KEYWORD = 279, + SHARED_KEYWORD = 280, + STRUCT_KEYWORD = 281, + UNION_KEYWORD = 282, + CLASS_KEYWORD = 283, + INTERFACE_KEYWORD = 284, + ENUM_KEYWORD = 285, + TEMPLATE_KEYWORD = 286, + DELEGATE_KEYWORD = 287, + FUNCTION_KEYWORD = 288, + DOLLAR_VARIABLE = 289, + ASSIGN_MODIFY = 290, + OROR = 291, + ANDAND = 292, + EQUAL = 293, + NOTEQUAL = 294, + LEQ = 295, + GEQ = 296, + LSH = 297, + RSH = 298, + HATHAT = 299, + IDENTITY = 300, + NOTIDENTITY = 301, + INCREMENT = 302, + DECREMENT = 303, + DOTDOT = 304 + }; +#endif +/* Tokens. */ +#define IDENTIFIER 258 +#define UNKNOWN_NAME 259 +#define TYPENAME 260 +#define COMPLETE 261 +#define NAME_OR_INT 262 +#define INTEGER_LITERAL 263 +#define FLOAT_LITERAL 264 +#define CHARACTER_LITERAL 265 +#define STRING_LITERAL 266 +#define ENTRY 267 +#define ERROR 268 +#define TRUE_KEYWORD 269 +#define FALSE_KEYWORD 270 +#define NULL_KEYWORD 271 +#define SUPER_KEYWORD 272 +#define CAST_KEYWORD 273 +#define SIZEOF_KEYWORD 274 +#define TYPEOF_KEYWORD 275 +#define TYPEID_KEYWORD 276 +#define INIT_KEYWORD 277 +#define IMMUTABLE_KEYWORD 278 +#define CONST_KEYWORD 279 +#define SHARED_KEYWORD 280 +#define STRUCT_KEYWORD 281 +#define UNION_KEYWORD 282 +#define CLASS_KEYWORD 283 +#define INTERFACE_KEYWORD 284 +#define ENUM_KEYWORD 285 +#define TEMPLATE_KEYWORD 286 +#define DELEGATE_KEYWORD 287 +#define FUNCTION_KEYWORD 288 +#define DOLLAR_VARIABLE 289 +#define ASSIGN_MODIFY 290 +#define OROR 291 +#define ANDAND 292 +#define EQUAL 293 +#define NOTEQUAL 294 +#define LEQ 295 +#define GEQ 296 +#define LSH 297 +#define RSH 298 +#define HATHAT 299 +#define IDENTITY 300 +#define NOTIDENTITY 301 +#define INCREMENT 302 +#define DECREMENT 303 +#define DOTDOT 304 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE +{ +#line 83 "d-exp.y" /* yacc.c:355 */ + + struct { + LONGEST val; + struct type *type; + } typed_val_int; + struct { + gdb_byte val[16]; + struct type *type; + } typed_val_float; + struct symbol *sym; + struct type *tval; + struct typed_stoken tsval; + struct stoken sval; + struct ttype tsym; + struct symtoken ssym; + int ival; + int voidval; + struct block *bval; + enum exp_opcode opcode; + struct stoken_vector svec; + + +#line 263 "d-exp.c.tmp" /* yacc.c:355 */ +}; + +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE yylval; + +int yyparse (void); + + + +/* Copy the second part of user declarations. */ +#line 105 "d-exp.y" /* yacc.c:358 */ + +/* YYSTYPE gets defined by %union */ +static int parse_number (struct parser_state *, const char *, + int, int, YYSTYPE *); + +#line 285 "d-exp.c.tmp" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or xmalloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined xmalloc) \ + && (defined YYFREE || defined xfree))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC xmalloc +# if ! defined xmalloc && ! defined EXIT_SUCCESS +void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE xfree +# if ! defined xfree && ! defined EXIT_SUCCESS +void xfree (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 70 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 200 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 71 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 35 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 104 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 169 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 304 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 68, 2, 2, 2, 56, 43, 2, + 64, 69, 54, 52, 36, 53, 62, 55, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 66, 2, + 46, 37, 47, 38, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 63, 2, 70, 42, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 41, 2, 67, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 39, 40, 44, 45, 48, 49, 50, 51, 57, + 58, 59, 60, 61, 65 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 178, 178, 179, 185, 189, 190, 195, 196, 198, + 205, 206, 211, 212, 217, 218, 223, 224, 229, 230, + 235, 236, 241, 242, 243, 244, 248, 250, 255, 257, + 262, 264, 266, 268, 273, 274, 276, 281, 282, 284, + 286, 291, 292, 294, 296, 300, 302, 304, 306, 308, + 310, 312, 314, 316, 318, 319, 323, 327, 333, 334, + 339, 340, 348, 352, 357, 359, 361, 363, 364, 365, + 369, 371, 377, 378, 383, 382, 391, 404, 406, 411, + 413, 454, 505, 507, 515, 522, 526, 530, 535, 540, + 545, 551, 556, 561, 566, 570, 585, 603, 605, 609, + 618, 620, 622, 625, 631 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "IDENTIFIER", "UNKNOWN_NAME", "TYPENAME", + "COMPLETE", "NAME_OR_INT", "INTEGER_LITERAL", "FLOAT_LITERAL", + "CHARACTER_LITERAL", "STRING_LITERAL", "ENTRY", "ERROR", "TRUE_KEYWORD", + "FALSE_KEYWORD", "NULL_KEYWORD", "SUPER_KEYWORD", "CAST_KEYWORD", + "SIZEOF_KEYWORD", "TYPEOF_KEYWORD", "TYPEID_KEYWORD", "INIT_KEYWORD", + "IMMUTABLE_KEYWORD", "CONST_KEYWORD", "SHARED_KEYWORD", "STRUCT_KEYWORD", + "UNION_KEYWORD", "CLASS_KEYWORD", "INTERFACE_KEYWORD", "ENUM_KEYWORD", + "TEMPLATE_KEYWORD", "DELEGATE_KEYWORD", "FUNCTION_KEYWORD", + "DOLLAR_VARIABLE", "ASSIGN_MODIFY", "','", "'='", "'?'", "OROR", + "ANDAND", "'|'", "'^'", "'&'", "EQUAL", "NOTEQUAL", "'<'", "'>'", "LEQ", + "GEQ", "LSH", "RSH", "'+'", "'-'", "'*'", "'/'", "'%'", "HATHAT", + "IDENTITY", "NOTIDENTITY", "INCREMENT", "DECREMENT", "'.'", "'['", "'('", + "DOTDOT", "':'", "'~'", "'!'", "')'", "']'", "$accept", "start", + "Expression", "CommaExpression", "AssignExpression", + "ConditionalExpression", "OrOrExpression", "AndAndExpression", + "OrExpression", "XorExpression", "AndExpression", "CmpExpression", + "EqualExpression", "IdentityExpression", "RelExpression", + "ShiftExpression", "AddExpression", "MulExpression", "UnaryExpression", + "CastExpression", "PowExpression", "PostfixExpression", "ArgumentList", + "ArgumentList_opt", "CallExpression", "$@1", "IndexExpression", + "SliceExpression", "PrimaryExpression", "ArrayLiteral", "IdentifierExp", + "StringExp", "TypeExp", "BasicType2", "BasicType", YY_NULLPTRPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 44, 61, 63, 291, + 292, 124, 94, 38, 293, 294, 60, 62, 295, 296, + 297, 298, 43, 45, 42, 47, 37, 299, 300, 301, + 302, 303, 46, 91, 40, 304, 58, 126, 33, 41, + 93 +}; +# endif + +#define YYPACT_NINF -91 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-91))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 132, -91, -91, -91, -91, -91, -91, -91, -91, -91, + -91, -43, -27, -91, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 30, -91, -91, 17, -8, 0, + 14, 21, 35, 12, -91, -91, -91, -91, -1, -34, + -31, -91, -91, -91, 43, -91, -91, -91, -91, -91, + -91, 72, 22, -37, 6, 132, -91, 22, -91, -91, + -91, -91, -91, -91, 49, 16, 19, -49, -91, -91, + -91, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, -91, -91, 9, + 58, -91, -91, 13, -37, 81, -91, 6, 24, 25, + 132, -91, -91, 132, -91, -91, -91, 29, 14, 21, + 35, 12, -91, -9, -9, -9, -9, -9, -9, -34, + -34, -9, -9, -31, -31, -31, -91, -91, -91, -91, + 84, -91, -91, -91, 26, -30, 132, -91, -91, -91, + 28, 27, 132, -91, -91, -91, 132, -91, 132, -91, + 33, -37, -91, -91, -91, 38, -91, -91, -91 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 94, 104, 83, 87, 88, 89, 95, 85, 86, + 84, 0, 0, 82, 0, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 0, 2, 4, 5, 7, 10, + 12, 14, 16, 18, 20, 23, 24, 25, 22, 34, + 37, 41, 54, 55, 58, 67, 68, 69, 60, 91, + 80, 90, 3, 98, 0, 0, 45, 0, 50, 49, + 48, 46, 47, 70, 73, 0, 0, 0, 52, 51, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 65, 66, 0, + 0, 74, 96, 0, 100, 0, 99, 0, 0, 0, + 0, 93, 79, 97, 6, 9, 8, 0, 13, 15, + 17, 19, 21, 26, 27, 30, 32, 31, 33, 35, + 36, 28, 29, 38, 39, 40, 42, 43, 44, 59, + 62, 61, 64, 77, 70, 0, 72, 53, 81, 101, + 0, 0, 0, 92, 71, 57, 0, 63, 0, 76, + 0, 102, 97, 56, 11, 0, 75, 103, 78 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -91, -91, 1, 42, -13, -47, -91, 39, 40, 46, + 37, 41, -91, -91, -91, 73, -35, -56, -14, -91, + -91, -91, 31, -22, -91, -91, -91, -91, -91, -91, + 48, -91, 10, -90, -91 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 64, 65, 45, 146, 46, 47, 48, 49, + 50, 51, 57, 106, 53 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint8 yytable[] = +{ + 56, 58, 59, 60, 61, 62, 110, 63, 68, 69, + 52, 2, 140, 103, 149, 141, 1, 104, 90, 91, + 113, 54, 66, 93, 94, 95, 105, 72, 142, 73, + 70, 67, 147, 92, 133, 134, 135, 55, 74, 75, + 159, 86, 87, 80, 81, 82, 83, 84, 85, 86, + 87, 129, 130, 71, 76, 79, 109, 88, 89, 115, + 116, 1, 77, 2, 108, 3, 4, 5, 6, 7, + 107, 167, 8, 9, 10, 117, 11, 78, 12, 136, + 137, 138, 139, 102, 103, 110, 111, 144, 112, 150, + 157, 158, 13, 152, 153, 156, 162, 154, 161, 155, + 96, 14, 166, 97, 98, 99, 100, 101, 168, 164, + 15, 16, 17, 114, 118, 121, 119, 151, 18, 19, + 122, 20, 21, 120, 160, 22, 23, 0, 143, 0, + 0, 145, 0, 63, 0, 1, 0, 2, 163, 3, + 4, 5, 6, 7, 0, 165, 8, 9, 10, 0, + 11, 148, 12, 123, 124, 125, 126, 127, 128, 0, + 0, 131, 132, 0, 0, 0, 13, 0, 0, 0, + 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 16, 17, 0, 0, 0, + 0, 0, 18, 19, 0, 20, 21, 0, 0, 22, + 23 +}; + +static const yytype_int16 yycheck[] = +{ + 14, 15, 16, 17, 18, 19, 36, 20, 22, 23, + 0, 5, 3, 62, 104, 6, 3, 54, 52, 53, + 69, 64, 21, 54, 55, 56, 63, 35, 19, 37, + 0, 21, 19, 67, 90, 91, 92, 64, 38, 39, + 70, 50, 51, 44, 45, 46, 47, 48, 49, 50, + 51, 86, 87, 36, 40, 43, 55, 58, 59, 72, + 73, 3, 41, 5, 54, 7, 8, 9, 10, 11, + 64, 161, 14, 15, 16, 74, 18, 42, 20, 93, + 94, 95, 96, 11, 62, 36, 70, 100, 69, 8, + 6, 65, 34, 69, 69, 66, 69, 110, 70, 113, + 57, 43, 69, 60, 61, 62, 63, 64, 70, 156, + 52, 53, 54, 71, 75, 78, 76, 107, 60, 61, + 79, 63, 64, 77, 146, 67, 68, -1, 70, -1, + -1, 100, -1, 146, -1, 3, -1, 5, 152, 7, + 8, 9, 10, 11, -1, 158, 14, 15, 16, -1, + 18, 103, 20, 80, 81, 82, 83, 84, 85, -1, + -1, 88, 89, -1, -1, -1, 34, -1, -1, -1, + -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, + -1, -1, -1, -1, 52, 53, 54, -1, -1, -1, + -1, -1, 60, 61, -1, 63, 64, -1, -1, 67, + 68 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 5, 7, 8, 9, 10, 11, 14, 15, + 16, 18, 20, 34, 43, 52, 53, 54, 60, 61, + 63, 64, 67, 68, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 95, 97, 98, 99, 100, + 101, 102, 103, 105, 64, 64, 89, 103, 89, 89, + 89, 89, 89, 75, 93, 94, 73, 103, 89, 89, + 0, 36, 35, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 58, 59, + 52, 53, 67, 54, 55, 56, 57, 60, 61, 62, + 63, 64, 11, 62, 54, 63, 104, 64, 103, 73, + 36, 70, 69, 69, 74, 75, 75, 73, 78, 79, + 80, 81, 82, 86, 86, 86, 86, 86, 86, 87, + 87, 86, 86, 88, 88, 88, 89, 89, 89, 89, + 3, 6, 19, 70, 75, 93, 96, 19, 101, 104, + 8, 103, 69, 69, 75, 89, 66, 6, 65, 70, + 94, 70, 69, 89, 76, 75, 69, 104, 70 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 71, 72, 72, 73, 74, 74, 75, 75, 75, + 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, + 81, 81, 82, 82, 82, 82, 83, 83, 84, 84, + 85, 85, 85, 85, 86, 86, 86, 87, 87, 87, + 87, 88, 88, 88, 88, 89, 89, 89, 89, 89, + 89, 89, 89, 89, 89, 89, 90, 90, 91, 91, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 93, 93, 94, 94, 96, 95, 97, 98, 98, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 100, 101, 102, 102, 103, 103, 103, + 104, 104, 104, 104, 105 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 1, 3, 1, 3, 3, + 1, 5, 1, 3, 1, 3, 1, 3, 1, 3, + 1, 3, 1, 1, 1, 1, 3, 3, 3, 3, + 3, 3, 3, 3, 1, 3, 3, 1, 3, 3, + 3, 1, 3, 3, 3, 2, 2, 2, 2, 2, + 2, 2, 2, 3, 1, 1, 5, 4, 1, 3, + 1, 3, 3, 4, 3, 2, 2, 1, 1, 1, + 1, 3, 0, 1, 0, 5, 4, 3, 6, 3, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 4, 3, 1, 1, 2, 3, 1, 2, + 1, 2, 3, 4, 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTRPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTRPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTRPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +{ + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to xreallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to xreallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 6: +#line 191 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_COMMA); } +#line 1506 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 8: +#line 197 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN); } +#line 1512 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 9: +#line 199 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); + write_exp_elt_opcode (pstate, (yyvsp[-1].opcode)); + write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); } +#line 1520 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 11: +#line 207 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, TERNOP_COND); } +#line 1526 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 13: +#line 213 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); } +#line 1532 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 15: +#line 219 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); } +#line 1538 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 17: +#line 225 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); } +#line 1544 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 19: +#line 231 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); } +#line 1550 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 21: +#line 237 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); } +#line 1556 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 26: +#line 249 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_EQUAL); } +#line 1562 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 27: +#line 251 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); } +#line 1568 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 28: +#line 256 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_EQUAL); } +#line 1574 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 29: +#line 258 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); } +#line 1580 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 30: +#line 263 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LESS); } +#line 1586 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 31: +#line 265 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LEQ); } +#line 1592 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 32: +#line 267 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GTR); } +#line 1598 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 33: +#line 269 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GEQ); } +#line 1604 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 35: +#line 275 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LSH); } +#line 1610 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 36: +#line 277 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_RSH); } +#line 1616 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 38: +#line 283 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ADD); } +#line 1622 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 39: +#line 285 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUB); } +#line 1628 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 40: +#line 287 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_CONCAT); } +#line 1634 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 42: +#line 293 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_MUL); } +#line 1640 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 43: +#line 295 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_DIV); } +#line 1646 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 44: +#line 297 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_REM); } +#line 1652 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 45: +#line 301 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ADDR); } +#line 1658 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 46: +#line 303 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PREINCREMENT); } +#line 1664 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 47: +#line 305 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PREDECREMENT); } +#line 1670 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 48: +#line 307 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_IND); } +#line 1676 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 49: +#line 309 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_NEG); } +#line 1682 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 50: +#line 311 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PLUS); } +#line 1688 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 51: +#line 313 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); } +#line 1694 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 52: +#line 315 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_COMPLEMENT); } +#line 1700 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 53: +#line 317 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_SIZEOF); } +#line 1706 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 56: +#line 324 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_CAST_TYPE); } +#line 1712 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 57: +#line 328 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_CAST_TYPE); } +#line 1718 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 59: +#line 335 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_EXP); } +#line 1724 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 61: +#line 341 "d-exp.y" /* yacc.c:1646 */ + { struct stoken s; + mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + s.ptr = ""; + s.length = 0; + write_exp_string (pstate, s); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 1736 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 62: +#line 349 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 1744 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 63: +#line 353 "d-exp.y" /* yacc.c:1646 */ + { mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, (yyvsp[-1].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 1753 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 64: +#line 358 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_SIZEOF); } +#line 1759 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 65: +#line 360 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_POSTINCREMENT); } +#line 1765 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 66: +#line 362 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_POSTDECREMENT); } +#line 1771 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 70: +#line 370 "d-exp.y" /* yacc.c:1646 */ + { arglist_len = 1; } +#line 1777 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 71: +#line 372 "d-exp.y" /* yacc.c:1646 */ + { arglist_len++; } +#line 1783 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 72: +#line 377 "d-exp.y" /* yacc.c:1646 */ + { arglist_len = 0; } +#line 1789 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 74: +#line 383 "d-exp.y" /* yacc.c:1646 */ + { start_arglist (); } +#line 1795 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 75: +#line 385 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FUNCALL); + write_exp_elt_longcst (pstate, (LONGEST) end_arglist ()); + write_exp_elt_opcode (pstate, OP_FUNCALL); } +#line 1803 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 76: +#line 392 "d-exp.y" /* yacc.c:1646 */ + { if (arglist_len > 0) + { + write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); + write_exp_elt_longcst (pstate, (LONGEST) arglist_len); + write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); + } + else + write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); + } +#line 1817 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 77: +#line 405 "d-exp.y" /* yacc.c:1646 */ + { /* Do nothing. */ } +#line 1823 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 78: +#line 407 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, TERNOP_SLICE); } +#line 1829 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 79: +#line 412 "d-exp.y" /* yacc.c:1646 */ + { /* Do nothing. */ } +#line 1835 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 80: +#line 414 "d-exp.y" /* yacc.c:1646 */ + { struct bound_minimal_symbol msymbol; + char *copy = copy_name ((yyvsp[0].sval)); + struct field_of_this_result is_a_field_of_this; + struct block_symbol sym; + + /* Handle VAR, which could be local or global. */ + sym = lookup_symbol (copy, expression_context_block, VAR_DOMAIN, + &is_a_field_of_this); + if (sym.symbol && SYMBOL_CLASS (sym.symbol) != LOC_TYPEDEF) + { + if (symbol_read_needs_frame (sym.symbol)) + innermost_block.update (sym); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, sym.block); + write_exp_elt_sym (pstate, sym.symbol); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + } + else if (is_a_field_of_this.type != NULL) + { + /* It hangs off of `this'. Must not inadvertently convert from a + method call to data ref. */ + innermost_block.update (sym); + write_exp_elt_opcode (pstate, OP_THIS); + write_exp_elt_opcode (pstate, OP_THIS); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); + } + else + { + /* Lookup foreign name in global static symbols. */ + msymbol = lookup_bound_minimal_symbol (copy); + if (msymbol.minsym != NULL) + write_exp_msymbol (pstate, msymbol); + else if (!have_full_symbols () && !have_partial_symbols ()) + error (_("No symbol table is loaded. Use the \"file\" command")); + else + error (_("No symbol \"%s\" in current context."), copy); + } + } +#line 1880 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 81: +#line 455 "d-exp.y" /* yacc.c:1646 */ + { struct type *type = check_typedef ((yyvsp[-2].tval)); + + /* Check if the qualified name is in the global + context. However if the symbol has not already + been resolved, it's not likely to be found. */ + if (TYPE_CODE (type) == TYPE_CODE_MODULE) + { + struct bound_minimal_symbol msymbol; + struct block_symbol sym; + const char *type_name = TYPE_SAFE_NAME (type); + int type_name_len = strlen (type_name); + std::string name + = string_printf ("%.*s.%.*s", + type_name_len, type_name, + (yyvsp[0].sval).length, (yyvsp[0].sval).ptr); + + sym = + lookup_symbol (name.c_str (), + (const struct block *) NULL, + VAR_DOMAIN, NULL); + if (sym.symbol) + { + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, sym.block); + write_exp_elt_sym (pstate, sym.symbol); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + break; + } + + msymbol = lookup_bound_minimal_symbol (name.c_str ()); + if (msymbol.minsym != NULL) + write_exp_msymbol (pstate, msymbol); + else if (!have_full_symbols () && !have_partial_symbols ()) + error (_("No symbol table is loaded. Use the \"file\" command.")); + else + error (_("No symbol \"%s\" in current context."), + name.c_str ()); + } + + /* Check if the qualified name resolves as a member + of an aggregate or an enum type. */ + if (!type_aggregate_p (type)) + error (_("`%s' is not defined as an aggregate type."), + TYPE_SAFE_NAME (type)); + + write_exp_elt_opcode (pstate, OP_SCOPE); + write_exp_elt_type (pstate, type); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, OP_SCOPE); + } +#line 1935 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 82: +#line 506 "d-exp.y" /* yacc.c:1646 */ + { write_dollar_variable (pstate, (yyvsp[0].sval)); } +#line 1941 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 83: +#line 508 "d-exp.y" /* yacc.c:1646 */ + { YYSTYPE val; + parse_number (pstate, (yyvsp[0].sval).ptr, (yyvsp[0].sval).length, 0, &val); + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, val.typed_val_int.type); + write_exp_elt_longcst (pstate, + (LONGEST) val.typed_val_int.val); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 1953 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 84: +#line 516 "d-exp.y" /* yacc.c:1646 */ + { struct type *type = parse_d_type (pstate)->builtin_void; + type = lookup_pointer_type (type); + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, type); + write_exp_elt_longcst (pstate, (LONGEST) 0); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 1964 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 85: +#line 523 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_BOOL); + write_exp_elt_longcst (pstate, (LONGEST) 1); + write_exp_elt_opcode (pstate, OP_BOOL); } +#line 1972 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 86: +#line 527 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_BOOL); + write_exp_elt_longcst (pstate, (LONGEST) 0); + write_exp_elt_opcode (pstate, OP_BOOL); } +#line 1980 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 87: +#line 531 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, (yyvsp[0].typed_val_int).type); + write_exp_elt_longcst (pstate, (LONGEST)((yyvsp[0].typed_val_int).val)); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 1989 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 88: +#line 536 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FLOAT); + write_exp_elt_type (pstate, (yyvsp[0].typed_val_float).type); + write_exp_elt_floatcst (pstate, (yyvsp[0].typed_val_float).val); + write_exp_elt_opcode (pstate, OP_FLOAT); } +#line 1998 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 89: +#line 541 "d-exp.y" /* yacc.c:1646 */ + { struct stoken_vector vec; + vec.len = 1; + vec.tokens = &(yyvsp[0].tsval); + write_exp_string_vector (pstate, (yyvsp[0].tsval).type, &vec); } +#line 2007 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 90: +#line 546 "d-exp.y" /* yacc.c:1646 */ + { int i; + write_exp_string_vector (pstate, 0, &(yyvsp[0].svec)); + for (i = 0; i < (yyvsp[0].svec).len; ++i) + xfree ((yyvsp[0].svec).tokens[i].ptr); + xfree ((yyvsp[0].svec).tokens); } +#line 2017 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 91: +#line 552 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_ARRAY); + write_exp_elt_longcst (pstate, (LONGEST) 0); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].ival) - 1); + write_exp_elt_opcode (pstate, OP_ARRAY); } +#line 2026 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 92: +#line 557 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_TYPEOF); } +#line 2032 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 93: +#line 562 "d-exp.y" /* yacc.c:1646 */ + { (yyval.ival) = arglist_len; } +#line 2038 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 95: +#line 571 "d-exp.y" /* yacc.c:1646 */ + { /* We copy the string here, and not in the + lexer, to guarantee that we do not leak a + string. Note that we follow the + NUL-termination convention of the + lexer. */ + struct typed_stoken *vec = XNEW (struct typed_stoken); + (yyval.svec).len = 1; + (yyval.svec).tokens = vec; + + vec->type = (yyvsp[0].tsval).type; + vec->length = (yyvsp[0].tsval).length; + vec->ptr = (char *) xmalloc ((yyvsp[0].tsval).length + 1); + memcpy (vec->ptr, (yyvsp[0].tsval).ptr, (yyvsp[0].tsval).length + 1); + } +#line 2057 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 96: +#line 586 "d-exp.y" /* yacc.c:1646 */ + { /* Note that we NUL-terminate here, but just + for convenience. */ + char *p; + ++(yyval.svec).len; + (yyval.svec).tokens + = XRESIZEVEC (struct typed_stoken, (yyval.svec).tokens, (yyval.svec).len); + + p = (char *) xmalloc ((yyvsp[0].tsval).length + 1); + memcpy (p, (yyvsp[0].tsval).ptr, (yyvsp[0].tsval).length + 1); + + (yyval.svec).tokens[(yyval.svec).len - 1].type = (yyvsp[0].tsval).type; + (yyval.svec).tokens[(yyval.svec).len - 1].length = (yyvsp[0].tsval).length; + (yyval.svec).tokens[(yyval.svec).len - 1].ptr = p; + } +#line 2076 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 97: +#line 604 "d-exp.y" /* yacc.c:1646 */ + { /* Do nothing. */ } +#line 2082 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 98: +#line 606 "d-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_TYPE); + write_exp_elt_type (pstate, (yyvsp[0].tval)); + write_exp_elt_opcode (pstate, OP_TYPE); } +#line 2090 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 99: +#line 610 "d-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = follow_types ((yyvsp[-1].tval)); + write_exp_elt_opcode (pstate, OP_TYPE); + write_exp_elt_type (pstate, (yyval.tval)); + write_exp_elt_opcode (pstate, OP_TYPE); + } +#line 2100 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 100: +#line 619 "d-exp.y" /* yacc.c:1646 */ + { push_type (tp_pointer); } +#line 2106 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 101: +#line 621 "d-exp.y" /* yacc.c:1646 */ + { push_type (tp_pointer); } +#line 2112 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 102: +#line 623 "d-exp.y" /* yacc.c:1646 */ + { push_type_int ((yyvsp[-1].typed_val_int).val); + push_type (tp_array); } +#line 2119 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 103: +#line 626 "d-exp.y" /* yacc.c:1646 */ + { push_type_int ((yyvsp[-2].typed_val_int).val); + push_type (tp_array); } +#line 2126 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 104: +#line 632 "d-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = (yyvsp[0].tsym).type; } +#line 2132 "d-exp.c.tmp" /* yacc.c:1646 */ + break; + + +#line 2136 "d-exp.c.tmp" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 635 "d-exp.y" /* yacc.c:1906 */ + + +/* Return true if the type is aggregate-like. */ + +static int +type_aggregate_p (struct type *type) +{ + return (TYPE_CODE (type) == TYPE_CODE_STRUCT + || TYPE_CODE (type) == TYPE_CODE_UNION + || TYPE_CODE (type) == TYPE_CODE_MODULE + || (TYPE_CODE (type) == TYPE_CODE_ENUM + && TYPE_DECLARED_CLASS (type))); +} + +/* Take care of parsing a number (anything that starts with a digit). + Set yylval and return the token type; update lexptr. + LEN is the number of characters in it. */ + +/*** Needs some error checking for the float case ***/ + +static int +parse_number (struct parser_state *ps, const char *p, + int len, int parsed_float, YYSTYPE *putithere) +{ + ULONGEST n = 0; + ULONGEST prevn = 0; + ULONGEST un; + + int i = 0; + int c; + int base = input_radix; + int unsigned_p = 0; + int long_p = 0; + + /* We have found a "L" or "U" suffix. */ + int found_suffix = 0; + + ULONGEST high_bit; + struct type *signed_type; + struct type *unsigned_type; + + if (parsed_float) + { + char *s, *sp; + + /* Strip out all embedded '_' before passing to parse_float. */ + s = (char *) alloca (len + 1); + sp = s; + while (len-- > 0) + { + if (*p != '_') + *sp++ = *p; + p++; + } + *sp = '\0'; + len = strlen (s); + + /* Check suffix for `i' , `fi' or `li' (idouble, ifloat or ireal). */ + if (len >= 1 && tolower (s[len - 1]) == 'i') + { + if (len >= 2 && tolower (s[len - 2]) == 'f') + { + putithere->typed_val_float.type + = parse_d_type (ps)->builtin_ifloat; + len -= 2; + } + else if (len >= 2 && tolower (s[len - 2]) == 'l') + { + putithere->typed_val_float.type + = parse_d_type (ps)->builtin_ireal; + len -= 2; + } + else + { + putithere->typed_val_float.type + = parse_d_type (ps)->builtin_idouble; + len -= 1; + } + } + /* Check suffix for `f' or `l'' (float or real). */ + else if (len >= 1 && tolower (s[len - 1]) == 'f') + { + putithere->typed_val_float.type + = parse_d_type (ps)->builtin_float; + len -= 1; + } + else if (len >= 1 && tolower (s[len - 1]) == 'l') + { + putithere->typed_val_float.type + = parse_d_type (ps)->builtin_real; + len -= 1; + } + /* Default type if no suffix. */ + else + { + putithere->typed_val_float.type + = parse_d_type (ps)->builtin_double; + } + + if (!parse_float (s, len, + putithere->typed_val_float.type, + putithere->typed_val_float.val)) + return ERROR; + + return FLOAT_LITERAL; + } + + /* Handle base-switching prefixes 0x, 0b, 0 */ + if (p[0] == '0') + switch (p[1]) + { + case 'x': + case 'X': + if (len >= 3) + { + p += 2; + base = 16; + len -= 2; + } + break; + + case 'b': + case 'B': + if (len >= 3) + { + p += 2; + base = 2; + len -= 2; + } + break; + + default: + base = 8; + break; + } + + while (len-- > 0) + { + c = *p++; + if (c == '_') + continue; /* Ignore embedded '_'. */ + if (c >= 'A' && c <= 'Z') + c += 'a' - 'A'; + if (c != 'l' && c != 'u') + n *= base; + if (c >= '0' && c <= '9') + { + if (found_suffix) + return ERROR; + n += i = c - '0'; + } + else + { + if (base > 10 && c >= 'a' && c <= 'f') + { + if (found_suffix) + return ERROR; + n += i = c - 'a' + 10; + } + else if (c == 'l' && long_p == 0) + { + long_p = 1; + found_suffix = 1; + } + else if (c == 'u' && unsigned_p == 0) + { + unsigned_p = 1; + found_suffix = 1; + } + else + return ERROR; /* Char not a digit */ + } + if (i >= base) + return ERROR; /* Invalid digit in this base. */ + /* Portably test for integer overflow. */ + if (c != 'l' && c != 'u') + { + ULONGEST n2 = prevn * base; + if ((n2 / base != prevn) || (n2 + i < prevn)) + error (_("Numeric constant too large.")); + } + prevn = n; + } + + /* An integer constant is an int or a long. An L suffix forces it to + be long, and a U suffix forces it to be unsigned. To figure out + whether it fits, we shift it right and see whether anything remains. + Note that we can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or + more in one operation, because many compilers will warn about such a + shift (which always produces a zero result). To deal with the case + where it is we just always shift the value more than once, with fewer + bits each time. */ + un = (ULONGEST) n >> 2; + if (long_p == 0 && (un >> 30) == 0) + { + high_bit = ((ULONGEST) 1) << 31; + signed_type = parse_d_type (ps)->builtin_int; + /* For decimal notation, keep the sign of the worked out type. */ + if (base == 10 && !unsigned_p) + unsigned_type = parse_d_type (ps)->builtin_long; + else + unsigned_type = parse_d_type (ps)->builtin_uint; + } + else + { + int shift; + if (sizeof (ULONGEST) * HOST_CHAR_BIT < 64) + /* A long long does not fit in a LONGEST. */ + shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1); + else + shift = 63; + high_bit = (ULONGEST) 1 << shift; + signed_type = parse_d_type (ps)->builtin_long; + unsigned_type = parse_d_type (ps)->builtin_ulong; + } + + putithere->typed_val_int.val = n; + + /* If the high bit of the worked out type is set then this number + has to be unsigned_type. */ + if (unsigned_p || (n & high_bit)) + putithere->typed_val_int.type = unsigned_type; + else + putithere->typed_val_int.type = signed_type; + + return INTEGER_LITERAL; +} + +/* Temporary obstack used for holding strings. */ +static struct obstack tempbuf; +static int tempbuf_init; + +/* Parse a string or character literal from TOKPTR. The string or + character may be wide or unicode. *OUTPTR is set to just after the + end of the literal in the input string. The resulting token is + stored in VALUE. This returns a token value, either STRING or + CHAR, depending on what was parsed. *HOST_CHARS is set to the + number of host characters in the literal. */ + +static int +parse_string_or_char (const char *tokptr, const char **outptr, + struct typed_stoken *value, int *host_chars) +{ + int quote; + + /* Build the gdb internal form of the input string in tempbuf. Note + that the buffer is null byte terminated *only* for the + convenience of debugging gdb itself and printing the buffer + contents when the buffer contains no embedded nulls. Gdb does + not depend upon the buffer being null byte terminated, it uses + the length string instead. This allows gdb to handle C strings + (as well as strings in other languages) with embedded null + bytes */ + + if (!tempbuf_init) + tempbuf_init = 1; + else + obstack_free (&tempbuf, NULL); + obstack_init (&tempbuf); + + /* Skip the quote. */ + quote = *tokptr; + ++tokptr; + + *host_chars = 0; + + while (*tokptr) + { + char c = *tokptr; + if (c == '\\') + { + ++tokptr; + *host_chars += c_parse_escape (&tokptr, &tempbuf); + } + else if (c == quote) + break; + else + { + obstack_1grow (&tempbuf, c); + ++tokptr; + /* FIXME: this does the wrong thing with multi-byte host + characters. We could use mbrlen here, but that would + make "set host-charset" a bit less useful. */ + ++*host_chars; + } + } + + if (*tokptr != quote) + { + if (quote == '"' || quote == '`') + error (_("Unterminated string in expression.")); + else + error (_("Unmatched single quote.")); + } + ++tokptr; + + /* FIXME: should instead use own language string_type enum + and handle D-specific string suffixes here. */ + if (quote == '\'') + value->type = C_CHAR; + else + value->type = C_STRING; + + value->ptr = (char *) obstack_base (&tempbuf); + value->length = obstack_object_size (&tempbuf); + + *outptr = tokptr; + + return quote == '\'' ? CHARACTER_LITERAL : STRING_LITERAL; +} + +struct token +{ + const char *oper; + int token; + enum exp_opcode opcode; +}; + +static const struct token tokentab3[] = + { + {"^^=", ASSIGN_MODIFY, BINOP_EXP}, + {"<<=", ASSIGN_MODIFY, BINOP_LSH}, + {">>=", ASSIGN_MODIFY, BINOP_RSH}, + }; + +static const struct token tokentab2[] = + { + {"+=", ASSIGN_MODIFY, BINOP_ADD}, + {"-=", ASSIGN_MODIFY, BINOP_SUB}, + {"*=", ASSIGN_MODIFY, BINOP_MUL}, + {"/=", ASSIGN_MODIFY, BINOP_DIV}, + {"%=", ASSIGN_MODIFY, BINOP_REM}, + {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR}, + {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND}, + {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR}, + {"++", INCREMENT, BINOP_END}, + {"--", DECREMENT, BINOP_END}, + {"&&", ANDAND, BINOP_END}, + {"||", OROR, BINOP_END}, + {"^^", HATHAT, BINOP_END}, + {"<<", LSH, BINOP_END}, + {">>", RSH, BINOP_END}, + {"==", EQUAL, BINOP_END}, + {"!=", NOTEQUAL, BINOP_END}, + {"<=", LEQ, BINOP_END}, + {">=", GEQ, BINOP_END}, + {"..", DOTDOT, BINOP_END}, + }; + +/* Identifier-like tokens. */ +static const struct token ident_tokens[] = + { + {"is", IDENTITY, BINOP_END}, + {"!is", NOTIDENTITY, BINOP_END}, + + {"cast", CAST_KEYWORD, OP_NULL}, + {"const", CONST_KEYWORD, OP_NULL}, + {"immutable", IMMUTABLE_KEYWORD, OP_NULL}, + {"shared", SHARED_KEYWORD, OP_NULL}, + {"super", SUPER_KEYWORD, OP_NULL}, + + {"null", NULL_KEYWORD, OP_NULL}, + {"true", TRUE_KEYWORD, OP_NULL}, + {"false", FALSE_KEYWORD, OP_NULL}, + + {"init", INIT_KEYWORD, OP_NULL}, + {"sizeof", SIZEOF_KEYWORD, OP_NULL}, + {"typeof", TYPEOF_KEYWORD, OP_NULL}, + {"typeid", TYPEID_KEYWORD, OP_NULL}, + + {"delegate", DELEGATE_KEYWORD, OP_NULL}, + {"function", FUNCTION_KEYWORD, OP_NULL}, + {"struct", STRUCT_KEYWORD, OP_NULL}, + {"union", UNION_KEYWORD, OP_NULL}, + {"class", CLASS_KEYWORD, OP_NULL}, + {"interface", INTERFACE_KEYWORD, OP_NULL}, + {"enum", ENUM_KEYWORD, OP_NULL}, + {"template", TEMPLATE_KEYWORD, OP_NULL}, + }; + +/* This is set if a NAME token appeared at the very end of the input + string, with no whitespace separating the name from the EOF. This + is used only when parsing to do field name completion. */ +static int saw_name_at_eof; + +/* This is set if the previously-returned token was a structure operator. + This is used only when parsing to do field name completion. */ +static int last_was_structop; + +/* Read one token, getting characters through lexptr. */ + +static int +lex_one_token (struct parser_state *par_state) +{ + int c; + int namelen; + unsigned int i; + const char *tokstart; + int saw_structop = last_was_structop; + char *copy; + + last_was_structop = 0; + + retry: + + prev_lexptr = lexptr; + + tokstart = lexptr; + /* See if it is a special token of length 3. */ + for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) + if (strncmp (tokstart, tokentab3[i].oper, 3) == 0) + { + lexptr += 3; + yylval.opcode = tokentab3[i].opcode; + return tokentab3[i].token; + } + + /* See if it is a special token of length 2. */ + for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) + if (strncmp (tokstart, tokentab2[i].oper, 2) == 0) + { + lexptr += 2; + yylval.opcode = tokentab2[i].opcode; + return tokentab2[i].token; + } + + switch (c = *tokstart) + { + case 0: + /* If we're parsing for field name completion, and the previous + token allows such completion, return a COMPLETE token. + Otherwise, we were already scanning the original text, and + we're really done. */ + if (saw_name_at_eof) + { + saw_name_at_eof = 0; + return COMPLETE; + } + else if (saw_structop) + return COMPLETE; + else + return 0; + + case ' ': + case '\t': + case '\n': + lexptr++; + goto retry; + + case '[': + case '(': + paren_depth++; + lexptr++; + return c; + + case ']': + case ')': + if (paren_depth == 0) + return 0; + paren_depth--; + lexptr++; + return c; + + case ',': + if (comma_terminates && paren_depth == 0) + return 0; + lexptr++; + return c; + + case '.': + /* Might be a floating point number. */ + if (lexptr[1] < '0' || lexptr[1] > '9') + { + if (parse_completion) + last_was_structop = 1; + goto symbol; /* Nope, must be a symbol. */ + } + /* FALL THRU. */ + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + /* It's a number. */ + int got_dot = 0, got_e = 0, toktype; + const char *p = tokstart; + int hex = input_radix > 10; + + if (c == '0' && (p[1] == 'x' || p[1] == 'X')) + { + p += 2; + hex = 1; + } + + for (;; ++p) + { + /* Hex exponents start with 'p', because 'e' is a valid hex + digit and thus does not indicate a floating point number + when the radix is hex. */ + if ((!hex && !got_e && tolower (p[0]) == 'e') + || (hex && !got_e && tolower (p[0] == 'p'))) + got_dot = got_e = 1; + /* A '.' always indicates a decimal floating point number + regardless of the radix. If we have a '..' then its the + end of the number and the beginning of a slice. */ + else if (!got_dot && (p[0] == '.' && p[1] != '.')) + got_dot = 1; + /* This is the sign of the exponent, not the end of the number. */ + else if (got_e && (tolower (p[-1]) == 'e' || tolower (p[-1]) == 'p') + && (*p == '-' || *p == '+')) + continue; + /* We will take any letters or digits, ignoring any embedded '_'. + parse_number will complain if past the radix, or if L or U are + not final. */ + else if ((*p < '0' || *p > '9') && (*p != '_') + && ((*p < 'a' || *p > 'z') && (*p < 'A' || *p > 'Z'))) + break; + } + + toktype = parse_number (par_state, tokstart, p - tokstart, + got_dot|got_e, &yylval); + if (toktype == ERROR) + { + char *err_copy = (char *) alloca (p - tokstart + 1); + + memcpy (err_copy, tokstart, p - tokstart); + err_copy[p - tokstart] = 0; + error (_("Invalid number \"%s\"."), err_copy); + } + lexptr = p; + return toktype; + } + + case '@': + { + const char *p = &tokstart[1]; + size_t len = strlen ("entry"); + + while (isspace (*p)) + p++; + if (strncmp (p, "entry", len) == 0 && !isalnum (p[len]) + && p[len] != '_') + { + lexptr = &p[len]; + return ENTRY; + } + } + /* FALLTHRU */ + case '+': + case '-': + case '*': + case '/': + case '%': + case '|': + case '&': + case '^': + case '~': + case '!': + case '<': + case '>': + case '?': + case ':': + case '=': + case '{': + case '}': + symbol: + lexptr++; + return c; + + case '\'': + case '"': + case '`': + { + int host_len; + int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval, + &host_len); + if (result == CHARACTER_LITERAL) + { + if (host_len == 0) + error (_("Empty character constant.")); + else if (host_len > 2 && c == '\'') + { + ++tokstart; + namelen = lexptr - tokstart - 1; + goto tryname; + } + else if (host_len > 1) + error (_("Invalid character constant.")); + } + return result; + } + } + + if (!(c == '_' || c == '$' + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) + /* We must have come across a bad character (e.g. ';'). */ + error (_("Invalid character '%c' in expression"), c); + + /* It's a name. See how long it is. */ + namelen = 0; + for (c = tokstart[namelen]; + (c == '_' || c == '$' || (c >= '0' && c <= '9') + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));) + c = tokstart[++namelen]; + + /* The token "if" terminates the expression and is NOT + removed from the input stream. */ + if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + return 0; + + /* For the same reason (breakpoint conditions), "thread N" + terminates the expression. "thread" could be an identifier, but + an identifier is never followed by a number without intervening + punctuation. "task" is similar. Handle abbreviations of these, + similarly to breakpoint.c:find_condition_and_thread. */ + if (namelen >= 1 + && (strncmp (tokstart, "thread", namelen) == 0 + || strncmp (tokstart, "task", namelen) == 0) + && (tokstart[namelen] == ' ' || tokstart[namelen] == '\t')) + { + const char *p = tokstart + namelen + 1; + + while (*p == ' ' || *p == '\t') + p++; + if (*p >= '0' && *p <= '9') + return 0; + } + + lexptr += namelen; + + tryname: + + yylval.sval.ptr = tokstart; + yylval.sval.length = namelen; + + /* Catch specific keywords. */ + copy = copy_name (yylval.sval); + for (i = 0; i < sizeof ident_tokens / sizeof ident_tokens[0]; i++) + if (strcmp (copy, ident_tokens[i].oper) == 0) + { + /* It is ok to always set this, even though we don't always + strictly need to. */ + yylval.opcode = ident_tokens[i].opcode; + return ident_tokens[i].token; + } + + if (*tokstart == '$') + return DOLLAR_VARIABLE; + + yylval.tsym.type + = language_lookup_primitive_type (parse_language (par_state), + parse_gdbarch (par_state), copy); + if (yylval.tsym.type != NULL) + return TYPENAME; + + /* Input names that aren't symbols but ARE valid hex numbers, + when the input radix permits them, can be names or numbers + depending on the parse. Note we support radixes > 16 here. */ + if ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) + || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)) + { + YYSTYPE newlval; /* Its value is ignored. */ + int hextype = parse_number (par_state, tokstart, namelen, 0, &newlval); + if (hextype == INTEGER_LITERAL) + return NAME_OR_INT; + } + + if (parse_completion && *lexptr == '\0') + saw_name_at_eof = 1; + + return IDENTIFIER; +} + +/* An object of this type is pushed on a FIFO by the "outer" lexer. */ +struct token_and_value +{ + int token; + YYSTYPE value; +}; + + +/* A FIFO of tokens that have been read but not yet returned to the + parser. */ +static std::vector token_fifo; + +/* Non-zero if the lexer should return tokens from the FIFO. */ +static int popping; + +/* Temporary storage for yylex; this holds symbol names as they are + built up. */ +static auto_obstack name_obstack; + +/* Classify an IDENTIFIER token. The contents of the token are in `yylval'. + Updates yylval and returns the new token type. BLOCK is the block + in which lookups start; this can be NULL to mean the global scope. */ + +static int +classify_name (struct parser_state *par_state, const struct block *block) +{ + struct block_symbol sym; + char *copy; + struct field_of_this_result is_a_field_of_this; + + copy = copy_name (yylval.sval); + + sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this); + if (sym.symbol && SYMBOL_CLASS (sym.symbol) == LOC_TYPEDEF) + { + yylval.tsym.type = SYMBOL_TYPE (sym.symbol); + return TYPENAME; + } + else if (sym.symbol == NULL) + { + /* Look-up first for a module name, then a type. */ + sym = lookup_symbol (copy, block, MODULE_DOMAIN, NULL); + if (sym.symbol == NULL) + sym = lookup_symbol (copy, block, STRUCT_DOMAIN, NULL); + + if (sym.symbol != NULL) + { + yylval.tsym.type = SYMBOL_TYPE (sym.symbol); + return TYPENAME; + } + + return UNKNOWN_NAME; + } + + return IDENTIFIER; +} + +/* Like classify_name, but used by the inner loop of the lexer, when a + name might have already been seen. CONTEXT is the context type, or + NULL if this is the first component of a name. */ + +static int +classify_inner_name (struct parser_state *par_state, + const struct block *block, struct type *context) +{ + struct type *type; + char *copy; + + if (context == NULL) + return classify_name (par_state, block); + + type = check_typedef (context); + if (!type_aggregate_p (type)) + return ERROR; + + copy = copy_name (yylval.ssym.stoken); + yylval.ssym.sym = d_lookup_nested_symbol (type, copy, block); + + if (yylval.ssym.sym.symbol == NULL) + return ERROR; + + if (SYMBOL_CLASS (yylval.ssym.sym.symbol) == LOC_TYPEDEF) + { + yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym.symbol); + return TYPENAME; + } + + return IDENTIFIER; +} + +/* The outer level of a two-level lexer. This calls the inner lexer + to return tokens. It then either returns these tokens, or + aggregates them into a larger token. This lets us work around a + problem in our parsing approach, where the parser could not + distinguish between qualified names and qualified types at the + right point. */ + +static int +yylex (void) +{ + token_and_value current; + int last_was_dot; + struct type *context_type = NULL; + int last_to_examine, next_to_examine, checkpoint; + const struct block *search_block; + + if (popping && !token_fifo.empty ()) + goto do_pop; + popping = 0; + + /* Read the first token and decide what to do. */ + current.token = lex_one_token (pstate); + if (current.token != IDENTIFIER && current.token != '.') + return current.token; + + /* Read any sequence of alternating "." and identifier tokens into + the token FIFO. */ + current.value = yylval; + token_fifo.push_back (current); + last_was_dot = current.token == '.'; + + while (1) + { + current.token = lex_one_token (pstate); + current.value = yylval; + token_fifo.push_back (current); + + if ((last_was_dot && current.token != IDENTIFIER) + || (!last_was_dot && current.token != '.')) + break; + + last_was_dot = !last_was_dot; + } + popping = 1; + + /* We always read one extra token, so compute the number of tokens + to examine accordingly. */ + last_to_examine = token_fifo.size () - 2; + next_to_examine = 0; + + current = token_fifo[next_to_examine]; + ++next_to_examine; + + /* If we are not dealing with a typename, now is the time to find out. */ + if (current.token == IDENTIFIER) + { + yylval = current.value; + current.token = classify_name (pstate, expression_context_block); + current.value = yylval; + } + + /* If the IDENTIFIER is not known, it could be a package symbol, + first try building up a name until we find the qualified module. */ + if (current.token == UNKNOWN_NAME) + { + name_obstack.clear (); + obstack_grow (&name_obstack, current.value.sval.ptr, + current.value.sval.length); + + last_was_dot = 0; + + while (next_to_examine <= last_to_examine) + { + token_and_value next; + + next = token_fifo[next_to_examine]; + ++next_to_examine; + + if (next.token == IDENTIFIER && last_was_dot) + { + /* Update the partial name we are constructing. */ + obstack_grow_str (&name_obstack, "."); + obstack_grow (&name_obstack, next.value.sval.ptr, + next.value.sval.length); + + yylval.sval.ptr = (char *) obstack_base (&name_obstack); + yylval.sval.length = obstack_object_size (&name_obstack); + + current.token = classify_name (pstate, expression_context_block); + current.value = yylval; + + /* We keep going until we find a TYPENAME. */ + if (current.token == TYPENAME) + { + /* Install it as the first token in the FIFO. */ + token_fifo[0] = current; + token_fifo.erase (token_fifo.begin () + 1, + token_fifo.begin () + next_to_examine); + break; + } + } + else if (next.token == '.' && !last_was_dot) + last_was_dot = 1; + else + { + /* We've reached the end of the name. */ + break; + } + } + + /* Reset our current token back to the start, if we found nothing + this means that we will just jump to do pop. */ + current = token_fifo[0]; + next_to_examine = 1; + } + if (current.token != TYPENAME && current.token != '.') + goto do_pop; + + name_obstack.clear (); + checkpoint = 0; + if (current.token == '.') + search_block = NULL; + else + { + gdb_assert (current.token == TYPENAME); + search_block = expression_context_block; + obstack_grow (&name_obstack, current.value.sval.ptr, + current.value.sval.length); + context_type = current.value.tsym.type; + checkpoint = 1; + } + + last_was_dot = current.token == '.'; + + while (next_to_examine <= last_to_examine) + { + token_and_value next; + + next = token_fifo[next_to_examine]; + ++next_to_examine; + + if (next.token == IDENTIFIER && last_was_dot) + { + int classification; + + yylval = next.value; + classification = classify_inner_name (pstate, search_block, + context_type); + /* We keep going until we either run out of names, or until + we have a qualified name which is not a type. */ + if (classification != TYPENAME && classification != IDENTIFIER) + break; + + /* Accept up to this token. */ + checkpoint = next_to_examine; + + /* Update the partial name we are constructing. */ + if (context_type != NULL) + { + /* We don't want to put a leading "." into the name. */ + obstack_grow_str (&name_obstack, "."); + } + obstack_grow (&name_obstack, next.value.sval.ptr, + next.value.sval.length); + + yylval.sval.ptr = (char *) obstack_base (&name_obstack); + yylval.sval.length = obstack_object_size (&name_obstack); + current.value = yylval; + current.token = classification; + + last_was_dot = 0; + + if (classification == IDENTIFIER) + break; + + context_type = yylval.tsym.type; + } + else if (next.token == '.' && !last_was_dot) + last_was_dot = 1; + else + { + /* We've reached the end of the name. */ + break; + } + } + + /* If we have a replacement token, install it as the first token in + the FIFO, and delete the other constituent tokens. */ + if (checkpoint > 0) + { + token_fifo[0] = current; + if (checkpoint > 1) + token_fifo.erase (token_fifo.begin () + 1, + token_fifo.begin () + checkpoint); + } + + do_pop: + current = token_fifo[0]; + token_fifo.erase (token_fifo.begin ()); + yylval = current.value; + return current.token; +} + +int +d_parse (struct parser_state *par_state) +{ + /* Setting up the parser state. */ + scoped_restore pstate_restore = make_scoped_restore (&pstate); + gdb_assert (par_state != NULL); + pstate = par_state; + + scoped_restore restore_yydebug = make_scoped_restore (&yydebug, + parser_debug); + + /* Initialize some state used by the lexer. */ + last_was_structop = 0; + saw_name_at_eof = 0; + + token_fifo.clear (); + popping = 0; + name_obstack.clear (); + + return yyparse (); +} + +static void +yyerror (const char *msg) +{ + if (prev_lexptr) + lexptr = prev_lexptr; + + error (_("A %s in expression, near `%s'."), msg, lexptr); +} + diff --git a/gdb-8.3.1/gdb/f-exp.c b/gdb-8.3.1/gdb/f-exp.c new file mode 100644 index 0000000000000000000000000000000000000000..ef7ae53364a7adaff8997de69225ea0cc937b5b0 --- /dev/null +++ b/gdb-8.3.1/gdb/f-exp.c @@ -0,0 +1,2935 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* Copy the first part of user declarations. */ +#line 43 "f-exp.y" /* yacc.c:339 */ + + +#include "defs.h" +#include "expression.h" +#include "value.h" +#include "parser-defs.h" +#include "language.h" +#include "f-lang.h" +#include "bfd.h" /* Required by objfiles.h. */ +#include "symfile.h" /* Required by objfiles.h. */ +#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ +#include "block.h" +#include +#include + +#define parse_type(ps) builtin_type (parse_gdbarch (ps)) +#define parse_f_type(ps) builtin_f_type (parse_gdbarch (ps)) + +/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, + etc). */ +#define GDB_YY_REMAP_PREFIX f_ +#include "yy-remap.h" + +/* The state of the parser, used internally when we are parsing the + expression. */ + +static struct parser_state *pstate = NULL; + +int yyparse (void); + +static int yylex (void); + +static void yyerror (const char *); + +static void growbuf_by_size (int); + +static int match_string_literal (void); + + +#line 106 "f-exp.c.tmp" /* yacc.c:339 */ + +# ifndef YY_NULLPTRPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTRPTR nullptr +# else +# define YY_NULLPTRPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + INT = 258, + FLOAT = 259, + STRING_LITERAL = 260, + BOOLEAN_LITERAL = 261, + NAME = 262, + TYPENAME = 263, + NAME_OR_INT = 264, + SIZEOF = 265, + ERROR = 266, + INT_KEYWORD = 267, + INT_S2_KEYWORD = 268, + LOGICAL_S1_KEYWORD = 269, + LOGICAL_S2_KEYWORD = 270, + LOGICAL_S8_KEYWORD = 271, + LOGICAL_KEYWORD = 272, + REAL_KEYWORD = 273, + REAL_S8_KEYWORD = 274, + REAL_S16_KEYWORD = 275, + COMPLEX_S8_KEYWORD = 276, + COMPLEX_S16_KEYWORD = 277, + COMPLEX_S32_KEYWORD = 278, + BOOL_AND = 279, + BOOL_OR = 280, + BOOL_NOT = 281, + CHARACTER = 282, + DOLLAR_VARIABLE = 283, + ASSIGN_MODIFY = 284, + ABOVE_COMMA = 285, + EQUAL = 286, + NOTEQUAL = 287, + LESSTHAN = 288, + GREATERTHAN = 289, + LEQ = 290, + GEQ = 291, + LSH = 292, + RSH = 293, + STARSTAR = 294, + UNARY = 295 + }; +#endif +/* Tokens. */ +#define INT 258 +#define FLOAT 259 +#define STRING_LITERAL 260 +#define BOOLEAN_LITERAL 261 +#define NAME 262 +#define TYPENAME 263 +#define NAME_OR_INT 264 +#define SIZEOF 265 +#define ERROR 266 +#define INT_KEYWORD 267 +#define INT_S2_KEYWORD 268 +#define LOGICAL_S1_KEYWORD 269 +#define LOGICAL_S2_KEYWORD 270 +#define LOGICAL_S8_KEYWORD 271 +#define LOGICAL_KEYWORD 272 +#define REAL_KEYWORD 273 +#define REAL_S8_KEYWORD 274 +#define REAL_S16_KEYWORD 275 +#define COMPLEX_S8_KEYWORD 276 +#define COMPLEX_S16_KEYWORD 277 +#define COMPLEX_S32_KEYWORD 278 +#define BOOL_AND 279 +#define BOOL_OR 280 +#define BOOL_NOT 281 +#define CHARACTER 282 +#define DOLLAR_VARIABLE 283 +#define ASSIGN_MODIFY 284 +#define ABOVE_COMMA 285 +#define EQUAL 286 +#define NOTEQUAL 287 +#define LESSTHAN 288 +#define GREATERTHAN 289 +#define LEQ 290 +#define GEQ 291 +#define LSH 292 +#define RSH 293 +#define STARSTAR 294 +#define UNARY 295 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE +{ +#line 88 "f-exp.y" /* yacc.c:355 */ + + LONGEST lval; + struct { + LONGEST val; + struct type *type; + } typed_val; + struct { + gdb_byte val[16]; + struct type *type; + } typed_val_float; + struct symbol *sym; + struct type *tval; + struct stoken sval; + struct ttype tsym; + struct symtoken ssym; + int voidval; + struct block *bval; + enum exp_opcode opcode; + struct internalvar *ivar; + + struct type **tvec; + int *ivec; + + +#line 248 "f-exp.c.tmp" /* yacc.c:355 */ +}; + +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE yylval; + +int yyparse (void); + + + +/* Copy the second part of user declarations. */ +#line 112 "f-exp.y" /* yacc.c:358 */ + +/* YYSTYPE gets defined by %union */ +static int parse_number (struct parser_state *, const char *, int, + int, YYSTYPE *); + +#line 270 "f-exp.c.tmp" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or xmalloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined xmalloc) \ + && (defined YYFREE || defined xfree))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC xmalloc +# if ! defined xmalloc && ! defined EXIT_SUCCESS +void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE xfree +# if ! defined xfree && ! defined EXIT_SUCCESS +void xfree (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 47 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 529 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 57 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 18 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 86 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 131 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 295 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 51, 36, 2, + 53, 54, 48, 46, 30, 47, 2, 49, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 56, 2, + 2, 32, 2, 33, 45, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 35, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 34, 2, 55, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 31, 37, 38, 39, 40, + 41, 42, 43, 44, 50, 52 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 192, 192, 193, 196, 202, 207, 211, 215, 219, + 223, 227, 237, 236, 247, 250, 254, 258, 264, 270, + 276, 282, 288, 292, 300, 306, 314, 318, 322, 326, + 330, 334, 338, 342, 346, 350, 354, 358, 362, 366, + 370, 374, 378, 382, 387, 391, 395, 401, 408, 419, + 426, 429, 432, 443, 450, 458, 490, 493, 494, 538, + 540, 542, 544, 546, 549, 551, 553, 557, 559, 564, + 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, + 586, 588, 590, 595, 600, 607, 611 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "INT", "FLOAT", "STRING_LITERAL", + "BOOLEAN_LITERAL", "NAME", "TYPENAME", "NAME_OR_INT", "SIZEOF", "ERROR", + "INT_KEYWORD", "INT_S2_KEYWORD", "LOGICAL_S1_KEYWORD", + "LOGICAL_S2_KEYWORD", "LOGICAL_S8_KEYWORD", "LOGICAL_KEYWORD", + "REAL_KEYWORD", "REAL_S8_KEYWORD", "REAL_S16_KEYWORD", + "COMPLEX_S8_KEYWORD", "COMPLEX_S16_KEYWORD", "COMPLEX_S32_KEYWORD", + "BOOL_AND", "BOOL_OR", "BOOL_NOT", "CHARACTER", "DOLLAR_VARIABLE", + "ASSIGN_MODIFY", "','", "ABOVE_COMMA", "'='", "'?'", "'|'", "'^'", "'&'", + "EQUAL", "NOTEQUAL", "LESSTHAN", "GREATERTHAN", "LEQ", "GEQ", "LSH", + "RSH", "'@'", "'+'", "'-'", "'*'", "'/'", "STARSTAR", "'%'", "UNARY", + "'('", "')'", "'~'", "':'", "$accept", "start", "type_exp", "exp", "$@1", + "arglist", "subrange", "complexnum", "variable", "type", "ptype", + "abs_decl", "direct_abs_decl", "func_mod", "typebase", + "nonempty_typelist", "name", "name_not_typename", YY_NULLPTRPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 44, 285, 61, 63, 124, 94, 38, 286, 287, 288, + 289, 290, 291, 292, 293, 64, 43, 45, 42, 47, + 294, 37, 295, 40, 41, 126, 58 +}; +# endif + +#define YYPACT_NINF -57 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-57))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 134, -57, -57, -57, -57, -57, -57, -57, 162, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, 190, -57, -57, 190, 190, 190, 134, 190, 19, + -57, 359, -57, -57, -57, -35, -57, 134, -33, -33, + -33, -33, -33, 328, -32, -31, -33, -57, 190, 190, + 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, + 190, 190, 190, 190, 190, 190, 190, 190, 190, 24, + -57, -35, -35, 234, -57, -12, -57, -11, 190, -57, + -57, 190, 407, 387, 359, 359, 426, 444, 461, 476, + 476, 228, 228, 228, 228, -13, -13, 49, -39, -39, + -46, -46, -46, -57, -57, 80, -57, -57, -57, -57, + -10, -27, 277, -57, 66, 359, -33, 190, 298, -24, + -57, -57, 293, -57, 359, 190, 190, -57, -57, 359, + 359 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 47, 49, 54, 53, 86, 69, 48, 0, 70, + 71, 76, 75, 73, 74, 77, 78, 79, 80, 81, + 82, 0, 72, 51, 0, 0, 0, 0, 0, 0, + 3, 2, 50, 4, 56, 57, 55, 0, 11, 9, + 7, 8, 6, 0, 0, 0, 10, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 12, 61, 59, 0, 58, 63, 66, 0, 0, 5, + 23, 0, 43, 44, 46, 45, 42, 41, 40, 34, + 35, 38, 39, 36, 37, 32, 33, 26, 30, 31, + 28, 29, 27, 85, 25, 14, 62, 60, 67, 83, + 0, 0, 0, 65, 52, 22, 24, 21, 15, 0, + 16, 64, 0, 68, 20, 19, 0, 13, 84, 18, + 17 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -57, -57, -57, 0, -57, -57, -57, -57, -57, 2, + -57, -56, -57, -30, -57, -57, -57, -57 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 29, 30, 43, 105, 119, 120, 44, 32, 109, + 34, 74, 75, 76, 35, 111, 104, 36 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint8 yytable[] = +{ + 31, 71, 33, 122, 68, 69, 126, 70, 38, 66, + 67, 68, 69, 72, 70, 106, 107, 110, 73, 47, + 70, 39, 80, 81, 40, 41, 42, 123, 46, 45, + 127, 103, 63, 64, 65, 66, 67, 68, 69, 77, + 70, 112, 0, 114, 121, 113, 0, 0, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 1, + 2, 3, 4, 5, 0, 7, 8, 0, 115, 0, + 0, 116, 0, 1, 2, 3, 4, 5, 0, 7, + 8, 0, 21, 0, 23, 64, 65, 66, 67, 68, + 69, 0, 70, 0, 0, 118, 21, 0, 23, 0, + 0, 0, 0, 0, 116, 0, 24, 124, 0, 27, + 0, 28, 0, 0, 128, 129, 130, 25, 26, 0, + 0, 0, 0, 27, 0, 28, 117, 1, 2, 3, + 4, 5, 6, 7, 8, 0, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 0, 0, + 21, 22, 23, 0, 0, 1, 2, 3, 4, 5, + 24, 7, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 25, 26, 0, 0, 0, 0, 27, 21, 28, + 23, 0, 0, 1, 2, 3, 4, 5, 24, 7, + 8, 0, 0, 0, 0, 0, 0, 0, 0, 25, + 26, 0, 0, 0, 0, 37, 21, 28, 23, 0, + 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 25, 26, 0, + 0, 0, 6, 27, 0, 28, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 0, 0, + 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, + 71, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 0, 70, 72, 0, 0, 6, 0, 73, 108, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 6, 0, 0, 22, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 0, 0, 0, + 22, 0, 48, 49, 0, 0, 0, 50, 0, 0, + 51, 108, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 0, 70, 48, 49, 125, 0, 0, 50, 78, 0, + 51, 0, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 0, 70, 79, 48, 49, 0, 0, 0, 50, 0, + 0, 51, 0, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 48, 70, 0, 0, 0, 0, 0, 0, 0, + 0, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, + 70, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, + 70, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 0, 70, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 0, 70, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 0, 70, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 0, 70 +}; + +static const yytype_int8 yycheck[] = +{ + 0, 36, 0, 30, 50, 51, 30, 53, 8, 48, + 49, 50, 51, 48, 53, 71, 72, 73, 53, 0, + 53, 21, 54, 54, 24, 25, 26, 54, 28, 27, + 54, 7, 45, 46, 47, 48, 49, 50, 51, 37, + 53, 53, -1, 54, 54, 75, -1, -1, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 3, + 4, 5, 6, 7, -1, 9, 10, -1, 78, -1, + -1, 81, -1, 3, 4, 5, 6, 7, -1, 9, + 10, -1, 26, -1, 28, 46, 47, 48, 49, 50, + 51, -1, 53, -1, -1, 105, 26, -1, 28, -1, + -1, -1, -1, -1, 114, -1, 36, 117, -1, 53, + -1, 55, -1, -1, 122, 125, 126, 47, 48, -1, + -1, -1, -1, 53, -1, 55, 56, 3, 4, 5, + 6, 7, 8, 9, 10, -1, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, -1, -1, + 26, 27, 28, -1, -1, 3, 4, 5, 6, 7, + 36, 9, 10, -1, -1, -1, -1, -1, -1, -1, + -1, 47, 48, -1, -1, -1, -1, 53, 26, 55, + 28, -1, -1, 3, 4, 5, 6, 7, 36, 9, + 10, -1, -1, -1, -1, -1, -1, -1, -1, 47, + 48, -1, -1, -1, -1, 53, 26, 55, 28, -1, + -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 47, 48, -1, + -1, -1, 8, 53, -1, 55, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, -1, -1, + -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, + 36, 43, 44, 45, 46, 47, 48, 49, 50, 51, + -1, 53, 48, -1, -1, 8, -1, 53, 54, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 8, -1, -1, 27, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, -1, -1, -1, + 27, -1, 24, 25, -1, -1, -1, 29, -1, -1, + 32, 54, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + -1, 53, 24, 25, 56, -1, -1, 29, 30, -1, + 32, -1, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + -1, 53, 54, 24, 25, -1, -1, -1, 29, -1, + -1, 32, -1, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 24, 53, -1, -1, -1, -1, -1, -1, -1, + -1, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, + 53, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, + 53, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, -1, 53, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, -1, 53, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, -1, 53, 39, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, -1, 53 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 4, 5, 6, 7, 8, 9, 10, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 26, 27, 28, 36, 47, 48, 53, 55, 58, + 59, 60, 65, 66, 67, 71, 74, 53, 60, 60, + 60, 60, 60, 60, 64, 66, 60, 0, 24, 25, + 29, 32, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 53, 36, 48, 53, 68, 69, 70, 66, 30, 54, + 54, 54, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 7, 73, 61, 68, 68, 54, 66, + 68, 72, 53, 70, 54, 60, 60, 56, 60, 62, + 63, 54, 30, 54, 60, 56, 30, 54, 66, 60, + 60 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 57, 58, 58, 59, 60, 60, 60, 60, 60, + 60, 60, 61, 60, 62, 62, 62, 62, 63, 63, + 63, 63, 64, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + 60, 60, 60, 60, 60, 65, 66, 67, 67, 68, + 68, 68, 68, 68, 69, 69, 69, 70, 70, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 72, 72, 73, 74 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 3, 2, 2, 2, 2, + 2, 2, 0, 5, 0, 1, 1, 3, 3, 2, + 2, 1, 3, 3, 4, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, + 1, 1, 4, 1, 1, 1, 1, 1, 2, 1, + 2, 1, 2, 1, 3, 2, 1, 2, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 1, 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTRPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTRPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTRPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +{ + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to xreallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to xreallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: +#line 197 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_TYPE); + write_exp_elt_type (pstate, (yyvsp[0].tval)); + write_exp_elt_opcode (pstate, OP_TYPE); } +#line 1527 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 5: +#line 203 "f-exp.y" /* yacc.c:1646 */ + { } +#line 1533 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 6: +#line 208 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_IND); } +#line 1539 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 7: +#line 212 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ADDR); } +#line 1545 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 8: +#line 216 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_NEG); } +#line 1551 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 9: +#line 220 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); } +#line 1557 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 10: +#line 224 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_COMPLEMENT); } +#line 1563 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 11: +#line 228 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_SIZEOF); } +#line 1569 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 12: +#line 237 "f-exp.y" /* yacc.c:1646 */ + { start_arglist (); } +#line 1575 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 13: +#line 239 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, + OP_F77_UNDETERMINED_ARGLIST); + write_exp_elt_longcst (pstate, + (LONGEST) end_arglist ()); + write_exp_elt_opcode (pstate, + OP_F77_UNDETERMINED_ARGLIST); } +#line 1586 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 15: +#line 251 "f-exp.y" /* yacc.c:1646 */ + { arglist_len = 1; } +#line 1592 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 16: +#line 255 "f-exp.y" /* yacc.c:1646 */ + { arglist_len = 1; } +#line 1598 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 17: +#line 259 "f-exp.y" /* yacc.c:1646 */ + { arglist_len++; } +#line 1604 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 18: +#line 265 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_RANGE); + write_exp_elt_longcst (pstate, NONE_BOUND_DEFAULT); + write_exp_elt_opcode (pstate, OP_RANGE); } +#line 1612 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 19: +#line 271 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_RANGE); + write_exp_elt_longcst (pstate, HIGH_BOUND_DEFAULT); + write_exp_elt_opcode (pstate, OP_RANGE); } +#line 1620 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 20: +#line 277 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_RANGE); + write_exp_elt_longcst (pstate, LOW_BOUND_DEFAULT); + write_exp_elt_opcode (pstate, OP_RANGE); } +#line 1628 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 21: +#line 283 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_RANGE); + write_exp_elt_longcst (pstate, BOTH_BOUND_DEFAULT); + write_exp_elt_opcode (pstate, OP_RANGE); } +#line 1636 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 22: +#line 289 "f-exp.y" /* yacc.c:1646 */ + { } +#line 1642 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 23: +#line 293 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_COMPLEX); + write_exp_elt_type (pstate, + parse_f_type (pstate) + ->builtin_complex_s16); + write_exp_elt_opcode (pstate, OP_COMPLEX); } +#line 1652 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 24: +#line 301 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_CAST); + write_exp_elt_type (pstate, (yyvsp[-2].tval)); + write_exp_elt_opcode (pstate, UNOP_CAST); } +#line 1660 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 25: +#line 307 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 1668 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 26: +#line 315 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_REPEAT); } +#line 1674 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 27: +#line 319 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_EXP); } +#line 1680 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 28: +#line 323 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_MUL); } +#line 1686 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 29: +#line 327 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_DIV); } +#line 1692 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 30: +#line 331 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ADD); } +#line 1698 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 31: +#line 335 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUB); } +#line 1704 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 32: +#line 339 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LSH); } +#line 1710 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 33: +#line 343 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_RSH); } +#line 1716 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 34: +#line 347 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_EQUAL); } +#line 1722 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 35: +#line 351 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); } +#line 1728 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 36: +#line 355 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LEQ); } +#line 1734 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 37: +#line 359 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GEQ); } +#line 1740 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 38: +#line 363 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LESS); } +#line 1746 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 39: +#line 367 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GTR); } +#line 1752 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 40: +#line 371 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); } +#line 1758 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 41: +#line 375 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); } +#line 1764 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 42: +#line 379 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); } +#line 1770 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 43: +#line 383 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); } +#line 1776 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 44: +#line 388 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); } +#line 1782 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 45: +#line 392 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN); } +#line 1788 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 46: +#line 396 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); + write_exp_elt_opcode (pstate, (yyvsp[-1].opcode)); + write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); } +#line 1796 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 47: +#line 402 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, (yyvsp[0].typed_val).type); + write_exp_elt_longcst (pstate, (LONGEST) ((yyvsp[0].typed_val).val)); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 1805 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 48: +#line 409 "f-exp.y" /* yacc.c:1646 */ + { YYSTYPE val; + parse_number (pstate, (yyvsp[0].ssym).stoken.ptr, + (yyvsp[0].ssym).stoken.length, 0, &val); + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, val.typed_val.type); + write_exp_elt_longcst (pstate, + (LONGEST)val.typed_val.val); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 1818 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 49: +#line 420 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FLOAT); + write_exp_elt_type (pstate, (yyvsp[0].typed_val_float).type); + write_exp_elt_floatcst (pstate, (yyvsp[0].typed_val_float).val); + write_exp_elt_opcode (pstate, OP_FLOAT); } +#line 1827 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 52: +#line 433 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_f_type (pstate) + ->builtin_integer); + (yyvsp[-1].tval) = check_typedef ((yyvsp[-1].tval)); + write_exp_elt_longcst (pstate, + (LONGEST) TYPE_LENGTH ((yyvsp[-1].tval))); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 1840 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 53: +#line 444 "f-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_BOOL); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval)); + write_exp_elt_opcode (pstate, OP_BOOL); + } +#line 1849 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 54: +#line 451 "f-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_STRING); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, OP_STRING); + } +#line 1859 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 55: +#line 459 "f-exp.y" /* yacc.c:1646 */ + { struct block_symbol sym = (yyvsp[0].ssym).sym; + + if (sym.symbol) + { + if (symbol_read_needs_frame (sym.symbol)) + innermost_block.update (sym); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, sym.block); + write_exp_elt_sym (pstate, sym.symbol); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + break; + } + else + { + struct bound_minimal_symbol msymbol; + char *arg = copy_name ((yyvsp[0].ssym).stoken); + + msymbol = + lookup_bound_minimal_symbol (arg); + if (msymbol.minsym != NULL) + write_exp_msymbol (pstate, msymbol); + else if (!have_full_symbols () && !have_partial_symbols ()) + error (_("No symbol table is loaded. Use the \"file\" command.")); + else + error (_("No symbol \"%s\" in current context."), + copy_name ((yyvsp[0].ssym).stoken)); + } + } +#line 1892 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 58: +#line 495 "f-exp.y" /* yacc.c:1646 */ + { + /* This is where the interesting stuff happens. */ + int done = 0; + int array_size; + struct type *follow_type = (yyvsp[-1].tval); + struct type *range_type; + + while (!done) + switch (pop_type ()) + { + case tp_end: + done = 1; + break; + case tp_pointer: + follow_type = lookup_pointer_type (follow_type); + break; + case tp_reference: + follow_type = lookup_lvalue_reference_type (follow_type); + break; + case tp_array: + array_size = pop_type_int (); + if (array_size != -1) + { + range_type = + create_static_range_type ((struct type *) NULL, + parse_f_type (pstate) + ->builtin_integer, + 0, array_size - 1); + follow_type = + create_array_type ((struct type *) NULL, + follow_type, range_type); + } + else + follow_type = lookup_pointer_type (follow_type); + break; + case tp_function: + follow_type = lookup_function_type (follow_type); + break; + } + (yyval.tval) = follow_type; + } +#line 1938 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 59: +#line 539 "f-exp.y" /* yacc.c:1646 */ + { push_type (tp_pointer); (yyval.voidval) = 0; } +#line 1944 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 60: +#line 541 "f-exp.y" /* yacc.c:1646 */ + { push_type (tp_pointer); (yyval.voidval) = (yyvsp[0].voidval); } +#line 1950 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 61: +#line 543 "f-exp.y" /* yacc.c:1646 */ + { push_type (tp_reference); (yyval.voidval) = 0; } +#line 1956 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 62: +#line 545 "f-exp.y" /* yacc.c:1646 */ + { push_type (tp_reference); (yyval.voidval) = (yyvsp[0].voidval); } +#line 1962 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 64: +#line 550 "f-exp.y" /* yacc.c:1646 */ + { (yyval.voidval) = (yyvsp[-1].voidval); } +#line 1968 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 65: +#line 552 "f-exp.y" /* yacc.c:1646 */ + { push_type (tp_function); } +#line 1974 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 66: +#line 554 "f-exp.y" /* yacc.c:1646 */ + { push_type (tp_function); } +#line 1980 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 67: +#line 558 "f-exp.y" /* yacc.c:1646 */ + { (yyval.voidval) = 0; } +#line 1986 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 68: +#line 560 "f-exp.y" /* yacc.c:1646 */ + { xfree ((yyvsp[-1].tvec)); (yyval.voidval) = 0; } +#line 1992 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 69: +#line 565 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = (yyvsp[0].tsym).type; } +#line 1998 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 70: +#line 567 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_integer; } +#line 2004 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 71: +#line 569 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_integer_s2; } +#line 2010 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 72: +#line 571 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_character; } +#line 2016 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 73: +#line 573 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_logical_s8; } +#line 2022 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 74: +#line 575 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_logical; } +#line 2028 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 75: +#line 577 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_logical_s2; } +#line 2034 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 76: +#line 579 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_logical_s1; } +#line 2040 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 77: +#line 581 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_real; } +#line 2046 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 78: +#line 583 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_real_s8; } +#line 2052 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 79: +#line 585 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_real_s16; } +#line 2058 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 80: +#line 587 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_complex_s8; } +#line 2064 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 81: +#line 589 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_complex_s16; } +#line 2070 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 82: +#line 591 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = parse_f_type (pstate)->builtin_complex_s32; } +#line 2076 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 83: +#line 596 "f-exp.y" /* yacc.c:1646 */ + { (yyval.tvec) = (struct type **) xmalloc (sizeof (struct type *) * 2); + (yyval.ivec)[0] = 1; /* Number of types in vector */ + (yyval.tvec)[1] = (yyvsp[0].tval); + } +#line 2085 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 84: +#line 601 "f-exp.y" /* yacc.c:1646 */ + { int len = sizeof (struct type *) * (++((yyvsp[-2].ivec)[0]) + 1); + (yyval.tvec) = (struct type **) xrealloc ((char *) (yyvsp[-2].tvec), len); + (yyval.tvec)[(yyval.ivec)[0]] = (yyvsp[0].tval); + } +#line 2094 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 85: +#line 608 "f-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].ssym).stoken; } +#line 2100 "f-exp.c.tmp" /* yacc.c:1646 */ + break; + + +#line 2104 "f-exp.c.tmp" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 621 "f-exp.y" /* yacc.c:1906 */ + + +/* Take care of parsing a number (anything that starts with a digit). + Set yylval and return the token type; update lexptr. + LEN is the number of characters in it. */ + +/*** Needs some error checking for the float case ***/ + +static int +parse_number (struct parser_state *par_state, + const char *p, int len, int parsed_float, YYSTYPE *putithere) +{ + LONGEST n = 0; + LONGEST prevn = 0; + int c; + int base = input_radix; + int unsigned_p = 0; + int long_p = 0; + ULONGEST high_bit; + struct type *signed_type; + struct type *unsigned_type; + + if (parsed_float) + { + /* It's a float since it contains a point or an exponent. */ + /* [dD] is not understood as an exponent by parse_float, + change it to 'e'. */ + char *tmp, *tmp2; + + tmp = xstrdup (p); + for (tmp2 = tmp; *tmp2; ++tmp2) + if (*tmp2 == 'd' || *tmp2 == 'D') + *tmp2 = 'e'; + + /* FIXME: Should this use different types? */ + putithere->typed_val_float.type = parse_f_type (pstate)->builtin_real_s8; + bool parsed = parse_float (tmp, len, + putithere->typed_val_float.type, + putithere->typed_val_float.val); + xfree (tmp); + return parsed? FLOAT : ERROR; + } + + /* Handle base-switching prefixes 0x, 0t, 0d, 0 */ + if (p[0] == '0') + switch (p[1]) + { + case 'x': + case 'X': + if (len >= 3) + { + p += 2; + base = 16; + len -= 2; + } + break; + + case 't': + case 'T': + case 'd': + case 'D': + if (len >= 3) + { + p += 2; + base = 10; + len -= 2; + } + break; + + default: + base = 8; + break; + } + + while (len-- > 0) + { + c = *p++; + if (isupper (c)) + c = tolower (c); + if (len == 0 && c == 'l') + long_p = 1; + else if (len == 0 && c == 'u') + unsigned_p = 1; + else + { + int i; + if (c >= '0' && c <= '9') + i = c - '0'; + else if (c >= 'a' && c <= 'f') + i = c - 'a' + 10; + else + return ERROR; /* Char not a digit */ + if (i >= base) + return ERROR; /* Invalid digit in this base */ + n *= base; + n += i; + } + /* Portably test for overflow (only works for nonzero values, so make + a second check for zero). */ + if ((prevn >= n) && n != 0) + unsigned_p=1; /* Try something unsigned */ + /* If range checking enabled, portably test for unsigned overflow. */ + if (RANGE_CHECK && n != 0) + { + if ((unsigned_p && (unsigned)prevn >= (unsigned)n)) + range_error (_("Overflow on numeric constant.")); + } + prevn = n; + } + + /* If the number is too big to be an int, or it's got an l suffix + then it's a long. Work out if this has to be a long by + shifting right and seeing if anything remains, and the + target int size is different to the target long size. + + In the expression below, we could have tested + (n >> gdbarch_int_bit (parse_gdbarch)) + to see if it was zero, + but too many compilers warn about that, when ints and longs + are the same size. So we shift it twice, with fewer bits + each time, for the same result. */ + + if ((gdbarch_int_bit (parse_gdbarch (par_state)) + != gdbarch_long_bit (parse_gdbarch (par_state)) + && ((n >> 2) + >> (gdbarch_int_bit (parse_gdbarch (par_state))-2))) /* Avoid + shift warning */ + || long_p) + { + high_bit = ((ULONGEST)1) + << (gdbarch_long_bit (parse_gdbarch (par_state))-1); + unsigned_type = parse_type (par_state)->builtin_unsigned_long; + signed_type = parse_type (par_state)->builtin_long; + } + else + { + high_bit = + ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch (par_state)) - 1); + unsigned_type = parse_type (par_state)->builtin_unsigned_int; + signed_type = parse_type (par_state)->builtin_int; + } + + putithere->typed_val.val = n; + + /* If the high bit of the worked out type is set then this number + has to be unsigned. */ + + if (unsigned_p || (n & high_bit)) + putithere->typed_val.type = unsigned_type; + else + putithere->typed_val.type = signed_type; + + return INT; +} + +struct token +{ + const char *oper; + int token; + enum exp_opcode opcode; +}; + +static const struct token dot_ops[] = +{ + { ".and.", BOOL_AND, BINOP_END }, + { ".AND.", BOOL_AND, BINOP_END }, + { ".or.", BOOL_OR, BINOP_END }, + { ".OR.", BOOL_OR, BINOP_END }, + { ".not.", BOOL_NOT, BINOP_END }, + { ".NOT.", BOOL_NOT, BINOP_END }, + { ".eq.", EQUAL, BINOP_END }, + { ".EQ.", EQUAL, BINOP_END }, + { ".eqv.", EQUAL, BINOP_END }, + { ".NEQV.", NOTEQUAL, BINOP_END }, + { ".neqv.", NOTEQUAL, BINOP_END }, + { ".EQV.", EQUAL, BINOP_END }, + { ".ne.", NOTEQUAL, BINOP_END }, + { ".NE.", NOTEQUAL, BINOP_END }, + { ".le.", LEQ, BINOP_END }, + { ".LE.", LEQ, BINOP_END }, + { ".ge.", GEQ, BINOP_END }, + { ".GE.", GEQ, BINOP_END }, + { ".gt.", GREATERTHAN, BINOP_END }, + { ".GT.", GREATERTHAN, BINOP_END }, + { ".lt.", LESSTHAN, BINOP_END }, + { ".LT.", LESSTHAN, BINOP_END }, + { NULL, 0, BINOP_END } +}; + +struct f77_boolean_val +{ + const char *name; + int value; +}; + +static const struct f77_boolean_val boolean_values[] = +{ + { ".true.", 1 }, + { ".TRUE.", 1 }, + { ".false.", 0 }, + { ".FALSE.", 0 }, + { NULL, 0 } +}; + +static const struct token f77_keywords[] = +{ + { "complex_16", COMPLEX_S16_KEYWORD, BINOP_END }, + { "complex_32", COMPLEX_S32_KEYWORD, BINOP_END }, + { "character", CHARACTER, BINOP_END }, + { "integer_2", INT_S2_KEYWORD, BINOP_END }, + { "logical_1", LOGICAL_S1_KEYWORD, BINOP_END }, + { "logical_2", LOGICAL_S2_KEYWORD, BINOP_END }, + { "logical_8", LOGICAL_S8_KEYWORD, BINOP_END }, + { "complex_8", COMPLEX_S8_KEYWORD, BINOP_END }, + { "integer", INT_KEYWORD, BINOP_END }, + { "logical", LOGICAL_KEYWORD, BINOP_END }, + { "real_16", REAL_S16_KEYWORD, BINOP_END }, + { "complex", COMPLEX_S8_KEYWORD, BINOP_END }, + { "sizeof", SIZEOF, BINOP_END }, + { "real_8", REAL_S8_KEYWORD, BINOP_END }, + { "real", REAL_KEYWORD, BINOP_END }, + { NULL, 0, BINOP_END } +}; + +/* Implementation of a dynamically expandable buffer for processing input + characters acquired through lexptr and building a value to return in + yylval. Ripped off from ch-exp.y */ + +static char *tempbuf; /* Current buffer contents */ +static int tempbufsize; /* Size of allocated buffer */ +static int tempbufindex; /* Current index into buffer */ + +#define GROWBY_MIN_SIZE 64 /* Minimum amount to grow buffer by */ + +#define CHECKBUF(size) \ + do { \ + if (tempbufindex + (size) >= tempbufsize) \ + { \ + growbuf_by_size (size); \ + } \ + } while (0); + + +/* Grow the static temp buffer if necessary, including allocating the + first one on demand. */ + +static void +growbuf_by_size (int count) +{ + int growby; + + growby = std::max (count, GROWBY_MIN_SIZE); + tempbufsize += growby; + if (tempbuf == NULL) + tempbuf = (char *) xmalloc (tempbufsize); + else + tempbuf = (char *) xrealloc (tempbuf, tempbufsize); +} + +/* Blatantly ripped off from ch-exp.y. This routine recognizes F77 + string-literals. + + Recognize a string literal. A string literal is a nonzero sequence + of characters enclosed in matching single quotes, except that + a single character inside single quotes is a character literal, which + we reject as a string literal. To embed the terminator character inside + a string, it is simply doubled (I.E. 'this''is''one''string') */ + +static int +match_string_literal (void) +{ + const char *tokptr = lexptr; + + for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++) + { + CHECKBUF (1); + if (*tokptr == *lexptr) + { + if (*(tokptr + 1) == *lexptr) + tokptr++; + else + break; + } + tempbuf[tempbufindex++] = *tokptr; + } + if (*tokptr == '\0' /* no terminator */ + || tempbufindex == 0) /* no string */ + return 0; + else + { + tempbuf[tempbufindex] = '\0'; + yylval.sval.ptr = tempbuf; + yylval.sval.length = tempbufindex; + lexptr = ++tokptr; + return STRING_LITERAL; + } +} + +/* Read one token, getting characters through lexptr. */ + +static int +yylex (void) +{ + int c; + int namelen; + unsigned int token; + const char *tokstart; + + retry: + + prev_lexptr = lexptr; + + tokstart = lexptr; + + /* First of all, let us make sure we are not dealing with the + special tokens .true. and .false. which evaluate to 1 and 0. */ + + if (*lexptr == '.') + { + for (int i = 0; boolean_values[i].name != NULL; i++) + { + if (strncmp (tokstart, boolean_values[i].name, + strlen (boolean_values[i].name)) == 0) + { + lexptr += strlen (boolean_values[i].name); + yylval.lval = boolean_values[i].value; + return BOOLEAN_LITERAL; + } + } + } + + /* See if it is a special .foo. operator. */ + + for (int i = 0; dot_ops[i].oper != NULL; i++) + if (strncmp (tokstart, dot_ops[i].oper, + strlen (dot_ops[i].oper)) == 0) + { + lexptr += strlen (dot_ops[i].oper); + yylval.opcode = dot_ops[i].opcode; + return dot_ops[i].token; + } + + /* See if it is an exponentiation operator. */ + + if (strncmp (tokstart, "**", 2) == 0) + { + lexptr += 2; + yylval.opcode = BINOP_EXP; + return STARSTAR; + } + + switch (c = *tokstart) + { + case 0: + return 0; + + case ' ': + case '\t': + case '\n': + lexptr++; + goto retry; + + case '\'': + token = match_string_literal (); + if (token != 0) + return (token); + break; + + case '(': + paren_depth++; + lexptr++; + return c; + + case ')': + if (paren_depth == 0) + return 0; + paren_depth--; + lexptr++; + return c; + + case ',': + if (comma_terminates && paren_depth == 0) + return 0; + lexptr++; + return c; + + case '.': + /* Might be a floating point number. */ + if (lexptr[1] < '0' || lexptr[1] > '9') + goto symbol; /* Nope, must be a symbol. */ + /* FALL THRU. */ + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + /* It's a number. */ + int got_dot = 0, got_e = 0, got_d = 0, toktype; + const char *p = tokstart; + int hex = input_radix > 10; + + if (c == '0' && (p[1] == 'x' || p[1] == 'X')) + { + p += 2; + hex = 1; + } + else if (c == '0' && (p[1]=='t' || p[1]=='T' + || p[1]=='d' || p[1]=='D')) + { + p += 2; + hex = 0; + } + + for (;; ++p) + { + if (!hex && !got_e && (*p == 'e' || *p == 'E')) + got_dot = got_e = 1; + else if (!hex && !got_d && (*p == 'd' || *p == 'D')) + got_dot = got_d = 1; + else if (!hex && !got_dot && *p == '.') + got_dot = 1; + else if (((got_e && (p[-1] == 'e' || p[-1] == 'E')) + || (got_d && (p[-1] == 'd' || p[-1] == 'D'))) + && (*p == '-' || *p == '+')) + /* This is the sign of the exponent, not the end of the + number. */ + continue; + /* We will take any letters or digits. parse_number will + complain if past the radix, or if L or U are not final. */ + else if ((*p < '0' || *p > '9') + && ((*p < 'a' || *p > 'z') + && (*p < 'A' || *p > 'Z'))) + break; + } + toktype = parse_number (pstate, tokstart, p - tokstart, + got_dot|got_e|got_d, + &yylval); + if (toktype == ERROR) + { + char *err_copy = (char *) alloca (p - tokstart + 1); + + memcpy (err_copy, tokstart, p - tokstart); + err_copy[p - tokstart] = 0; + error (_("Invalid number \"%s\"."), err_copy); + } + lexptr = p; + return toktype; + } + + case '+': + case '-': + case '*': + case '/': + case '%': + case '|': + case '&': + case '^': + case '~': + case '!': + case '@': + case '<': + case '>': + case '[': + case ']': + case '?': + case ':': + case '=': + case '{': + case '}': + symbol: + lexptr++; + return c; + } + + if (!(c == '_' || c == '$' || c ==':' + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) + /* We must have come across a bad character (e.g. ';'). */ + error (_("Invalid character '%c' in expression."), c); + + namelen = 0; + for (c = tokstart[namelen]; + (c == '_' || c == '$' || c == ':' || (c >= '0' && c <= '9') + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); + c = tokstart[++namelen]); + + /* The token "if" terminates the expression and is NOT + removed from the input stream. */ + + if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + return 0; + + lexptr += namelen; + + /* Catch specific keywords. */ + + for (int i = 0; f77_keywords[i].oper != NULL; i++) + if (strlen (f77_keywords[i].oper) == namelen + && strncmp (tokstart, f77_keywords[i].oper, namelen) == 0) + { + /* lexptr += strlen(f77_keywords[i].operator); */ + yylval.opcode = f77_keywords[i].opcode; + return f77_keywords[i].token; + } + + yylval.sval.ptr = tokstart; + yylval.sval.length = namelen; + + if (*tokstart == '$') + { + write_dollar_variable (pstate, yylval.sval); + return DOLLAR_VARIABLE; + } + + /* Use token-type TYPENAME for symbols that happen to be defined + currently as names of types; NAME for other symbols. + The caller is not constrained to care about the distinction. */ + { + char *tmp = copy_name (yylval.sval); + struct block_symbol result; + struct field_of_this_result is_a_field_of_this; + enum domain_enum_tag lookup_domains[] = + { + STRUCT_DOMAIN, + VAR_DOMAIN, + MODULE_DOMAIN + }; + int hextype; + + for (int i = 0; i < ARRAY_SIZE (lookup_domains); ++i) + { + /* Initialize this in case we *don't* use it in this call; that + way we can refer to it unconditionally below. */ + memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this)); + + result = lookup_symbol (tmp, expression_context_block, + lookup_domains[i], + parse_language (pstate)->la_language + == language_cplus + ? &is_a_field_of_this : NULL); + if (result.symbol && SYMBOL_CLASS (result.symbol) == LOC_TYPEDEF) + { + yylval.tsym.type = SYMBOL_TYPE (result.symbol); + return TYPENAME; + } + + if (result.symbol) + break; + } + + yylval.tsym.type + = language_lookup_primitive_type (parse_language (pstate), + parse_gdbarch (pstate), tmp); + if (yylval.tsym.type != NULL) + return TYPENAME; + + /* Input names that aren't symbols but ARE valid hex numbers, + when the input radix permits them, can be names or numbers + depending on the parse. Note we support radixes > 16 here. */ + if (!result.symbol + && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) + || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10))) + { + YYSTYPE newlval; /* Its value is ignored. */ + hextype = parse_number (pstate, tokstart, namelen, 0, &newlval); + if (hextype == INT) + { + yylval.ssym.sym = result; + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + return NAME_OR_INT; + } + } + + /* Any other kind of symbol */ + yylval.ssym.sym = result; + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + return NAME; + } +} + +int +f_parse (struct parser_state *par_state) +{ + /* Setting up the parser state. */ + scoped_restore pstate_restore = make_scoped_restore (&pstate); + gdb_assert (par_state != NULL); + pstate = par_state; + + return yyparse (); +} + +static void +yyerror (const char *msg) +{ + if (prev_lexptr) + lexptr = prev_lexptr; + + error (_("A %s in expression, near `%s'."), msg, lexptr); +} diff --git a/gdb-8.3.1/gdb/gcore b/gdb-8.3.1/gdb/gcore new file mode 100755 index 0000000000000000000000000000000000000000..ada4fbb5ab35181206dfd4f43b6ee20ea9fcf301 --- /dev/null +++ b/gdb-8.3.1/gdb/gcore @@ -0,0 +1,117 @@ +#!/usr/bin/env bash + +# Copyright (C) 2003-2019 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# +# Script to generate a core file of a running program. +# It starts up gdb, attaches to the given PID and invokes the gcore command. +# + +# Need to check for -o option, but set default basename to "core". +prefix=core + +# When the -a option is present, this may hold additional commands +# to ensure gdb dumps all mappings (OS dependent). +dump_all_cmds=() + +while getopts :ao: opt; do + case "$opt" in + a) + case "$OSTYPE" in + linux*) + dump_all_cmds=("-ex" "set use-coredump-filter off") + dump_all_cmds+=("-ex" "set dump-excluded-mappings on") + ;; + esac + ;; + o) + prefix=$OPTARG + ;; + *) + echo "usage: i386-pc-linux-gnu-gcore [-a] [-o prefix] pid1 [pid2...pidN]" + exit 2 + ;; + esac +done + +shift $((OPTIND-1)) + +if [ "$#" -eq "0" ] +then + echo "usage: i386-pc-linux-gnu-gcore [-a] [-o prefix] pid1 [pid2...pidN]" + exit 2 +fi + +# Attempt to fetch the absolute path to the gcore script that was +# called. +binary_path=`dirname "$0"` + +if test "x$binary_path" = x. ; then + # We got "." back as a path. This means the user executed + # the gcore script locally (i.e. ./gcore) or called the + # script via a shell interpreter (i.e. sh gcore). + binary_basename=`basename "$0"` + + # If the gcore script was called like "sh gcore" and the script + # lives in the current directory, "which" will not give us "gcore". + # So first we check if the script is in the current directory + # before using the output of "which". + if test -f "$binary_basename" ; then + # We have a local gcore script in ".". This covers the case of + # doing "./gcore" or "sh gcore". + binary_path="." + else + # The gcore script was not found in ".", which means the script + # was called from somewhere else in $PATH by "sh gcore". + # Extract the correct path now. + binary_path_from_env=`which "$0"` + binary_path=`dirname "$binary_path_from_env"` + fi +fi + +# Check if the GDB binary is in the expected path. If not, just +# quit with a message. +if [ ! -f "$binary_path/i386-pc-linux-gnu-gdb" ]; then + echo "gcore: GDB binary (${binary_path}/i386-pc-linux-gnu-gdb) not found" + exit 1 +fi + +# Initialise return code. +rc=0 + +# Loop through pids +for pid in "$@" +do + # `. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* Copy the first part of user declarations. */ +#line 52 "go-exp.y" /* yacc.c:339 */ + + +#include "defs.h" +#include +#include "expression.h" +#include "value.h" +#include "parser-defs.h" +#include "language.h" +#include "c-lang.h" +#include "go-lang.h" +#include "bfd.h" /* Required by objfiles.h. */ +#include "symfile.h" /* Required by objfiles.h. */ +#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ +#include "charset.h" +#include "block.h" + +#define parse_type(ps) builtin_type (parse_gdbarch (ps)) + +/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, + etc). */ +#define GDB_YY_REMAP_PREFIX go_ +#include "yy-remap.h" + +/* The state of the parser, used internally when we are parsing the + expression. */ + +static struct parser_state *pstate = NULL; + +int yyparse (void); + +static int yylex (void); + +static void yyerror (const char *); + + +#line 102 "go-exp.c.tmp" /* yacc.c:339 */ + +# ifndef YY_NULLPTRPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTRPTR nullptr +# else +# define YY_NULLPTRPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + INT = 258, + FLOAT = 259, + RAW_STRING = 260, + STRING = 261, + CHAR = 262, + NAME = 263, + TYPENAME = 264, + COMPLETE = 265, + NAME_OR_INT = 266, + TRUE_KEYWORD = 267, + FALSE_KEYWORD = 268, + STRUCT_KEYWORD = 269, + INTERFACE_KEYWORD = 270, + TYPE_KEYWORD = 271, + CHAN_KEYWORD = 272, + SIZEOF_KEYWORD = 273, + LEN_KEYWORD = 274, + CAP_KEYWORD = 275, + NEW_KEYWORD = 276, + IOTA_KEYWORD = 277, + NIL_KEYWORD = 278, + CONST_KEYWORD = 279, + DOTDOTDOT = 280, + ENTRY = 281, + ERROR = 282, + BYTE_KEYWORD = 283, + DOLLAR_VARIABLE = 284, + ASSIGN_MODIFY = 285, + ABOVE_COMMA = 286, + OROR = 287, + ANDAND = 288, + ANDNOT = 289, + EQUAL = 290, + NOTEQUAL = 291, + LEQ = 292, + GEQ = 293, + LSH = 294, + RSH = 295, + UNARY = 296, + INCREMENT = 297, + DECREMENT = 298, + LEFT_ARROW = 299 + }; +#endif +/* Tokens. */ +#define INT 258 +#define FLOAT 259 +#define RAW_STRING 260 +#define STRING 261 +#define CHAR 262 +#define NAME 263 +#define TYPENAME 264 +#define COMPLETE 265 +#define NAME_OR_INT 266 +#define TRUE_KEYWORD 267 +#define FALSE_KEYWORD 268 +#define STRUCT_KEYWORD 269 +#define INTERFACE_KEYWORD 270 +#define TYPE_KEYWORD 271 +#define CHAN_KEYWORD 272 +#define SIZEOF_KEYWORD 273 +#define LEN_KEYWORD 274 +#define CAP_KEYWORD 275 +#define NEW_KEYWORD 276 +#define IOTA_KEYWORD 277 +#define NIL_KEYWORD 278 +#define CONST_KEYWORD 279 +#define DOTDOTDOT 280 +#define ENTRY 281 +#define ERROR 282 +#define BYTE_KEYWORD 283 +#define DOLLAR_VARIABLE 284 +#define ASSIGN_MODIFY 285 +#define ABOVE_COMMA 286 +#define OROR 287 +#define ANDAND 288 +#define ANDNOT 289 +#define EQUAL 290 +#define NOTEQUAL 291 +#define LEQ 292 +#define GEQ 293 +#define LSH 294 +#define RSH 295 +#define UNARY 296 +#define INCREMENT 297 +#define DECREMENT 298 +#define LEFT_ARROW 299 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE +{ +#line 93 "go-exp.y" /* yacc.c:355 */ + + LONGEST lval; + struct { + LONGEST val; + struct type *type; + } typed_val_int; + struct { + gdb_byte val[16]; + struct type *type; + } typed_val_float; + struct stoken sval; + struct symtoken ssym; + struct type *tval; + struct typed_stoken tsval; + struct ttype tsym; + int voidval; + enum exp_opcode opcode; + struct internalvar *ivar; + struct stoken_vector svec; + + +#line 249 "go-exp.c.tmp" /* yacc.c:355 */ +}; + +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE yylval; + +int yyparse (void); + + + +/* Copy the second part of user declarations. */ +#line 114 "go-exp.y" /* yacc.c:358 */ + +/* YYSTYPE gets defined by %union. */ +static int parse_number (struct parser_state *, + const char *, int, int, YYSTYPE *); + +#line 271 "go-exp.c.tmp" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or xmalloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined xmalloc) \ + && (defined YYFREE || defined xfree))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC xmalloc +# if ! defined xmalloc && ! defined EXIT_SUCCESS +void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE xfree +# if ! defined xfree && ! defined EXIT_SUCCESS +void xfree (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 40 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 451 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 68 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 13 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 69 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 122 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 299 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 62, 2, 2, 2, 54, 39, 2, + 61, 64, 52, 50, 31, 51, 59, 53, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 67, 2, + 43, 33, 44, 34, 49, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 60, 2, 63, 38, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 65, 37, 66, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 32, 35, 36, 40, + 41, 42, 45, 46, 47, 48, 55, 56, 57, 58 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 191, 191, 192, 195, 202, 203, 208, 212, 216, + 220, 224, 228, 232, 236, 242, 248, 255, 265, 272, + 269, 280, 284, 287, 291, 295, 299, 305, 311, 317, + 321, 325, 329, 333, 337, 341, 345, 349, 353, 357, + 361, 365, 369, 373, 377, 381, 385, 389, 393, 397, + 401, 407, 414, 423, 436, 443, 446, 452, 467, 474, + 491, 509, 521, 527, 533, 549, 596, 598, 605, 618 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "INT", "FLOAT", "RAW_STRING", "STRING", + "CHAR", "NAME", "TYPENAME", "COMPLETE", "NAME_OR_INT", "TRUE_KEYWORD", + "FALSE_KEYWORD", "STRUCT_KEYWORD", "INTERFACE_KEYWORD", "TYPE_KEYWORD", + "CHAN_KEYWORD", "SIZEOF_KEYWORD", "LEN_KEYWORD", "CAP_KEYWORD", + "NEW_KEYWORD", "IOTA_KEYWORD", "NIL_KEYWORD", "CONST_KEYWORD", + "DOTDOTDOT", "ENTRY", "ERROR", "BYTE_KEYWORD", "DOLLAR_VARIABLE", + "ASSIGN_MODIFY", "','", "ABOVE_COMMA", "'='", "'?'", "OROR", "ANDAND", + "'|'", "'^'", "'&'", "ANDNOT", "EQUAL", "NOTEQUAL", "'<'", "'>'", "LEQ", + "GEQ", "LSH", "RSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY", + "INCREMENT", "DECREMENT", "LEFT_ARROW", "'.'", "'['", "'('", "'!'", + "']'", "')'", "'{'", "'}'", "':'", "$accept", "start", "type_exp", + "exp1", "exp", "$@1", "lcurly", "arglist", "rcurly", "string_exp", + "variable", "type", "name_not_typename", YY_NULLPTRPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 44, 286, 61, 63, 287, 288, 124, 94, 38, + 289, 290, 291, 60, 62, 292, 293, 294, 295, 64, + 43, 45, 42, 47, 37, 296, 297, 298, 299, 46, + 91, 40, 33, 93, 41, 123, 125, 58 +}; +# endif + +#define YYPACT_NINF -42 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-42))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 49, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -38, -42, -42, 49, 49, 49, 49, 49, 49, 49, + -42, 27, -42, 34, 187, 45, 16, -42, 11, 53, + 49, -35, 11, -35, -35, -35, -35, 11, 38, -35, + -42, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, -42, -42, -3, 49, -42, 45, + 9, 74, 49, -42, 123, 10, -42, 187, 187, 187, + 88, 241, 266, 290, 313, 334, 353, 353, 368, 368, + 368, 368, -41, -41, 380, 390, 390, -35, -35, -35, + -42, 72, 33, 49, -42, -42, 49, -42, 155, -42, + -42, 49, -42, -42, 187, 39, -35, -42, 215, 49, + -42, 187 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 51, 54, 59, 52, 69, 67, 53, 62, 63, + 0, 68, 56, 0, 0, 0, 0, 0, 0, 0, + 21, 0, 3, 2, 5, 0, 61, 55, 4, 65, + 0, 12, 0, 8, 10, 9, 7, 66, 0, 11, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 13, 14, 0, 0, 19, 0, + 0, 0, 0, 64, 0, 0, 28, 6, 50, 49, + 0, 47, 46, 45, 44, 43, 37, 38, 41, 42, + 39, 40, 35, 36, 29, 33, 34, 30, 31, 32, + 17, 15, 0, 22, 66, 25, 0, 60, 0, 58, + 57, 0, 16, 18, 23, 0, 26, 27, 48, 0, + 20, 24 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -42, -42, -42, -4, -13, -42, -42, -42, -42, -42, + -42, 51, 17 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 21, 22, 23, 24, 103, 25, 115, 106, 26, + 27, 32, 29 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint8 yytable[] = +{ + 31, 33, 34, 35, 36, 5, 39, 100, 58, 59, + 60, 61, 62, 63, 38, 64, 65, 74, 66, 67, + 68, 64, 65, 30, 66, 67, 68, 40, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 99, 28, 1, 2, 6, 3, 4, 5, 6, 108, + 7, 8, 9, 102, 41, 41, 71, 10, 37, 41, + 119, 72, 72, 11, 110, 105, 70, 11, 12, 73, + 107, 75, 112, 101, 0, 0, 0, 13, 14, 0, + 114, 0, 0, 116, 0, 0, 113, 69, 118, 15, + 16, 17, 76, 120, 0, 0, 121, 0, 0, 0, + 18, 19, 0, 0, 20, 0, 0, 0, 42, 0, + 104, 43, 44, 45, 46, 47, 48, 49, 0, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 0, 64, 65, 0, 66, 67, 68, + 0, 0, 0, 42, 0, 111, 43, 44, 45, 46, + 47, 48, 49, 0, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 0, 64, + 65, 0, 66, 67, 68, 42, 0, 109, 43, 44, + 45, 46, 47, 48, 49, 0, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 0, 64, 65, 0, 66, 67, 68, 42, 0, 117, + 43, 44, 45, 46, 47, 48, 49, 0, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 0, 64, 65, 0, 66, 67, 68, 44, + 45, 46, 47, 48, 49, 0, 50, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 0, 64, 65, 0, 66, 67, 68, 46, 47, 48, + 49, 0, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 0, 64, 65, 0, + 66, 67, 68, 47, 48, 49, 0, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 0, 64, 65, 0, 66, 67, 68, 48, 49, + 0, 50, 51, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 0, 64, 65, 0, 66, + 67, 68, 49, 0, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 0, 64, + 65, 0, 66, 67, 68, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, + 64, 65, 0, 66, 67, 68, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 0, 64, + 65, 0, 66, 67, 68, 56, 57, 58, 59, 60, + 61, 62, 63, 0, 64, 65, 0, 66, 67, 68, + 59, 60, 61, 62, 63, 0, 64, 65, 0, 66, + 67, 68, 61, 62, 63, 0, 64, 65, 0, 66, + 67, 68 +}; + +static const yytype_int8 yycheck[] = +{ + 13, 14, 15, 16, 17, 8, 19, 10, 49, 50, + 51, 52, 53, 54, 18, 56, 57, 30, 59, 60, + 61, 56, 57, 61, 59, 60, 61, 0, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 0, 3, 4, 9, 6, 7, 8, 9, 72, + 11, 12, 13, 67, 31, 31, 50, 18, 17, 31, + 31, 61, 61, 28, 64, 66, 25, 28, 29, 26, + 6, 30, 10, 66, -1, -1, -1, 38, 39, -1, + 103, -1, -1, 106, -1, -1, 63, 52, 111, 50, + 51, 52, 64, 64, -1, -1, 119, -1, -1, -1, + 61, 62, -1, -1, 65, -1, -1, -1, 30, -1, + 69, 33, 34, 35, 36, 37, 38, 39, -1, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, -1, 56, 57, -1, 59, 60, 61, + -1, -1, -1, 30, -1, 67, 33, 34, 35, 36, + 37, 38, 39, -1, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, -1, 56, + 57, -1, 59, 60, 61, 30, -1, 64, 33, 34, + 35, 36, 37, 38, 39, -1, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + -1, 56, 57, -1, 59, 60, 61, 30, -1, 64, + 33, 34, 35, 36, 37, 38, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, -1, 56, 57, -1, 59, 60, 61, 34, + 35, 36, 37, 38, 39, -1, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + -1, 56, 57, -1, 59, 60, 61, 36, 37, 38, + 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, -1, 56, 57, -1, + 59, 60, 61, 37, 38, 39, -1, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, -1, 56, 57, -1, 59, 60, 61, 38, 39, + -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, -1, 56, 57, -1, 59, + 60, 61, 39, -1, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, -1, 56, + 57, -1, 59, 60, 61, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, -1, + 56, 57, -1, 59, 60, 61, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, -1, 56, + 57, -1, 59, 60, 61, 47, 48, 49, 50, 51, + 52, 53, 54, -1, 56, 57, -1, 59, 60, 61, + 50, 51, 52, 53, 54, -1, 56, 57, -1, 59, + 60, 61, 52, 53, 54, -1, 56, 57, -1, 59, + 60, 61 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 4, 6, 7, 8, 9, 11, 12, 13, + 18, 28, 29, 38, 39, 50, 51, 52, 61, 62, + 65, 69, 70, 71, 72, 74, 77, 78, 79, 80, + 61, 72, 79, 72, 72, 72, 72, 79, 71, 72, + 0, 31, 30, 33, 34, 35, 36, 37, 38, 39, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 56, 57, 59, 60, 61, 52, + 79, 50, 61, 26, 72, 79, 64, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 10, 80, 71, 73, 79, 66, 76, 6, 72, 64, + 64, 67, 10, 63, 72, 75, 72, 64, 72, 31, + 64, 72 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 68, 69, 69, 70, 71, 71, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 73, + 72, 74, 75, 75, 75, 76, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 77, + 77, 72, 72, 72, 78, 78, 79, 79, 79, 80 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 1, 3, 2, 2, 2, + 2, 2, 2, 2, 2, 3, 4, 3, 4, 0, + 5, 1, 0, 1, 3, 1, 4, 4, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, + 3, 1, 1, 1, 1, 1, 1, 4, 4, 1, + 3, 1, 1, 1, 2, 1, 2, 1, 1, 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTRPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTRPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTRPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +{ + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to xreallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to xreallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: +#line 196 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_TYPE); + write_exp_elt_type (pstate, (yyvsp[0].tval)); + write_exp_elt_opcode (pstate, OP_TYPE); } +#line 1505 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 6: +#line 204 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_COMMA); } +#line 1511 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 7: +#line 209 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_IND); } +#line 1517 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 8: +#line 213 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ADDR); } +#line 1523 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 9: +#line 217 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_NEG); } +#line 1529 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 10: +#line 221 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PLUS); } +#line 1535 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 11: +#line 225 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); } +#line 1541 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 12: +#line 229 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_COMPLEMENT); } +#line 1547 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 13: +#line 233 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_POSTINCREMENT); } +#line 1553 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 14: +#line 237 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_POSTDECREMENT); } +#line 1559 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 15: +#line 243 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, (yyvsp[0].ssym).stoken); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 1567 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 16: +#line 249 "go-exp.y" /* yacc.c:1646 */ + { mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, (yyvsp[-1].ssym).stoken); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 1576 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 17: +#line 256 "go-exp.y" /* yacc.c:1646 */ + { struct stoken s; + mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + s.ptr = ""; + s.length = 0; + write_exp_string (pstate, s); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 1588 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 18: +#line 266 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); } +#line 1594 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 19: +#line 272 "go-exp.y" /* yacc.c:1646 */ + { start_arglist (); } +#line 1600 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 20: +#line 274 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FUNCALL); + write_exp_elt_longcst (pstate, + (LONGEST) end_arglist ()); + write_exp_elt_opcode (pstate, OP_FUNCALL); } +#line 1609 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 21: +#line 281 "go-exp.y" /* yacc.c:1646 */ + { start_arglist (); } +#line 1615 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 23: +#line 288 "go-exp.y" /* yacc.c:1646 */ + { arglist_len = 1; } +#line 1621 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 24: +#line 292 "go-exp.y" /* yacc.c:1646 */ + { arglist_len++; } +#line 1627 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 25: +#line 296 "go-exp.y" /* yacc.c:1646 */ + { (yyval.lval) = end_arglist () - 1; } +#line 1633 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 26: +#line 300 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_MEMVAL); + write_exp_elt_type (pstate, (yyvsp[-2].tval)); + write_exp_elt_opcode (pstate, UNOP_MEMVAL); } +#line 1641 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 27: +#line 306 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_CAST); + write_exp_elt_type (pstate, (yyvsp[-3].tval)); + write_exp_elt_opcode (pstate, UNOP_CAST); } +#line 1649 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 28: +#line 312 "go-exp.y" /* yacc.c:1646 */ + { } +#line 1655 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 29: +#line 318 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_REPEAT); } +#line 1661 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 30: +#line 322 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_MUL); } +#line 1667 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 31: +#line 326 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_DIV); } +#line 1673 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 32: +#line 330 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_REM); } +#line 1679 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 33: +#line 334 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ADD); } +#line 1685 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 34: +#line 338 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUB); } +#line 1691 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 35: +#line 342 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LSH); } +#line 1697 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 36: +#line 346 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_RSH); } +#line 1703 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 37: +#line 350 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_EQUAL); } +#line 1709 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 38: +#line 354 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); } +#line 1715 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 39: +#line 358 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LEQ); } +#line 1721 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 40: +#line 362 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GEQ); } +#line 1727 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 41: +#line 366 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LESS); } +#line 1733 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 42: +#line 370 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GTR); } +#line 1739 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 43: +#line 374 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); } +#line 1745 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 44: +#line 378 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); } +#line 1751 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 45: +#line 382 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); } +#line 1757 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 46: +#line 386 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); } +#line 1763 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 47: +#line 390 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); } +#line 1769 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 48: +#line 394 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, TERNOP_COND); } +#line 1775 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 49: +#line 398 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN); } +#line 1781 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 50: +#line 402 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); + write_exp_elt_opcode (pstate, (yyvsp[-1].opcode)); + write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); } +#line 1789 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 51: +#line 408 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, (yyvsp[0].typed_val_int).type); + write_exp_elt_longcst (pstate, (LONGEST)((yyvsp[0].typed_val_int).val)); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 1798 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 52: +#line 415 "go-exp.y" /* yacc.c:1646 */ + { + struct stoken_vector vec; + vec.len = 1; + vec.tokens = &(yyvsp[0].tsval); + write_exp_string_vector (pstate, (yyvsp[0].tsval).type, &vec); + } +#line 1809 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 53: +#line 424 "go-exp.y" /* yacc.c:1646 */ + { YYSTYPE val; + parse_number (pstate, (yyvsp[0].ssym).stoken.ptr, + (yyvsp[0].ssym).stoken.length, 0, &val); + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, val.typed_val_int.type); + write_exp_elt_longcst (pstate, (LONGEST) + val.typed_val_int.val); + write_exp_elt_opcode (pstate, OP_LONG); + } +#line 1823 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 54: +#line 437 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FLOAT); + write_exp_elt_type (pstate, (yyvsp[0].typed_val_float).type); + write_exp_elt_floatcst (pstate, (yyvsp[0].typed_val_float).val); + write_exp_elt_opcode (pstate, OP_FLOAT); } +#line 1832 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 56: +#line 447 "go-exp.y" /* yacc.c:1646 */ + { + write_dollar_variable (pstate, (yyvsp[0].sval)); + } +#line 1840 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 57: +#line 453 "go-exp.y" /* yacc.c:1646 */ + { + /* TODO(dje): Go objects in structs. */ + write_exp_elt_opcode (pstate, OP_LONG); + /* TODO(dje): What's the right type here? */ + write_exp_elt_type + (pstate, + parse_type (pstate)->builtin_unsigned_int); + (yyvsp[-1].tval) = check_typedef ((yyvsp[-1].tval)); + write_exp_elt_longcst (pstate, + (LONGEST) TYPE_LENGTH ((yyvsp[-1].tval))); + write_exp_elt_opcode (pstate, OP_LONG); + } +#line 1857 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 58: +#line 468 "go-exp.y" /* yacc.c:1646 */ + { + /* TODO(dje): Go objects in structs. */ + write_exp_elt_opcode (pstate, UNOP_SIZEOF); + } +#line 1866 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 59: +#line 475 "go-exp.y" /* yacc.c:1646 */ + { + /* We copy the string here, and not in the + lexer, to guarantee that we do not leak a + string. */ + /* Note that we NUL-terminate here, but just + for convenience. */ + struct typed_stoken *vec = XNEW (struct typed_stoken); + (yyval.svec).len = 1; + (yyval.svec).tokens = vec; + + vec->type = (yyvsp[0].tsval).type; + vec->length = (yyvsp[0].tsval).length; + vec->ptr = (char *) xmalloc ((yyvsp[0].tsval).length + 1); + memcpy (vec->ptr, (yyvsp[0].tsval).ptr, (yyvsp[0].tsval).length + 1); + } +#line 1886 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 60: +#line 492 "go-exp.y" /* yacc.c:1646 */ + { + /* Note that we NUL-terminate here, but just + for convenience. */ + char *p; + ++(yyval.svec).len; + (yyval.svec).tokens = XRESIZEVEC (struct typed_stoken, + (yyval.svec).tokens, (yyval.svec).len); + + p = (char *) xmalloc ((yyvsp[0].tsval).length + 1); + memcpy (p, (yyvsp[0].tsval).ptr, (yyvsp[0].tsval).length + 1); + + (yyval.svec).tokens[(yyval.svec).len - 1].type = (yyvsp[0].tsval).type; + (yyval.svec).tokens[(yyval.svec).len - 1].length = (yyvsp[0].tsval).length; + (yyval.svec).tokens[(yyval.svec).len - 1].ptr = p; + } +#line 1906 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 61: +#line 510 "go-exp.y" /* yacc.c:1646 */ + { + int i; + + write_exp_string_vector (pstate, 0 /*always utf8*/, + &(yyvsp[0].svec)); + for (i = 0; i < (yyvsp[0].svec).len; ++i) + xfree ((yyvsp[0].svec).tokens[i].ptr); + xfree ((yyvsp[0].svec).tokens); + } +#line 1920 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 62: +#line 522 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_BOOL); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval)); + write_exp_elt_opcode (pstate, OP_BOOL); } +#line 1928 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 63: +#line 528 "go-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_BOOL); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval)); + write_exp_elt_opcode (pstate, OP_BOOL); } +#line 1936 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 64: +#line 534 "go-exp.y" /* yacc.c:1646 */ + { struct symbol *sym = (yyvsp[-1].ssym).sym.symbol; + + if (sym == NULL + || !SYMBOL_IS_ARGUMENT (sym) + || !symbol_read_needs_frame (sym)) + error (_("@entry can be used only for function " + "parameters, not for \"%s\""), + copy_name ((yyvsp[-1].ssym).stoken)); + + write_exp_elt_opcode (pstate, OP_VAR_ENTRY_VALUE); + write_exp_elt_sym (pstate, sym); + write_exp_elt_opcode (pstate, OP_VAR_ENTRY_VALUE); + } +#line 1954 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 65: +#line 550 "go-exp.y" /* yacc.c:1646 */ + { struct block_symbol sym = (yyvsp[0].ssym).sym; + + if (sym.symbol) + { + if (symbol_read_needs_frame (sym.symbol)) + innermost_block.update (sym); + + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, sym.block); + write_exp_elt_sym (pstate, sym.symbol); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + } + else if ((yyvsp[0].ssym).is_a_field_of_this) + { + /* TODO(dje): Can we get here? + E.g., via a mix of c++ and go? */ + gdb_assert_not_reached ("go with `this' field"); + } + else + { + struct bound_minimal_symbol msymbol; + char *arg = copy_name ((yyvsp[0].ssym).stoken); + + msymbol = + lookup_bound_minimal_symbol (arg); + if (msymbol.minsym != NULL) + write_exp_msymbol (pstate, msymbol); + else if (!have_full_symbols () + && !have_partial_symbols ()) + error (_("No symbol table is loaded. " + "Use the \"file\" command.")); + else + error (_("No symbol \"%s\" in current context."), + copy_name ((yyvsp[0].ssym).stoken)); + } + } +#line 1995 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 66: +#line 597 "go-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_pointer_type ((yyvsp[0].tval)); } +#line 2001 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 67: +#line 599 "go-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = (yyvsp[0].tsym).type; } +#line 2007 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 68: +#line 606 "go-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = builtin_go_type (parse_gdbarch (pstate)) + ->builtin_uint8; } +#line 2014 "go-exp.c.tmp" /* yacc.c:1646 */ + break; + + +#line 2018 "go-exp.c.tmp" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 628 "go-exp.y" /* yacc.c:1906 */ + + +/* Take care of parsing a number (anything that starts with a digit). + Set yylval and return the token type; update lexptr. + LEN is the number of characters in it. */ + +/* FIXME: Needs some error checking for the float case. */ +/* FIXME(dje): IWBN to use c-exp.y's parse_number if we could. + That will require moving the guts into a function that we both call + as our YYSTYPE is different than c-exp.y's */ + +static int +parse_number (struct parser_state *par_state, + const char *p, int len, int parsed_float, YYSTYPE *putithere) +{ + /* FIXME: Shouldn't these be unsigned? We don't deal with negative values + here, and we do kind of silly things like cast to unsigned. */ + LONGEST n = 0; + LONGEST prevn = 0; + ULONGEST un; + + int i = 0; + int c; + int base = input_radix; + int unsigned_p = 0; + + /* Number of "L" suffixes encountered. */ + int long_p = 0; + + /* We have found a "L" or "U" suffix. */ + int found_suffix = 0; + + ULONGEST high_bit; + struct type *signed_type; + struct type *unsigned_type; + + if (parsed_float) + { + const struct builtin_go_type *builtin_go_types + = builtin_go_type (parse_gdbarch (par_state)); + + /* Handle suffixes: 'f' for float32, 'l' for long double. + FIXME: This appears to be an extension -- do we want this? */ + if (len >= 1 && tolower (p[len - 1]) == 'f') + { + putithere->typed_val_float.type + = builtin_go_types->builtin_float32; + len--; + } + else if (len >= 1 && tolower (p[len - 1]) == 'l') + { + putithere->typed_val_float.type + = parse_type (par_state)->builtin_long_double; + len--; + } + /* Default type for floating-point literals is float64. */ + else + { + putithere->typed_val_float.type + = builtin_go_types->builtin_float64; + } + + if (!parse_float (p, len, + putithere->typed_val_float.type, + putithere->typed_val_float.val)) + return ERROR; + return FLOAT; + } + + /* Handle base-switching prefixes 0x, 0t, 0d, 0. */ + if (p[0] == '0') + switch (p[1]) + { + case 'x': + case 'X': + if (len >= 3) + { + p += 2; + base = 16; + len -= 2; + } + break; + + case 'b': + case 'B': + if (len >= 3) + { + p += 2; + base = 2; + len -= 2; + } + break; + + case 't': + case 'T': + case 'd': + case 'D': + if (len >= 3) + { + p += 2; + base = 10; + len -= 2; + } + break; + + default: + base = 8; + break; + } + + while (len-- > 0) + { + c = *p++; + if (c >= 'A' && c <= 'Z') + c += 'a' - 'A'; + if (c != 'l' && c != 'u') + n *= base; + if (c >= '0' && c <= '9') + { + if (found_suffix) + return ERROR; + n += i = c - '0'; + } + else + { + if (base > 10 && c >= 'a' && c <= 'f') + { + if (found_suffix) + return ERROR; + n += i = c - 'a' + 10; + } + else if (c == 'l') + { + ++long_p; + found_suffix = 1; + } + else if (c == 'u') + { + unsigned_p = 1; + found_suffix = 1; + } + else + return ERROR; /* Char not a digit */ + } + if (i >= base) + return ERROR; /* Invalid digit in this base. */ + + /* Portably test for overflow (only works for nonzero values, so make + a second check for zero). FIXME: Can't we just make n and prevn + unsigned and avoid this? */ + if (c != 'l' && c != 'u' && (prevn >= n) && n != 0) + unsigned_p = 1; /* Try something unsigned. */ + + /* Portably test for unsigned overflow. + FIXME: This check is wrong; for example it doesn't find overflow + on 0x123456789 when LONGEST is 32 bits. */ + if (c != 'l' && c != 'u' && n != 0) + { + if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n)) + error (_("Numeric constant too large.")); + } + prevn = n; + } + + /* An integer constant is an int, a long, or a long long. An L + suffix forces it to be long; an LL suffix forces it to be long + long. If not forced to a larger size, it gets the first type of + the above that it fits in. To figure out whether it fits, we + shift it right and see whether anything remains. Note that we + can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one + operation, because many compilers will warn about such a shift + (which always produces a zero result). Sometimes gdbarch_int_bit + or gdbarch_long_bit will be that big, sometimes not. To deal with + the case where it is we just always shift the value more than + once, with fewer bits each time. */ + + un = (ULONGEST)n >> 2; + if (long_p == 0 + && (un >> (gdbarch_int_bit (parse_gdbarch (par_state)) - 2)) == 0) + { + high_bit + = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch (par_state)) - 1); + + /* A large decimal (not hex or octal) constant (between INT_MAX + and UINT_MAX) is a long or unsigned long, according to ANSI, + never an unsigned int, but this code treats it as unsigned + int. This probably should be fixed. GCC gives a warning on + such constants. */ + + unsigned_type = parse_type (par_state)->builtin_unsigned_int; + signed_type = parse_type (par_state)->builtin_int; + } + else if (long_p <= 1 + && (un >> (gdbarch_long_bit (parse_gdbarch (par_state)) - 2)) == 0) + { + high_bit + = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch (par_state)) - 1); + unsigned_type = parse_type (par_state)->builtin_unsigned_long; + signed_type = parse_type (par_state)->builtin_long; + } + else + { + int shift; + if (sizeof (ULONGEST) * HOST_CHAR_BIT + < gdbarch_long_long_bit (parse_gdbarch (par_state))) + /* A long long does not fit in a LONGEST. */ + shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1); + else + shift = (gdbarch_long_long_bit (parse_gdbarch (par_state)) - 1); + high_bit = (ULONGEST) 1 << shift; + unsigned_type = parse_type (par_state)->builtin_unsigned_long_long; + signed_type = parse_type (par_state)->builtin_long_long; + } + + putithere->typed_val_int.val = n; + + /* If the high bit of the worked out type is set then this number + has to be unsigned. */ + + if (unsigned_p || (n & high_bit)) + { + putithere->typed_val_int.type = unsigned_type; + } + else + { + putithere->typed_val_int.type = signed_type; + } + + return INT; +} + +/* Temporary obstack used for holding strings. */ +static struct obstack tempbuf; +static int tempbuf_init; + +/* Parse a string or character literal from TOKPTR. The string or + character may be wide or unicode. *OUTPTR is set to just after the + end of the literal in the input string. The resulting token is + stored in VALUE. This returns a token value, either STRING or + CHAR, depending on what was parsed. *HOST_CHARS is set to the + number of host characters in the literal. */ + +static int +parse_string_or_char (const char *tokptr, const char **outptr, + struct typed_stoken *value, int *host_chars) +{ + int quote; + + /* Build the gdb internal form of the input string in tempbuf. Note + that the buffer is null byte terminated *only* for the + convenience of debugging gdb itself and printing the buffer + contents when the buffer contains no embedded nulls. Gdb does + not depend upon the buffer being null byte terminated, it uses + the length string instead. This allows gdb to handle C strings + (as well as strings in other languages) with embedded null + bytes */ + + if (!tempbuf_init) + tempbuf_init = 1; + else + obstack_free (&tempbuf, NULL); + obstack_init (&tempbuf); + + /* Skip the quote. */ + quote = *tokptr; + ++tokptr; + + *host_chars = 0; + + while (*tokptr) + { + char c = *tokptr; + if (c == '\\') + { + ++tokptr; + *host_chars += c_parse_escape (&tokptr, &tempbuf); + } + else if (c == quote) + break; + else + { + obstack_1grow (&tempbuf, c); + ++tokptr; + /* FIXME: this does the wrong thing with multi-byte host + characters. We could use mbrlen here, but that would + make "set host-charset" a bit less useful. */ + ++*host_chars; + } + } + + if (*tokptr != quote) + { + if (quote == '"') + error (_("Unterminated string in expression.")); + else + error (_("Unmatched single quote.")); + } + ++tokptr; + + value->type = C_STRING | (quote == '\'' ? C_CHAR : 0); /*FIXME*/ + value->ptr = (char *) obstack_base (&tempbuf); + value->length = obstack_object_size (&tempbuf); + + *outptr = tokptr; + + return quote == '\'' ? CHAR : STRING; +} + +struct token +{ + const char *oper; + int token; + enum exp_opcode opcode; +}; + +static const struct token tokentab3[] = + { + {">>=", ASSIGN_MODIFY, BINOP_RSH}, + {"<<=", ASSIGN_MODIFY, BINOP_LSH}, + /*{"&^=", ASSIGN_MODIFY, BINOP_BITWISE_ANDNOT}, TODO */ + {"...", DOTDOTDOT, OP_NULL}, + }; + +static const struct token tokentab2[] = + { + {"+=", ASSIGN_MODIFY, BINOP_ADD}, + {"-=", ASSIGN_MODIFY, BINOP_SUB}, + {"*=", ASSIGN_MODIFY, BINOP_MUL}, + {"/=", ASSIGN_MODIFY, BINOP_DIV}, + {"%=", ASSIGN_MODIFY, BINOP_REM}, + {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR}, + {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND}, + {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR}, + {"++", INCREMENT, BINOP_END}, + {"--", DECREMENT, BINOP_END}, + /*{"->", RIGHT_ARROW, BINOP_END}, Doesn't exist in Go. */ + {"<-", LEFT_ARROW, BINOP_END}, + {"&&", ANDAND, BINOP_END}, + {"||", OROR, BINOP_END}, + {"<<", LSH, BINOP_END}, + {">>", RSH, BINOP_END}, + {"==", EQUAL, BINOP_END}, + {"!=", NOTEQUAL, BINOP_END}, + {"<=", LEQ, BINOP_END}, + {">=", GEQ, BINOP_END}, + /*{"&^", ANDNOT, BINOP_END}, TODO */ + }; + +/* Identifier-like tokens. */ +static const struct token ident_tokens[] = + { + {"true", TRUE_KEYWORD, OP_NULL}, + {"false", FALSE_KEYWORD, OP_NULL}, + {"nil", NIL_KEYWORD, OP_NULL}, + {"const", CONST_KEYWORD, OP_NULL}, + {"struct", STRUCT_KEYWORD, OP_NULL}, + {"type", TYPE_KEYWORD, OP_NULL}, + {"interface", INTERFACE_KEYWORD, OP_NULL}, + {"chan", CHAN_KEYWORD, OP_NULL}, + {"byte", BYTE_KEYWORD, OP_NULL}, /* An alias of uint8. */ + {"len", LEN_KEYWORD, OP_NULL}, + {"cap", CAP_KEYWORD, OP_NULL}, + {"new", NEW_KEYWORD, OP_NULL}, + {"iota", IOTA_KEYWORD, OP_NULL}, + }; + +/* This is set if a NAME token appeared at the very end of the input + string, with no whitespace separating the name from the EOF. This + is used only when parsing to do field name completion. */ +static int saw_name_at_eof; + +/* This is set if the previously-returned token was a structure + operator -- either '.' or ARROW. This is used only when parsing to + do field name completion. */ +static int last_was_structop; + +/* Read one token, getting characters through lexptr. */ + +static int +lex_one_token (struct parser_state *par_state) +{ + int c; + int namelen; + unsigned int i; + const char *tokstart; + int saw_structop = last_was_structop; + char *copy; + + last_was_structop = 0; + + retry: + + prev_lexptr = lexptr; + + tokstart = lexptr; + /* See if it is a special token of length 3. */ + for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++) + if (strncmp (tokstart, tokentab3[i].oper, 3) == 0) + { + lexptr += 3; + yylval.opcode = tokentab3[i].opcode; + return tokentab3[i].token; + } + + /* See if it is a special token of length 2. */ + for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++) + if (strncmp (tokstart, tokentab2[i].oper, 2) == 0) + { + lexptr += 2; + yylval.opcode = tokentab2[i].opcode; + /* NOTE: -> doesn't exist in Go, so we don't need to watch for + setting last_was_structop here. */ + return tokentab2[i].token; + } + + switch (c = *tokstart) + { + case 0: + if (saw_name_at_eof) + { + saw_name_at_eof = 0; + return COMPLETE; + } + else if (saw_structop) + return COMPLETE; + else + return 0; + + case ' ': + case '\t': + case '\n': + lexptr++; + goto retry; + + case '[': + case '(': + paren_depth++; + lexptr++; + return c; + + case ']': + case ')': + if (paren_depth == 0) + return 0; + paren_depth--; + lexptr++; + return c; + + case ',': + if (comma_terminates + && paren_depth == 0) + return 0; + lexptr++; + return c; + + case '.': + /* Might be a floating point number. */ + if (lexptr[1] < '0' || lexptr[1] > '9') + { + if (parse_completion) + last_was_structop = 1; + goto symbol; /* Nope, must be a symbol. */ + } + /* FALL THRU. */ + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + /* It's a number. */ + int got_dot = 0, got_e = 0, toktype; + const char *p = tokstart; + int hex = input_radix > 10; + + if (c == '0' && (p[1] == 'x' || p[1] == 'X')) + { + p += 2; + hex = 1; + } + + for (;; ++p) + { + /* This test includes !hex because 'e' is a valid hex digit + and thus does not indicate a floating point number when + the radix is hex. */ + if (!hex && !got_e && (*p == 'e' || *p == 'E')) + got_dot = got_e = 1; + /* This test does not include !hex, because a '.' always indicates + a decimal floating point number regardless of the radix. */ + else if (!got_dot && *p == '.') + got_dot = 1; + else if (got_e && (p[-1] == 'e' || p[-1] == 'E') + && (*p == '-' || *p == '+')) + /* This is the sign of the exponent, not the end of the + number. */ + continue; + /* We will take any letters or digits. parse_number will + complain if past the radix, or if L or U are not final. */ + else if ((*p < '0' || *p > '9') + && ((*p < 'a' || *p > 'z') + && (*p < 'A' || *p > 'Z'))) + break; + } + toktype = parse_number (par_state, tokstart, p - tokstart, + got_dot|got_e, &yylval); + if (toktype == ERROR) + { + char *err_copy = (char *) alloca (p - tokstart + 1); + + memcpy (err_copy, tokstart, p - tokstart); + err_copy[p - tokstart] = 0; + error (_("Invalid number \"%s\"."), err_copy); + } + lexptr = p; + return toktype; + } + + case '@': + { + const char *p = &tokstart[1]; + size_t len = strlen ("entry"); + + while (isspace (*p)) + p++; + if (strncmp (p, "entry", len) == 0 && !isalnum (p[len]) + && p[len] != '_') + { + lexptr = &p[len]; + return ENTRY; + } + } + /* FALLTHRU */ + case '+': + case '-': + case '*': + case '/': + case '%': + case '|': + case '&': + case '^': + case '~': + case '!': + case '<': + case '>': + case '?': + case ':': + case '=': + case '{': + case '}': + symbol: + lexptr++; + return c; + + case '\'': + case '"': + case '`': + { + int host_len; + int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval, + &host_len); + if (result == CHAR) + { + if (host_len == 0) + error (_("Empty character constant.")); + else if (host_len > 2 && c == '\'') + { + ++tokstart; + namelen = lexptr - tokstart - 1; + goto tryname; + } + else if (host_len > 1) + error (_("Invalid character constant.")); + } + return result; + } + } + + if (!(c == '_' || c == '$' + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) + /* We must have come across a bad character (e.g. ';'). */ + error (_("Invalid character '%c' in expression."), c); + + /* It's a name. See how long it is. */ + namelen = 0; + for (c = tokstart[namelen]; + (c == '_' || c == '$' || (c >= '0' && c <= '9') + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));) + { + c = tokstart[++namelen]; + } + + /* The token "if" terminates the expression and is NOT removed from + the input stream. It doesn't count if it appears in the + expansion of a macro. */ + if (namelen == 2 + && tokstart[0] == 'i' + && tokstart[1] == 'f') + { + return 0; + } + + /* For the same reason (breakpoint conditions), "thread N" + terminates the expression. "thread" could be an identifier, but + an identifier is never followed by a number without intervening + punctuation. + Handle abbreviations of these, similarly to + breakpoint.c:find_condition_and_thread. + TODO: Watch for "goroutine" here? */ + if (namelen >= 1 + && strncmp (tokstart, "thread", namelen) == 0 + && (tokstart[namelen] == ' ' || tokstart[namelen] == '\t')) + { + const char *p = tokstart + namelen + 1; + + while (*p == ' ' || *p == '\t') + p++; + if (*p >= '0' && *p <= '9') + return 0; + } + + lexptr += namelen; + + tryname: + + yylval.sval.ptr = tokstart; + yylval.sval.length = namelen; + + /* Catch specific keywords. */ + copy = copy_name (yylval.sval); + for (i = 0; i < sizeof (ident_tokens) / sizeof (ident_tokens[0]); i++) + if (strcmp (copy, ident_tokens[i].oper) == 0) + { + /* It is ok to always set this, even though we don't always + strictly need to. */ + yylval.opcode = ident_tokens[i].opcode; + return ident_tokens[i].token; + } + + if (*tokstart == '$') + return DOLLAR_VARIABLE; + + if (parse_completion && *lexptr == '\0') + saw_name_at_eof = 1; + return NAME; +} + +/* An object of this type is pushed on a FIFO by the "outer" lexer. */ +struct token_and_value +{ + int token; + YYSTYPE value; +}; + +/* A FIFO of tokens that have been read but not yet returned to the + parser. */ +static std::vector token_fifo; + +/* Non-zero if the lexer should return tokens from the FIFO. */ +static int popping; + +/* Temporary storage for yylex; this holds symbol names as they are + built up. */ +static auto_obstack name_obstack; + +/* Build "package.name" in name_obstack. + For convenience of the caller, the name is NUL-terminated, + but the NUL is not included in the recorded length. */ + +static struct stoken +build_packaged_name (const char *package, int package_len, + const char *name, int name_len) +{ + struct stoken result; + + name_obstack.clear (); + obstack_grow (&name_obstack, package, package_len); + obstack_grow_str (&name_obstack, "."); + obstack_grow (&name_obstack, name, name_len); + obstack_grow (&name_obstack, "", 1); + result.ptr = (char *) obstack_base (&name_obstack); + result.length = obstack_object_size (&name_obstack) - 1; + + return result; +} + +/* Return non-zero if NAME is a package name. + BLOCK is the scope in which to interpret NAME; this can be NULL + to mean the global scope. */ + +static int +package_name_p (const char *name, const struct block *block) +{ + struct symbol *sym; + struct field_of_this_result is_a_field_of_this; + + sym = lookup_symbol (name, block, STRUCT_DOMAIN, &is_a_field_of_this).symbol; + + if (sym + && SYMBOL_CLASS (sym) == LOC_TYPEDEF + && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_MODULE) + return 1; + + return 0; +} + +/* Classify a (potential) function in the "unsafe" package. + We fold these into "keywords" to keep things simple, at least until + something more complex is warranted. */ + +static int +classify_unsafe_function (struct stoken function_name) +{ + char *copy = copy_name (function_name); + + if (strcmp (copy, "Sizeof") == 0) + { + yylval.sval = function_name; + return SIZEOF_KEYWORD; + } + + error (_("Unknown function in `unsafe' package: %s"), copy); +} + +/* Classify token(s) "name1.name2" where name1 is known to be a package. + The contents of the token are in `yylval'. + Updates yylval and returns the new token type. + + The result is one of NAME, NAME_OR_INT, or TYPENAME. */ + +static int +classify_packaged_name (const struct block *block) +{ + char *copy; + struct block_symbol sym; + struct field_of_this_result is_a_field_of_this; + + copy = copy_name (yylval.sval); + + sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this); + + if (sym.symbol) + { + yylval.ssym.sym = sym; + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + } + + return NAME; +} + +/* Classify a NAME token. + The contents of the token are in `yylval'. + Updates yylval and returns the new token type. + BLOCK is the block in which lookups start; this can be NULL + to mean the global scope. + + The result is one of NAME, NAME_OR_INT, or TYPENAME. */ + +static int +classify_name (struct parser_state *par_state, const struct block *block) +{ + struct type *type; + struct block_symbol sym; + char *copy; + struct field_of_this_result is_a_field_of_this; + + copy = copy_name (yylval.sval); + + /* Try primitive types first so they win over bad/weird debug info. */ + type = language_lookup_primitive_type (parse_language (par_state), + parse_gdbarch (par_state), + copy); + if (type != NULL) + { + /* NOTE: We take advantage of the fact that yylval coming in was a + NAME, and that struct ttype is a compatible extension of struct + stoken, so yylval.tsym.stoken is already filled in. */ + yylval.tsym.type = type; + return TYPENAME; + } + + /* TODO: What about other types? */ + + sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this); + + if (sym.symbol) + { + yylval.ssym.sym = sym; + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + return NAME; + } + + /* If we didn't find a symbol, look again in the current package. + This is to, e.g., make "p global_var" work without having to specify + the package name. We intentionally only looks for objects in the + current package. */ + + { + char *current_package_name = go_block_package_name (block); + + if (current_package_name != NULL) + { + struct stoken sval = + build_packaged_name (current_package_name, + strlen (current_package_name), + copy, strlen (copy)); + + xfree (current_package_name); + sym = lookup_symbol (sval.ptr, block, VAR_DOMAIN, + &is_a_field_of_this); + if (sym.symbol) + { + yylval.ssym.stoken = sval; + yylval.ssym.sym = sym; + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + return NAME; + } + } + } + + /* Input names that aren't symbols but ARE valid hex numbers, when + the input radix permits them, can be names or numbers depending + on the parse. Note we support radixes > 16 here. */ + if ((copy[0] >= 'a' && copy[0] < 'a' + input_radix - 10) + || (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10)) + { + YYSTYPE newlval; /* Its value is ignored. */ + int hextype = parse_number (par_state, copy, yylval.sval.length, + 0, &newlval); + if (hextype == INT) + { + yylval.ssym.sym.symbol = NULL; + yylval.ssym.sym.block = NULL; + yylval.ssym.is_a_field_of_this = 0; + return NAME_OR_INT; + } + } + + yylval.ssym.sym.symbol = NULL; + yylval.ssym.sym.block = NULL; + yylval.ssym.is_a_field_of_this = 0; + return NAME; +} + +/* This is taken from c-exp.y mostly to get something working. + The basic structure has been kept because we may yet need some of it. */ + +static int +yylex (void) +{ + token_and_value current, next; + + if (popping && !token_fifo.empty ()) + { + token_and_value tv = token_fifo[0]; + token_fifo.erase (token_fifo.begin ()); + yylval = tv.value; + /* There's no need to fall through to handle package.name + as that can never happen here. In theory. */ + return tv.token; + } + popping = 0; + + current.token = lex_one_token (pstate); + + /* TODO: Need a way to force specifying name1 as a package. + .name1.name2 ? */ + + if (current.token != NAME) + return current.token; + + /* See if we have "name1 . name2". */ + + current.value = yylval; + next.token = lex_one_token (pstate); + next.value = yylval; + + if (next.token == '.') + { + token_and_value name2; + + name2.token = lex_one_token (pstate); + name2.value = yylval; + + if (name2.token == NAME) + { + /* Ok, we have "name1 . name2". */ + char *copy; + + copy = copy_name (current.value.sval); + + if (strcmp (copy, "unsafe") == 0) + { + popping = 1; + return classify_unsafe_function (name2.value.sval); + } + + if (package_name_p (copy, expression_context_block)) + { + popping = 1; + yylval.sval = build_packaged_name (current.value.sval.ptr, + current.value.sval.length, + name2.value.sval.ptr, + name2.value.sval.length); + return classify_packaged_name (expression_context_block); + } + } + + token_fifo.push_back (next); + token_fifo.push_back (name2); + } + else + token_fifo.push_back (next); + + /* If we arrive here we don't have a package-qualified name. */ + + popping = 1; + yylval = current.value; + return classify_name (pstate, expression_context_block); +} + +int +go_parse (struct parser_state *par_state) +{ + /* Setting up the parser state. */ + scoped_restore pstate_restore = make_scoped_restore (&pstate); + gdb_assert (par_state != NULL); + pstate = par_state; + + scoped_restore restore_yydebug = make_scoped_restore (&yydebug, + parser_debug); + + /* Initialize some state used by the lexer. */ + last_was_structop = 0; + saw_name_at_eof = 0; + + token_fifo.clear (); + popping = 0; + name_obstack.clear (); + + return yyparse (); +} + +static void +yyerror (const char *msg) +{ + if (prev_lexptr) + lexptr = prev_lexptr; + + error (_("A %s in expression, near `%s'."), msg, lexptr); +} diff --git a/gdb-8.3.1/gdb/m2-exp.c b/gdb-8.3.1/gdb/m2-exp.c new file mode 100644 index 0000000000000000000000000000000000000000..8d90b050dc48374410b2b3fe45ba0e5774d9688b --- /dev/null +++ b/gdb-8.3.1/gdb/m2-exp.c @@ -0,0 +1,2849 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* Copy the first part of user declarations. */ +#line 38 "m2-exp.y" /* yacc.c:339 */ + + +#include "defs.h" +#include "expression.h" +#include "language.h" +#include "value.h" +#include "parser-defs.h" +#include "m2-lang.h" +#include "bfd.h" /* Required by objfiles.h. */ +#include "symfile.h" /* Required by objfiles.h. */ +#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ +#include "block.h" + +#define parse_type(ps) builtin_type (parse_gdbarch (ps)) +#define parse_m2_type(ps) builtin_m2_type (parse_gdbarch (ps)) + +/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, + etc). */ +#define GDB_YY_REMAP_PREFIX m2_ +#include "yy-remap.h" + +/* The state of the parser, used internally when we are parsing the + expression. */ + +static struct parser_state *pstate = NULL; + +int yyparse (void); + +static int yylex (void); + +static void yyerror (const char *); + +static int parse_number (int); + +/* The sign of the number being parsed. */ +static int number_sign = 1; + + +#line 105 "m2-exp.c.tmp" /* yacc.c:339 */ + +# ifndef YY_NULLPTRPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTRPTR nullptr +# else +# define YY_NULLPTRPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + INT = 258, + HEX = 259, + ERROR = 260, + UINT = 261, + M2_TRUE = 262, + M2_FALSE = 263, + CHAR = 264, + FLOAT = 265, + STRING = 266, + NAME = 267, + BLOCKNAME = 268, + IDENT = 269, + VARNAME = 270, + TYPENAME = 271, + SIZE = 272, + CAP = 273, + ORD = 274, + HIGH = 275, + ABS = 276, + MIN_FUNC = 277, + MAX_FUNC = 278, + FLOAT_FUNC = 279, + VAL = 280, + CHR = 281, + ODD = 282, + TRUNC = 283, + TSIZE = 284, + INC = 285, + DEC = 286, + INCL = 287, + EXCL = 288, + COLONCOLON = 289, + DOLLAR_VARIABLE = 290, + ABOVE_COMMA = 291, + ASSIGN = 292, + LEQ = 293, + GEQ = 294, + NOTEQUAL = 295, + IN = 296, + OROR = 297, + LOGICAL_AND = 298, + DIV = 299, + MOD = 300, + UNARY = 301, + DOT = 302, + NOT = 303, + QID = 304 + }; +#endif +/* Tokens. */ +#define INT 258 +#define HEX 259 +#define ERROR 260 +#define UINT 261 +#define M2_TRUE 262 +#define M2_FALSE 263 +#define CHAR 264 +#define FLOAT 265 +#define STRING 266 +#define NAME 267 +#define BLOCKNAME 268 +#define IDENT 269 +#define VARNAME 270 +#define TYPENAME 271 +#define SIZE 272 +#define CAP 273 +#define ORD 274 +#define HIGH 275 +#define ABS 276 +#define MIN_FUNC 277 +#define MAX_FUNC 278 +#define FLOAT_FUNC 279 +#define VAL 280 +#define CHR 281 +#define ODD 282 +#define TRUNC 283 +#define TSIZE 284 +#define INC 285 +#define DEC 286 +#define INCL 287 +#define EXCL 288 +#define COLONCOLON 289 +#define DOLLAR_VARIABLE 290 +#define ABOVE_COMMA 291 +#define ASSIGN 292 +#define LEQ 293 +#define GEQ 294 +#define NOTEQUAL 295 +#define IN 296 +#define OROR 297 +#define LOGICAL_AND 298 +#define DIV 299 +#define MOD 300 +#define UNARY 301 +#define DOT 302 +#define NOT 303 +#define QID 304 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE +{ +#line 82 "m2-exp.y" /* yacc.c:355 */ + + LONGEST lval; + ULONGEST ulval; + gdb_byte val[16]; + struct symbol *sym; + struct type *tval; + struct stoken sval; + int voidval; + const struct block *bval; + enum exp_opcode opcode; + struct internalvar *ivar; + + struct type **tvec; + int *ivec; + + +#line 257 "m2-exp.c.tmp" /* yacc.c:355 */ +}; + +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE yylval; + +int yyparse (void); + + + +/* Copy the second part of user declarations. */ + +#line 274 "m2-exp.c.tmp" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or xmalloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined xmalloc) \ + && (defined YYFREE || defined xfree))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC xmalloc +# if ! defined xmalloc && ! defined EXIT_SUCCESS +void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE xfree +# if ! defined xfree && ! defined EXIT_SUCCESS +void xfree (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 69 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 912 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 69 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 15 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 82 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 187 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 304 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 45, 2, 2, 49, 2, + 61, 65, 53, 51, 36, 52, 2, 54, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 39, 43, 40, 2, 50, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 60, 2, 68, 58, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 66, 2, 67, 63, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 37, 38, 41, 42, 44, 46, 47, 48, 55, + 56, 57, 59, 62, 64 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 151, 151, 152, 155, 164, 169, 168, 175, 179, + 183, 184, 187, 191, 195, 199, 203, 209, 215, 219, + 225, 229, 233, 237, 241, 246, 250, 257, 261, 268, + 274, 277, 281, 285, 289, 291, 301, 297, 309, 316, + 313, 324, 327, 331, 336, 341, 346, 352, 358, 366, + 370, 374, 378, 382, 386, 390, 394, 398, 400, 404, + 408, 412, 416, 420, 424, 428, 435, 441, 447, 455, + 466, 476, 485, 488, 497, 504, 508, 518, 530, 538, + 542, 560, 598 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "INT", "HEX", "ERROR", "UINT", "M2_TRUE", + "M2_FALSE", "CHAR", "FLOAT", "STRING", "NAME", "BLOCKNAME", "IDENT", + "VARNAME", "TYPENAME", "SIZE", "CAP", "ORD", "HIGH", "ABS", "MIN_FUNC", + "MAX_FUNC", "FLOAT_FUNC", "VAL", "CHR", "ODD", "TRUNC", "TSIZE", "INC", + "DEC", "INCL", "EXCL", "COLONCOLON", "DOLLAR_VARIABLE", "','", + "ABOVE_COMMA", "ASSIGN", "'<'", "'>'", "LEQ", "GEQ", "'='", "NOTEQUAL", + "'#'", "IN", "OROR", "LOGICAL_AND", "'&'", "'@'", "'+'", "'-'", "'*'", + "'/'", "DIV", "MOD", "UNARY", "'^'", "DOT", "'['", "'('", "NOT", "'~'", + "QID", "')'", "'{'", "'}'", "']'", "$accept", "start", "type_exp", "exp", + "$@1", "not_exp", "set", "$@2", "$@3", "arglist", "non_empty_arglist", + "block", "fblock", "variable", "type", YY_NULLPTRPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 44, 291, 292, 60, + 62, 293, 294, 61, 295, 35, 296, 297, 298, 38, + 64, 43, 45, 42, 47, 299, 300, 301, 94, 302, + 91, 40, 303, 126, 304, 41, 123, 125, 93 +}; +# endif + +#define YYPACT_NINF -90 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-90))) + +#define YYTABLE_NINF -76 + +#define yytable_value_is_error(Yytable_value) \ + (!!((Yytable_value) == (-76))) + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 163, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, 224, -35, -28, -22, -18, 2, 8, 17, 28, + 30, 31, 32, 34, 35, 36, 38, 39, -90, 163, + -90, 163, -90, -90, 163, 27, -90, 807, 163, -90, + -6, -4, -90, -21, 163, 7, -21, 163, 163, 163, + 163, 85, 85, 163, 85, 163, 163, 163, 163, 163, + 163, 163, 163, 7, 163, 309, 807, -32, -42, -90, + 163, 163, 163, 163, 163, 163, 163, 163, -15, 163, + 163, 163, 163, 163, 163, 163, 163, 163, -90, 90, + 163, -90, 7, -5, 163, 163, -24, 337, 365, 393, + 421, -19, 42, 449, 67, 477, 505, 533, 561, 253, + 281, 757, 783, 7, -90, 163, -90, 163, 831, -38, + -38, -38, -38, -38, -38, -38, 163, -90, 43, 149, + 210, 842, 851, 851, 7, 7, 7, 7, -90, 83, + 163, 163, -90, -90, 589, -31, -90, -90, -90, -90, + -90, -90, -90, -90, 163, -90, -90, -90, -90, 163, + -90, 163, -90, 163, 163, 807, 7, -90, 807, -34, + -33, -90, -90, 617, 645, 673, 701, 729, 163, -90, + -90, -90, -90, -90, -90, -90, 807 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 68, 69, 66, 67, 70, 71, 74, 81, 76, + 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, + 6, 0, 10, 11, 41, 0, 3, 2, 0, 30, + 0, 78, 72, 4, 0, 24, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 8, 0, 0, 42, 0, 0, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, + 0, 39, 9, 0, 0, 41, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7, 48, 0, 34, 0, 65, 61, + 62, 59, 60, 56, 57, 58, 41, 31, 0, 64, + 63, 49, 54, 55, 50, 51, 52, 53, 29, 0, + 0, 41, 80, 77, 0, 0, 73, 12, 13, 15, + 14, 16, 17, 18, 0, 20, 21, 22, 23, 0, + 25, 0, 27, 0, 0, 43, 46, 38, 44, 0, + 0, 47, 35, 0, 0, 0, 0, 0, 0, 37, + 40, 19, 26, 28, 32, 33, 45 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -90, -90, -90, 0, -90, -90, 26, -90, -90, -89, + -90, -90, -90, -90, 54 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 35, 36, 66, 64, 38, 39, 140, 141, 67, + 169, 40, 41, 42, 46 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int16 yytable[] = +{ + 37, 10, 178, 115, 115, 115, 145, 142, 143, 79, + 80, 45, 81, 82, 83, 84, 85, 86, 87, 94, + 88, 89, 90, 91, 95, 117, 47, 69, 93, 63, + -75, 65, 180, 48, 179, 116, 172, 94, 92, 49, + 94, 146, 95, 50, 65, 95, 151, 97, 98, 99, + 100, 126, 170, 103, 43, 105, 106, 107, 108, 109, + 110, 111, 112, 51, 113, 88, 89, 90, 91, 52, + 118, 119, 120, 121, 122, 123, 124, 125, 53, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 68, 54, + 139, 55, 56, 57, 144, 58, 59, 60, 96, 61, + 62, 10, 138, 154, 127, 101, 102, 152, 104, 95, + 0, 0, 0, 0, 0, 165, 0, 166, 0, 0, + 0, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 128, 81, 82, 83, 84, 85, 86, 87, + 168, 88, 89, 90, 91, 0, 0, 0, 0, 0, + 0, 167, 0, 0, 173, 0, 0, 0, 0, 174, + 0, 175, 0, 176, 177, 0, 1, 0, 0, 2, + 3, 4, 5, 6, 7, 8, 9, 0, 186, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 80, 28, 81, + 82, 83, 84, 85, 86, 87, 0, 88, 89, 90, + 91, 0, 0, 0, 29, 30, 0, 0, 0, 0, + 0, 0, 0, 0, 31, 32, 33, 1, 0, 34, + 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 0, 28, + 81, 82, 83, 84, 85, 86, 87, 0, 88, 89, + 90, 91, 0, 0, 0, 29, 30, 0, 0, 0, + 0, 0, 0, 0, 0, 44, 32, 33, 0, 159, + 34, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 0, 81, 82, 83, 84, 85, 86, 87, + 0, 88, 89, 90, 91, 0, 0, 161, 160, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 0, 81, 82, 83, 84, 85, 86, 87, 0, 88, + 89, 90, 91, 0, 0, 0, 162, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 0, 81, + 82, 83, 84, 85, 86, 87, 0, 88, 89, 90, + 91, 0, 0, 0, 114, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 0, 81, 82, 83, + 84, 85, 86, 87, 0, 88, 89, 90, 91, 0, + 0, 0, 147, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 0, 81, 82, 83, 84, 85, + 86, 87, 0, 88, 89, 90, 91, 0, 0, 0, + 148, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 0, 81, 82, 83, 84, 85, 86, 87, + 0, 88, 89, 90, 91, 0, 0, 0, 149, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 0, 81, 82, 83, 84, 85, 86, 87, 0, 88, + 89, 90, 91, 0, 0, 0, 150, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 0, 81, + 82, 83, 84, 85, 86, 87, 0, 88, 89, 90, + 91, 0, 0, 0, 153, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 0, 81, 82, 83, + 84, 85, 86, 87, 0, 88, 89, 90, 91, 0, + 0, 0, 155, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 0, 81, 82, 83, 84, 85, + 86, 87, 0, 88, 89, 90, 91, 0, 0, 0, + 156, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 0, 81, 82, 83, 84, 85, 86, 87, + 0, 88, 89, 90, 91, 0, 0, 0, 157, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 0, 81, 82, 83, 84, 85, 86, 87, 0, 88, + 89, 90, 91, 0, 0, 0, 158, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 0, 81, + 82, 83, 84, 85, 86, 87, 0, 88, 89, 90, + 91, 0, 0, 0, 171, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 0, 81, 82, 83, + 84, 85, 86, 87, 0, 88, 89, 90, 91, 0, + 0, 0, 181, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 0, 81, 82, 83, 84, 85, + 86, 87, 0, 88, 89, 90, 91, 0, 0, 0, + 182, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 0, 81, 82, 83, 84, 85, 86, 87, + 0, 88, 89, 90, 91, 0, 0, 0, 183, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 0, 81, 82, 83, 84, 85, 86, 87, 0, 88, + 89, 90, 91, 0, 0, 0, 184, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 0, 81, + 82, 83, 84, 85, 86, 87, 0, 88, 89, 90, + 91, 0, 0, 163, 185, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 0, 81, 82, 83, + 84, 85, 86, 87, 0, 88, 89, 90, 91, 164, + 0, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 0, 81, 82, 83, 84, 85, 86, 87, + 0, 88, 89, 90, 91, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 0, 81, 82, 83, + 84, 85, 86, 87, 0, 88, 89, 90, 91, -76, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 0, 81, 82, 83, 84, 85, 86, 87, 0, 88, + 89, 90, 91, 82, 83, 84, 85, 86, 87, 0, + 88, 89, 90, 91, 84, 85, 86, 87, 0, 88, + 89, 90, 91 +}; + +static const yytype_int16 yycheck[] = +{ + 0, 16, 36, 36, 36, 36, 95, 12, 13, 47, + 48, 11, 50, 51, 52, 53, 54, 55, 56, 61, + 58, 59, 60, 61, 66, 67, 61, 0, 34, 29, + 34, 31, 65, 61, 68, 67, 67, 61, 38, 61, + 61, 65, 66, 61, 44, 66, 65, 47, 48, 49, + 50, 66, 141, 53, 0, 55, 56, 57, 58, 59, + 60, 61, 62, 61, 64, 58, 59, 60, 61, 61, + 70, 71, 72, 73, 74, 75, 76, 77, 61, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 34, 61, + 90, 61, 61, 61, 94, 61, 61, 61, 44, 61, + 61, 16, 12, 36, 78, 51, 52, 65, 54, 66, + -1, -1, -1, -1, -1, 115, -1, 117, -1, -1, + -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 78, 50, 51, 52, 53, 54, 55, 56, + 140, 58, 59, 60, 61, -1, -1, -1, -1, -1, + -1, 68, -1, -1, 154, -1, -1, -1, -1, 159, + -1, 161, -1, 163, 164, -1, 3, -1, -1, 6, + 7, 8, 9, 10, 11, 12, 13, -1, 178, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 48, 35, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + 61, -1, -1, -1, 51, 52, -1, -1, -1, -1, + -1, -1, -1, -1, 61, 62, 63, 3, -1, 66, + 6, 7, 8, 9, 10, 11, 12, 13, -1, -1, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, -1, 35, + 50, 51, 52, 53, 54, 55, 56, -1, 58, 59, + 60, 61, -1, -1, -1, 51, 52, -1, -1, -1, + -1, -1, -1, -1, -1, 61, 62, 63, -1, 36, + 66, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, -1, 50, 51, 52, 53, 54, 55, 56, + -1, 58, 59, 60, 61, -1, -1, 36, 65, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + -1, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, 61, -1, -1, -1, 65, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, -1, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + 61, -1, -1, -1, 65, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, -1, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, 61, -1, + -1, -1, 65, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, -1, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, 61, -1, -1, -1, + 65, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, -1, 50, 51, 52, 53, 54, 55, 56, + -1, 58, 59, 60, 61, -1, -1, -1, 65, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + -1, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, 61, -1, -1, -1, 65, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, -1, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + 61, -1, -1, -1, 65, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, -1, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, 61, -1, + -1, -1, 65, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, -1, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, 61, -1, -1, -1, + 65, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, -1, 50, 51, 52, 53, 54, 55, 56, + -1, 58, 59, 60, 61, -1, -1, -1, 65, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + -1, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, 61, -1, -1, -1, 65, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, -1, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + 61, -1, -1, -1, 65, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, -1, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, 61, -1, + -1, -1, 65, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, -1, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, 61, -1, -1, -1, + 65, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, -1, 50, 51, 52, 53, 54, 55, 56, + -1, 58, 59, 60, 61, -1, -1, -1, 65, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + -1, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, 61, -1, -1, -1, 65, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, -1, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + 61, -1, -1, 36, 65, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, -1, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, 61, 36, + -1, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, -1, 50, 51, 52, 53, 54, 55, 56, + -1, 58, 59, 60, 61, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, -1, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, 61, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + -1, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, 61, 51, 52, 53, 54, 55, 56, -1, + 58, 59, 60, 61, 53, 54, 55, 56, -1, 58, + 59, 60, 61 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 6, 7, 8, 9, 10, 11, 12, 13, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 35, 51, + 52, 61, 62, 63, 66, 70, 71, 72, 74, 75, + 80, 81, 82, 83, 61, 72, 83, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 72, 73, 72, 72, 78, 83, 0, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 50, 51, 52, 53, 54, 55, 56, 58, 59, + 60, 61, 72, 34, 61, 66, 83, 72, 72, 72, + 72, 83, 83, 72, 83, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 65, 36, 67, 67, 72, 72, + 72, 72, 72, 72, 72, 72, 66, 75, 83, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 12, 72, + 76, 77, 12, 13, 72, 78, 65, 65, 65, 65, + 65, 65, 65, 65, 36, 65, 65, 65, 65, 36, + 65, 36, 65, 36, 36, 72, 72, 68, 72, 79, + 78, 65, 67, 72, 72, 72, 72, 72, 36, 68, + 65, 65, 65, 65, 65, 65, 72 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 69, 70, 70, 71, 72, 73, 72, 72, 72, + 74, 74, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 75, 75, 76, 72, 72, 77, + 72, 78, 78, 78, 79, 79, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 80, 81, 81, 82, 82, + 82, 82, 83 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 2, 0, 3, 2, 2, + 1, 1, 4, 4, 4, 4, 4, 4, 4, 6, + 4, 4, 4, 4, 2, 4, 6, 4, 6, 3, + 1, 3, 6, 6, 3, 4, 0, 5, 4, 0, + 5, 0, 1, 3, 1, 3, 4, 4, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, + 1, 1, 1, 4, 1, 1, 1, 3, 1, 1, + 3, 1, 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTRPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTRPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTRPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +{ + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to xreallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to xreallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: +#line 156 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_TYPE); + write_exp_elt_type (pstate, (yyvsp[0].tval)); + write_exp_elt_opcode (pstate, OP_TYPE); + } +#line 1624 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 5: +#line 165 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_IND); } +#line 1630 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 6: +#line 169 "m2-exp.y" /* yacc.c:1646 */ + { number_sign = -1; } +#line 1636 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 7: +#line 171 "m2-exp.y" /* yacc.c:1646 */ + { number_sign = 1; + write_exp_elt_opcode (pstate, UNOP_NEG); } +#line 1643 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 8: +#line 176 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PLUS); } +#line 1649 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 9: +#line 180 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); } +#line 1655 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 12: +#line 188 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_CAP); } +#line 1661 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 13: +#line 192 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ORD); } +#line 1667 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 14: +#line 196 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ABS); } +#line 1673 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 15: +#line 200 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_HIGH); } +#line 1679 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 16: +#line 204 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_MIN); + write_exp_elt_type (pstate, (yyvsp[-1].tval)); + write_exp_elt_opcode (pstate, UNOP_MIN); } +#line 1687 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 17: +#line 210 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_MAX); + write_exp_elt_type (pstate, (yyvsp[-1].tval)); + write_exp_elt_opcode (pstate, UNOP_MAX); } +#line 1695 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 18: +#line 216 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_FLOAT); } +#line 1701 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 19: +#line 220 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_VAL); + write_exp_elt_type (pstate, (yyvsp[-3].tval)); + write_exp_elt_opcode (pstate, BINOP_VAL); } +#line 1709 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 20: +#line 226 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_CHR); } +#line 1715 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 21: +#line 230 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ODD); } +#line 1721 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 22: +#line 234 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_TRUNC); } +#line 1727 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 23: +#line 238 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_SIZEOF); } +#line 1733 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 24: +#line 242 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_SIZEOF); } +#line 1739 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 25: +#line 247 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PREINCREMENT); } +#line 1745 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 26: +#line 251 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); + write_exp_elt_opcode (pstate, BINOP_ADD); + write_exp_elt_opcode (pstate, + BINOP_ASSIGN_MODIFY); } +#line 1754 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 27: +#line 258 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PREDECREMENT);} +#line 1760 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 28: +#line 262 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); + write_exp_elt_opcode (pstate, BINOP_SUB); + write_exp_elt_opcode (pstate, + BINOP_ASSIGN_MODIFY); } +#line 1769 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 29: +#line 269 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 1777 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 31: +#line 278 "m2-exp.y" /* yacc.c:1646 */ + { error (_("Sets are not implemented."));} +#line 1783 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 32: +#line 282 "m2-exp.y" /* yacc.c:1646 */ + { error (_("Sets are not implemented."));} +#line 1789 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 33: +#line 286 "m2-exp.y" /* yacc.c:1646 */ + { error (_("Sets are not implemented."));} +#line 1795 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 34: +#line 290 "m2-exp.y" /* yacc.c:1646 */ + { error (_("Sets are not implemented."));} +#line 1801 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 35: +#line 292 "m2-exp.y" /* yacc.c:1646 */ + { error (_("Sets are not implemented."));} +#line 1807 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 36: +#line 301 "m2-exp.y" /* yacc.c:1646 */ + { start_arglist(); } +#line 1813 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 37: +#line 303 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); + write_exp_elt_longcst (pstate, + (LONGEST) end_arglist()); + write_exp_elt_opcode (pstate, MULTI_SUBSCRIPT); } +#line 1822 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 38: +#line 310 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); } +#line 1828 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 39: +#line 316 "m2-exp.y" /* yacc.c:1646 */ + { start_arglist (); } +#line 1834 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 40: +#line 318 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FUNCALL); + write_exp_elt_longcst (pstate, + (LONGEST) end_arglist ()); + write_exp_elt_opcode (pstate, OP_FUNCALL); } +#line 1843 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 42: +#line 328 "m2-exp.y" /* yacc.c:1646 */ + { arglist_len = 1; } +#line 1849 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 43: +#line 332 "m2-exp.y" /* yacc.c:1646 */ + { arglist_len++; } +#line 1855 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 44: +#line 337 "m2-exp.y" /* yacc.c:1646 */ + { arglist_len = 1; } +#line 1861 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 45: +#line 342 "m2-exp.y" /* yacc.c:1646 */ + { arglist_len++; } +#line 1867 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 46: +#line 347 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_MEMVAL); + write_exp_elt_type (pstate, (yyvsp[-2].tval)); + write_exp_elt_opcode (pstate, UNOP_MEMVAL); } +#line 1875 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 47: +#line 353 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_CAST); + write_exp_elt_type (pstate, (yyvsp[-3].tval)); + write_exp_elt_opcode (pstate, UNOP_CAST); } +#line 1883 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 48: +#line 359 "m2-exp.y" /* yacc.c:1646 */ + { } +#line 1889 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 49: +#line 367 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_REPEAT); } +#line 1895 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 50: +#line 371 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_MUL); } +#line 1901 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 51: +#line 375 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_DIV); } +#line 1907 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 52: +#line 379 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_INTDIV); } +#line 1913 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 53: +#line 383 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_REM); } +#line 1919 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 54: +#line 387 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ADD); } +#line 1925 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 55: +#line 391 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUB); } +#line 1931 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 56: +#line 395 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_EQUAL); } +#line 1937 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 57: +#line 399 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); } +#line 1943 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 58: +#line 401 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); } +#line 1949 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 59: +#line 405 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LEQ); } +#line 1955 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 60: +#line 409 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GEQ); } +#line 1961 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 61: +#line 413 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LESS); } +#line 1967 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 62: +#line 417 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GTR); } +#line 1973 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 63: +#line 421 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); } +#line 1979 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 64: +#line 425 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); } +#line 1985 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 65: +#line 429 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN); } +#line 1991 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 66: +#line 436 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_BOOL); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].ulval)); + write_exp_elt_opcode (pstate, OP_BOOL); } +#line 1999 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 67: +#line 442 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_BOOL); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].ulval)); + write_exp_elt_opcode (pstate, OP_BOOL); } +#line 2007 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 68: +#line 448 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_m2_type (pstate)->builtin_int); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval)); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 2017 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 69: +#line 456 "m2-exp.y" /* yacc.c:1646 */ + { + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_m2_type (pstate) + ->builtin_card); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].ulval)); + write_exp_elt_opcode (pstate, OP_LONG); + } +#line 2030 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 70: +#line 467 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_m2_type (pstate) + ->builtin_char); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].ulval)); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 2041 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 71: +#line 477 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FLOAT); + write_exp_elt_type (pstate, + parse_m2_type (pstate) + ->builtin_real); + write_exp_elt_floatcst (pstate, (yyvsp[0].val)); + write_exp_elt_opcode (pstate, OP_FLOAT); } +#line 2052 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 73: +#line 489 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_type (pstate)->builtin_int); + write_exp_elt_longcst (pstate, + (LONGEST) TYPE_LENGTH ((yyvsp[-1].tval))); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 2063 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 74: +#line 498 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_M2_STRING); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, OP_M2_STRING); } +#line 2071 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 75: +#line 505 "m2-exp.y" /* yacc.c:1646 */ + { (yyval.bval) = SYMBOL_BLOCK_VALUE((yyvsp[0].sym)); } +#line 2077 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 76: +#line 509 "m2-exp.y" /* yacc.c:1646 */ + { struct symbol *sym + = lookup_symbol (copy_name ((yyvsp[0].sval)), + expression_context_block, + VAR_DOMAIN, 0).symbol; + (yyval.sym) = sym;} +#line 2087 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 77: +#line 519 "m2-exp.y" /* yacc.c:1646 */ + { struct symbol *tem + = lookup_symbol (copy_name ((yyvsp[0].sval)), (yyvsp[-2].bval), + VAR_DOMAIN, 0).symbol; + if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) + error (_("No function \"%s\" in specified context."), + copy_name ((yyvsp[0].sval))); + (yyval.sym) = tem; + } +#line 2100 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 78: +#line 531 "m2-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, NULL); + write_exp_elt_sym (pstate, (yyvsp[0].sym)); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); } +#line 2109 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 80: +#line 543 "m2-exp.y" /* yacc.c:1646 */ + { struct block_symbol sym + = lookup_symbol (copy_name ((yyvsp[0].sval)), (yyvsp[-2].bval), + VAR_DOMAIN, 0); + + if (sym.symbol == 0) + error (_("No symbol \"%s\" in specified context."), + copy_name ((yyvsp[0].sval))); + if (symbol_read_needs_frame (sym.symbol)) + innermost_block.update (sym); + + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, sym.block); + write_exp_elt_sym (pstate, sym.symbol); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); } +#line 2128 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 81: +#line 561 "m2-exp.y" /* yacc.c:1646 */ + { struct block_symbol sym; + struct field_of_this_result is_a_field_of_this; + + sym = lookup_symbol (copy_name ((yyvsp[0].sval)), + expression_context_block, + VAR_DOMAIN, + &is_a_field_of_this); + + if (sym.symbol) + { + if (symbol_read_needs_frame (sym.symbol)) + innermost_block.update (sym); + + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, sym.block); + write_exp_elt_sym (pstate, sym.symbol); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + } + else + { + struct bound_minimal_symbol msymbol; + char *arg = copy_name ((yyvsp[0].sval)); + + msymbol = + lookup_bound_minimal_symbol (arg); + if (msymbol.minsym != NULL) + write_exp_msymbol (pstate, msymbol); + else if (!have_full_symbols () && !have_partial_symbols ()) + error (_("No symbol table is loaded. Use the \"symbol-file\" command.")); + else + error (_("No symbol \"%s\" in current context."), + copy_name ((yyvsp[0].sval))); + } + } +#line 2167 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 82: +#line 599 "m2-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_typename (parse_language (pstate), + parse_gdbarch (pstate), + copy_name ((yyvsp[0].sval)), + expression_context_block, 0); } +#line 2176 "m2-exp.c.tmp" /* yacc.c:1646 */ + break; + + +#line 2180 "m2-exp.c.tmp" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 606 "m2-exp.y" /* yacc.c:1906 */ + + +/* Take care of parsing a number (anything that starts with a digit). + Set yylval and return the token type; update lexptr. + LEN is the number of characters in it. */ + +/*** Needs some error checking for the float case ***/ + +static int +parse_number (int olen) +{ + const char *p = lexptr; + LONGEST n = 0; + LONGEST prevn = 0; + int c,i,ischar=0; + int base = input_radix; + int len = olen; + int unsigned_p = number_sign == 1 ? 1 : 0; + + if(p[len-1] == 'H') + { + base = 16; + len--; + } + else if(p[len-1] == 'C' || p[len-1] == 'B') + { + base = 8; + ischar = p[len-1] == 'C'; + len--; + } + + /* Scan the number */ + for (c = 0; c < len; c++) + { + if (p[c] == '.' && base == 10) + { + /* It's a float since it contains a point. */ + if (!parse_float (p, len, + parse_m2_type (pstate)->builtin_real, + yylval.val)) + return ERROR; + + lexptr += len; + return FLOAT; + } + if (p[c] == '.' && base != 10) + error (_("Floating point numbers must be base 10.")); + if (base == 10 && (p[c] < '0' || p[c] > '9')) + error (_("Invalid digit \'%c\' in number."),p[c]); + } + + while (len-- > 0) + { + c = *p++; + n *= base; + if( base == 8 && (c == '8' || c == '9')) + error (_("Invalid digit \'%c\' in octal number."),c); + if (c >= '0' && c <= '9') + i = c - '0'; + else + { + if (base == 16 && c >= 'A' && c <= 'F') + i = c - 'A' + 10; + else + return ERROR; + } + n+=i; + if(i >= base) + return ERROR; + if(!unsigned_p && number_sign == 1 && (prevn >= n)) + unsigned_p=1; /* Try something unsigned */ + /* Don't do the range check if n==i and i==0, since that special + case will give an overflow error. */ + if(RANGE_CHECK && n!=i && i) + { + if((unsigned_p && (unsigned)prevn >= (unsigned)n) || + ((!unsigned_p && number_sign==-1) && -prevn <= -n)) + range_error (_("Overflow on numeric constant.")); + } + prevn=n; + } + + lexptr = p; + if(*p == 'B' || *p == 'C' || *p == 'H') + lexptr++; /* Advance past B,C or H */ + + if (ischar) + { + yylval.ulval = n; + return CHAR; + } + else if ( unsigned_p && number_sign == 1) + { + yylval.ulval = n; + return UINT; + } + else if((unsigned_p && (n<0))) { + range_error (_("Overflow on numeric constant -- number too large.")); + /* But, this can return if range_check == range_warn. */ + } + yylval.lval = n; + return INT; +} + + +/* Some tokens */ + +static struct +{ + char name[2]; + int token; +} tokentab2[] = +{ + { {'<', '>'}, NOTEQUAL }, + { {':', '='}, ASSIGN }, + { {'<', '='}, LEQ }, + { {'>', '='}, GEQ }, + { {':', ':'}, COLONCOLON }, + +}; + +/* Some specific keywords */ + +struct keyword { + char keyw[10]; + int token; +}; + +static struct keyword keytab[] = +{ + {"OR" , OROR }, + {"IN", IN },/* Note space after IN */ + {"AND", LOGICAL_AND}, + {"ABS", ABS }, + {"CHR", CHR }, + {"DEC", DEC }, + {"NOT", NOT }, + {"DIV", DIV }, + {"INC", INC }, + {"MAX", MAX_FUNC }, + {"MIN", MIN_FUNC }, + {"MOD", MOD }, + {"ODD", ODD }, + {"CAP", CAP }, + {"ORD", ORD }, + {"VAL", VAL }, + {"EXCL", EXCL }, + {"HIGH", HIGH }, + {"INCL", INCL }, + {"SIZE", SIZE }, + {"FLOAT", FLOAT_FUNC }, + {"TRUNC", TRUNC }, + {"TSIZE", SIZE }, +}; + + +/* Read one token, getting characters through lexptr. */ + +/* This is where we will check to make sure that the language and the + operators used are compatible */ + +static int +yylex (void) +{ + int c; + int namelen; + int i; + const char *tokstart; + char quote; + + retry: + + prev_lexptr = lexptr; + + tokstart = lexptr; + + + /* See if it is a special token of length 2 */ + for( i = 0 ; i < (int) (sizeof tokentab2 / sizeof tokentab2[0]) ; i++) + if (strncmp (tokentab2[i].name, tokstart, 2) == 0) + { + lexptr += 2; + return tokentab2[i].token; + } + + switch (c = *tokstart) + { + case 0: + return 0; + + case ' ': + case '\t': + case '\n': + lexptr++; + goto retry; + + case '(': + paren_depth++; + lexptr++; + return c; + + case ')': + if (paren_depth == 0) + return 0; + paren_depth--; + lexptr++; + return c; + + case ',': + if (comma_terminates && paren_depth == 0) + return 0; + lexptr++; + return c; + + case '.': + /* Might be a floating point number. */ + if (lexptr[1] >= '0' && lexptr[1] <= '9') + break; /* Falls into number code. */ + else + { + lexptr++; + return DOT; + } + +/* These are character tokens that appear as-is in the YACC grammar */ + case '+': + case '-': + case '*': + case '/': + case '^': + case '<': + case '>': + case '[': + case ']': + case '=': + case '{': + case '}': + case '#': + case '@': + case '~': + case '&': + lexptr++; + return c; + + case '\'' : + case '"': + quote = c; + for (namelen = 1; (c = tokstart[namelen]) != quote && c != '\0'; namelen++) + if (c == '\\') + { + c = tokstart[++namelen]; + if (c >= '0' && c <= '9') + { + c = tokstart[++namelen]; + if (c >= '0' && c <= '9') + c = tokstart[++namelen]; + } + } + if(c != quote) + error (_("Unterminated string or character constant.")); + yylval.sval.ptr = tokstart + 1; + yylval.sval.length = namelen - 1; + lexptr += namelen + 1; + + if(namelen == 2) /* Single character */ + { + yylval.ulval = tokstart[1]; + return CHAR; + } + else + return STRING; + } + + /* Is it a number? */ + /* Note: We have already dealt with the case of the token '.'. + See case '.' above. */ + if ((c >= '0' && c <= '9')) + { + /* It's a number. */ + int got_dot = 0, got_e = 0; + const char *p = tokstart; + int toktype; + + for (++p ;; ++p) + { + if (!got_e && (*p == 'e' || *p == 'E')) + got_dot = got_e = 1; + else if (!got_dot && *p == '.') + got_dot = 1; + else if (got_e && (p[-1] == 'e' || p[-1] == 'E') + && (*p == '-' || *p == '+')) + /* This is the sign of the exponent, not the end of the + number. */ + continue; + else if ((*p < '0' || *p > '9') && + (*p < 'A' || *p > 'F') && + (*p != 'H')) /* Modula-2 hexadecimal number */ + break; + } + toktype = parse_number (p - tokstart); + if (toktype == ERROR) + { + char *err_copy = (char *) alloca (p - tokstart + 1); + + memcpy (err_copy, tokstart, p - tokstart); + err_copy[p - tokstart] = 0; + error (_("Invalid number \"%s\"."), err_copy); + } + lexptr = p; + return toktype; + } + + if (!(c == '_' || c == '$' + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) + /* We must have come across a bad character (e.g. ';'). */ + error (_("Invalid character '%c' in expression."), c); + + /* It's a name. See how long it is. */ + namelen = 0; + for (c = tokstart[namelen]; + (c == '_' || c == '$' || (c >= '0' && c <= '9') + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); + c = tokstart[++namelen]) + ; + + /* The token "if" terminates the expression and is NOT + removed from the input stream. */ + if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') + { + return 0; + } + + lexptr += namelen; + + /* Lookup special keywords */ + for(i = 0 ; i < (int) (sizeof(keytab) / sizeof(keytab[0])) ; i++) + if (namelen == strlen (keytab[i].keyw) + && strncmp (tokstart, keytab[i].keyw, namelen) == 0) + return keytab[i].token; + + yylval.sval.ptr = tokstart; + yylval.sval.length = namelen; + + if (*tokstart == '$') + { + write_dollar_variable (pstate, yylval.sval); + return DOLLAR_VARIABLE; + } + + /* Use token-type BLOCKNAME for symbols that happen to be defined as + functions. If this is not so, then ... + Use token-type TYPENAME for symbols that happen to be defined + currently as names of types; NAME for other symbols. + The caller is not constrained to care about the distinction. */ + { + + + char *tmp = copy_name (yylval.sval); + struct symbol *sym; + + if (lookup_symtab (tmp)) + return BLOCKNAME; + sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0).symbol; + if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK) + return BLOCKNAME; + if (lookup_typename (parse_language (pstate), parse_gdbarch (pstate), + copy_name (yylval.sval), + expression_context_block, 1)) + return TYPENAME; + + if(sym) + { + switch(SYMBOL_CLASS (sym)) + { + case LOC_STATIC: + case LOC_REGISTER: + case LOC_ARG: + case LOC_REF_ARG: + case LOC_REGPARM_ADDR: + case LOC_LOCAL: + case LOC_CONST: + case LOC_CONST_BYTES: + case LOC_OPTIMIZED_OUT: + case LOC_COMPUTED: + return NAME; + + case LOC_TYPEDEF: + return TYPENAME; + + case LOC_BLOCK: + return BLOCKNAME; + + case LOC_UNDEF: + error (_("internal: Undefined class in m2lex()")); + + case LOC_LABEL: + case LOC_UNRESOLVED: + error (_("internal: Unforseen case in m2lex()")); + + default: + error (_("unhandled token in m2lex()")); + break; + } + } + else + { + /* Built-in BOOLEAN type. This is sort of a hack. */ + if (strncmp (tokstart, "TRUE", 4) == 0) + { + yylval.ulval = 1; + return M2_TRUE; + } + else if (strncmp (tokstart, "FALSE", 5) == 0) + { + yylval.ulval = 0; + return M2_FALSE; + } + } + + /* Must be another type of name... */ + return NAME; + } +} + +int +m2_parse (struct parser_state *par_state) +{ + /* Setting up the parser state. */ + scoped_restore pstate_restore = make_scoped_restore (&pstate); + gdb_assert (par_state != NULL); + pstate = par_state; + + return yyparse (); +} + +static void +yyerror (const char *msg) +{ + if (prev_lexptr) + lexptr = prev_lexptr; + + error (_("A %s in expression, near `%s'."), msg, lexptr); +} diff --git a/gdb-8.3.1/gdb/p-exp.c b/gdb-8.3.1/gdb/p-exp.c new file mode 100644 index 0000000000000000000000000000000000000000..f16261748989f15f89feca3fe2f3bf189833bd86 --- /dev/null +++ b/gdb-8.3.1/gdb/p-exp.c @@ -0,0 +1,3357 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* Copy the first part of user declarations. */ +#line 44 "p-exp.y" /* yacc.c:339 */ + + +#include "defs.h" +#include +#include "expression.h" +#include "value.h" +#include "parser-defs.h" +#include "language.h" +#include "p-lang.h" +#include "bfd.h" /* Required by objfiles.h. */ +#include "symfile.h" /* Required by objfiles.h. */ +#include "objfiles.h" /* For have_full_symbols and have_partial_symbols. */ +#include "block.h" +#include "completer.h" + +#define parse_type(ps) builtin_type (parse_gdbarch (ps)) + +/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, + etc). */ +#define GDB_YY_REMAP_PREFIX pascal_ +#include "yy-remap.h" + +/* The state of the parser, used internally when we are parsing the + expression. */ + +static struct parser_state *pstate = NULL; + +int yyparse (void); + +static int yylex (void); + +static void yyerror (const char *); + +static char *uptok (const char *, int); + +#line 102 "p-exp.c.tmp" /* yacc.c:339 */ + +# ifndef YY_NULLPTRPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTRPTR nullptr +# else +# define YY_NULLPTRPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + INT = 258, + FLOAT = 259, + STRING = 260, + FIELDNAME = 261, + COMPLETE = 262, + NAME = 263, + TYPENAME = 264, + NAME_OR_INT = 265, + STRUCT = 266, + CLASS = 267, + SIZEOF = 268, + COLONCOLON = 269, + ERROR = 270, + DOLLAR_VARIABLE = 271, + THIS = 272, + TRUEKEYWORD = 273, + FALSEKEYWORD = 274, + ABOVE_COMMA = 275, + ASSIGN = 276, + NOT = 277, + OR = 278, + XOR = 279, + ANDAND = 280, + NOTEQUAL = 281, + LEQ = 282, + GEQ = 283, + LSH = 284, + RSH = 285, + DIV = 286, + MOD = 287, + UNARY = 288, + INCREMENT = 289, + DECREMENT = 290, + ARROW = 291, + BLOCKNAME = 292 + }; +#endif +/* Tokens. */ +#define INT 258 +#define FLOAT 259 +#define STRING 260 +#define FIELDNAME 261 +#define COMPLETE 262 +#define NAME 263 +#define TYPENAME 264 +#define NAME_OR_INT 265 +#define STRUCT 266 +#define CLASS 267 +#define SIZEOF 268 +#define COLONCOLON 269 +#define ERROR 270 +#define DOLLAR_VARIABLE 271 +#define THIS 272 +#define TRUEKEYWORD 273 +#define FALSEKEYWORD 274 +#define ABOVE_COMMA 275 +#define ASSIGN 276 +#define NOT 277 +#define OR 278 +#define XOR 279 +#define ANDAND 280 +#define NOTEQUAL 281 +#define LEQ 282 +#define GEQ 283 +#define LSH 284 +#define RSH 285 +#define DIV 286 +#define MOD 287 +#define UNARY 288 +#define INCREMENT 289 +#define DECREMENT 290 +#define ARROW 291 +#define BLOCKNAME 292 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE +{ +#line 85 "p-exp.y" /* yacc.c:355 */ + + LONGEST lval; + struct { + LONGEST val; + struct type *type; + } typed_val_int; + struct { + gdb_byte val[16]; + struct type *type; + } typed_val_float; + struct symbol *sym; + struct type *tval; + struct stoken sval; + struct ttype tsym; + struct symtoken ssym; + int voidval; + const struct block *bval; + enum exp_opcode opcode; + struct internalvar *ivar; + + struct type **tvec; + int *ivec; + + +#line 238 "p-exp.c.tmp" /* yacc.c:355 */ +}; + +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE yylval; + +int yyparse (void); + + + +/* Copy the second part of user declarations. */ +#line 109 "p-exp.y" /* yacc.c:358 */ + +/* YYSTYPE gets defined by %union */ +static int parse_number (struct parser_state *, + const char *, int, int, YYSTYPE *); + +static struct type *current_type; +static struct internalvar *intvar; +static int leftdiv_is_integer; +static void push_current_type (void); +static void pop_current_type (void); +static int search_field; + +#line 267 "p-exp.c.tmp" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or xmalloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined xmalloc) \ + && (defined YYFREE || defined xfree))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC xmalloc +# if ! defined xmalloc && ! defined EXIT_SUCCESS +void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE xfree +# if ! defined xfree && ! defined EXIT_SUCCESS +void xfree (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 377 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 53 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 20 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 77 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 126 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 292 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 48, 51, 40, 38, 20, 39, 46, 41, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 29, 27, 30, 2, 37, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 47, 2, 52, 49, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, + 26, 28, 31, 32, 33, 34, 35, 36, 42, 43, + 44, 45, 50 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 191, 191, 191, 200, 201, 204, 211, 212, 217, + 223, 229, 233, 237, 241, 246, 250, 268, 284, 290, + 302, 300, 333, 330, 346, 347, 349, 353, 368, 374, + 378, 378, 401, 405, 409, 413, 417, 421, 425, 431, + 437, 443, 449, 455, 461, 465, 469, 473, 477, 484, + 491, 499, 513, 521, 524, 539, 550, 554, 586, 614, + 632, 643, 658, 674, 675, 706, 767, 778, 782, 784, + 786, 789, 797, 798, 799, 800, 803, 804 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "FIELDNAME", + "COMPLETE", "NAME", "TYPENAME", "NAME_OR_INT", "STRUCT", "CLASS", + "SIZEOF", "COLONCOLON", "ERROR", "DOLLAR_VARIABLE", "THIS", + "TRUEKEYWORD", "FALSEKEYWORD", "','", "ABOVE_COMMA", "ASSIGN", "NOT", + "OR", "XOR", "ANDAND", "'='", "NOTEQUAL", "'<'", "'>'", "LEQ", "GEQ", + "LSH", "RSH", "DIV", "MOD", "'@'", "'+'", "'-'", "'*'", "'/'", "UNARY", + "INCREMENT", "DECREMENT", "ARROW", "'.'", "'['", "'('", "'^'", + "BLOCKNAME", "')'", "']'", "$accept", "start", "$@1", "normal_start", + "type_exp", "exp1", "exp", "field_exp", "$@2", "$@3", "arglist", "$@4", + "block", "variable", "qualified_name", "ptype", "type", "typebase", + "name", "name_not_typename", YY_NULLPTRPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 44, 275, 276, 277, 278, 279, 280, 61, 281, 60, + 62, 282, 283, 284, 285, 286, 287, 64, 43, 45, + 42, 47, 288, 289, 290, 291, 46, 91, 40, 94, + 292, 41, 93 +}; +# endif + +#define YYPACT_NINF -44 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-44))) + +#define YYTABLE_NINF -61 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + -44, 20, 90, -44, -44, -44, -44, -44, -44, -44, + 7, 7, -41, 7, -44, -44, -44, -44, 90, 90, + 90, -39, -24, 90, 10, 13, -44, -44, 8, 231, + 4, 21, -44, -44, -44, -14, 41, -44, -44, -44, + -44, -44, -44, -44, 90, -44, 35, -14, 35, 35, + 90, 90, 5, -44, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, -44, -44, -44, -44, -44, -44, -44, 23, + 7, 90, 7, 119, -43, 147, 175, -44, 231, 231, + 256, 280, 303, 324, 324, 31, 31, 31, 31, 76, + 76, 76, 76, 328, 328, 35, 90, 90, 90, -44, + 44, 203, -44, -44, -44, -44, -44, 35, 9, 231, + 11, -44, -44, 90, -44, 231 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 0, 0, 1, 50, 52, 57, 76, 69, 51, + 0, 0, 0, 0, 54, 58, 48, 49, 0, 0, + 0, 0, 0, 0, 0, 77, 3, 5, 4, 7, + 0, 0, 53, 63, 67, 6, 66, 65, 72, 74, + 75, 73, 70, 71, 0, 64, 12, 0, 10, 11, + 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 30, 15, 20, 22, 9, 16, 19, 17, + 0, 0, 0, 0, 0, 0, 0, 28, 8, 47, + 46, 45, 44, 38, 39, 42, 43, 40, 41, 36, + 37, 32, 33, 34, 35, 29, 0, 0, 24, 18, + 61, 0, 62, 56, 55, 13, 14, 31, 0, 25, + 0, 27, 21, 0, 23, 26 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -44, -44, -44, -44, -44, -20, -18, -44, -44, -44, + -44, -44, -44, -44, -44, -44, 16, 50, -7, -44 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 1, 2, 26, 27, 28, 29, 30, 107, 108, + 120, 106, 31, 32, 33, 34, 47, 36, 42, 37 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int8 yytable[] = +{ + 46, 48, 49, 52, 43, 81, 45, 44, 114, 50, + 77, 78, 38, 39, 40, 38, 39, 40, 35, 8, + 3, 10, 11, 79, 51, 54, 83, -59, 54, 54, + 109, 123, 85, 86, 81, 80, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 41, 82, 87, 41, -60, 24, + 84, 122, 124, 111, 65, 66, 67, 68, 0, 69, + 70, 71, 72, 110, 53, 112, 0, 73, 74, 75, + 76, 73, 74, 75, 76, 0, 0, 118, 117, 0, + 119, 0, 0, 4, 5, 6, 0, 0, 7, 8, + 9, 10, 11, 12, 13, 125, 14, 15, 16, 17, + 0, 0, 0, 18, 69, 70, 71, 72, 0, 0, + 0, 0, 73, 74, 75, 76, 0, 19, 0, 20, + 0, 0, 0, 21, 22, 0, 0, 0, 23, 24, + 25, 55, 0, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 0, 69, 70, 71, + 72, 0, 0, 0, 0, 73, 74, 75, 76, 55, + 113, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 0, 69, 70, 71, 72, 0, + 0, 0, 0, 73, 74, 75, 76, 55, 115, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 0, 69, 70, 71, 72, 0, 0, 0, + 0, 73, 74, 75, 76, 55, 116, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 0, 69, 70, 71, 72, 0, 0, 0, 0, 73, + 74, 75, 76, 55, 121, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 0, 69, + 70, 71, 72, 0, 0, 0, 0, 73, 74, 75, + 76, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 0, 69, 70, 71, 72, 0, 0, + 0, 0, 73, 74, 75, 76, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 0, 69, 70, + 71, 72, 0, 0, 0, 0, 73, 74, 75, 76, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 0, 69, 70, 71, 72, 0, 0, 0, 0, 73, + 74, 75, 76, 61, 62, 63, 64, 65, 66, 67, + 68, 0, 69, 70, 71, 72, 0, 0, 71, 72, + 73, 74, 75, 76, 73, 74, 75, 76 +}; + +static const yytype_int8 yycheck[] = +{ + 18, 19, 20, 23, 11, 48, 13, 48, 51, 48, + 6, 7, 8, 9, 10, 8, 9, 10, 2, 9, + 0, 11, 12, 30, 48, 20, 44, 14, 20, 20, + 7, 20, 50, 51, 48, 14, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 50, 14, 51, 50, 14, 49, + 44, 52, 51, 81, 33, 34, 35, 36, -1, 38, + 39, 40, 41, 80, 24, 82, -1, 46, 47, 48, + 49, 46, 47, 48, 49, -1, -1, 107, 106, -1, + 108, -1, -1, 3, 4, 5, -1, -1, 8, 9, + 10, 11, 12, 13, 14, 123, 16, 17, 18, 19, + -1, -1, -1, 23, 38, 39, 40, 41, -1, -1, + -1, -1, 46, 47, 48, 49, -1, 37, -1, 39, + -1, -1, -1, 43, 44, -1, -1, -1, 48, 49, + 50, 22, -1, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, -1, 38, 39, 40, + 41, -1, -1, -1, -1, 46, 47, 48, 49, 22, + 51, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, -1, 38, 39, 40, 41, -1, + -1, -1, -1, 46, 47, 48, 49, 22, 51, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, -1, 38, 39, 40, 41, -1, -1, -1, + -1, 46, 47, 48, 49, 22, 51, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + -1, 38, 39, 40, 41, -1, -1, -1, -1, 46, + 47, 48, 49, 22, 51, 24, 25, 26, 27, 28, + 29, 30, 31, 32, 33, 34, 35, 36, -1, 38, + 39, 40, 41, -1, -1, -1, -1, 46, 47, 48, + 49, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, -1, 38, 39, 40, 41, -1, -1, + -1, -1, 46, 47, 48, 49, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, -1, 38, 39, + 40, 41, -1, -1, -1, -1, 46, 47, 48, 49, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + -1, 38, 39, 40, 41, -1, -1, -1, -1, 46, + 47, 48, 49, 29, 30, 31, 32, 33, 34, 35, + 36, -1, 38, 39, 40, 41, -1, -1, 40, 41, + 46, 47, 48, 49, 46, 47, 48, 49 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 54, 55, 0, 3, 4, 5, 8, 9, 10, + 11, 12, 13, 14, 16, 17, 18, 19, 23, 37, + 39, 43, 44, 48, 49, 50, 56, 57, 58, 59, + 60, 65, 66, 67, 68, 69, 70, 72, 8, 9, + 10, 50, 71, 71, 48, 71, 59, 69, 59, 59, + 48, 48, 58, 70, 20, 22, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, + 39, 40, 41, 46, 47, 48, 49, 6, 7, 71, + 14, 48, 14, 59, 69, 59, 59, 51, 59, 59, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 64, 61, 62, 7, + 71, 59, 71, 51, 51, 51, 51, 59, 58, 59, + 63, 51, 52, 20, 51, 59 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 53, 55, 54, 56, 56, 57, 58, 58, 59, + 59, 59, 59, 59, 59, 60, 59, 59, 59, 59, + 61, 59, 62, 59, 63, 63, 63, 59, 59, 59, + 64, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 65, + 65, 66, 67, 66, 66, 66, 68, 69, 70, 70, + 70, 70, 71, 71, 71, 71, 72, 72 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 2, 1, 1, 1, 1, 3, 2, + 2, 2, 2, 4, 4, 2, 2, 2, 3, 2, + 0, 5, 0, 5, 0, 1, 3, 4, 3, 3, + 0, 4, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, + 1, 1, 1, 1, 1, 4, 4, 1, 1, 1, + 3, 3, 3, 1, 2, 1, 1, 1, 2, 1, + 2, 2, 1, 1, 1, 1, 1, 1 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTRPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTRPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTRPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +{ + YYUSE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to xreallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to xreallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 191 "p-exp.y" /* yacc.c:1646 */ + { current_type = NULL; + intvar = NULL; + search_field = 0; + leftdiv_is_integer = 0; + } +#line 1487 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 3: +#line 196 "p-exp.y" /* yacc.c:1646 */ + {} +#line 1493 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 6: +#line 205 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_TYPE); + write_exp_elt_type (pstate, (yyvsp[0].tval)); + write_exp_elt_opcode (pstate, OP_TYPE); + current_type = (yyvsp[0].tval); } +#line 1502 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 8: +#line 213 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_COMMA); } +#line 1508 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 9: +#line 218 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_IND); + if (current_type) + current_type = TYPE_TARGET_TYPE (current_type); } +#line 1516 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 10: +#line 224 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_ADDR); + if (current_type) + current_type = TYPE_POINTER_TYPE (current_type); } +#line 1524 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 11: +#line 230 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_NEG); } +#line 1530 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 12: +#line 234 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); } +#line 1536 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 13: +#line 238 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PREINCREMENT); } +#line 1542 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 14: +#line 242 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_PREDECREMENT); } +#line 1548 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 15: +#line 247 "p-exp.y" /* yacc.c:1646 */ + { search_field = 1; } +#line 1554 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 16: +#line 251 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + search_field = 0; + if (current_type) + { + while (TYPE_CODE (current_type) + == TYPE_CODE_PTR) + current_type = + TYPE_TARGET_TYPE (current_type); + current_type = lookup_struct_elt_type ( + current_type, (yyvsp[0].sval).ptr, 0); + } + } +#line 1573 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 17: +#line 269 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + search_field = 0; + if (current_type) + { + while (TYPE_CODE (current_type) + == TYPE_CODE_PTR) + current_type = + TYPE_TARGET_TYPE (current_type); + current_type = lookup_struct_elt_type ( + current_type, (yyvsp[0].sval).ptr, 0); + } + } +#line 1592 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 18: +#line 285 "p-exp.y" /* yacc.c:1646 */ + { mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, (yyvsp[-1].sval)); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 1601 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 19: +#line 291 "p-exp.y" /* yacc.c:1646 */ + { struct stoken s; + mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + s.ptr = ""; + s.length = 0; + write_exp_string (pstate, s); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); } +#line 1613 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 20: +#line 302 "p-exp.y" /* yacc.c:1646 */ + { const char *arrayname; + int arrayfieldindex; + arrayfieldindex = is_pascal_string_type ( + current_type, NULL, NULL, + NULL, NULL, &arrayname); + if (arrayfieldindex) + { + struct stoken stringsval; + char *buf; + + buf = (char *) alloca (strlen (arrayname) + 1); + stringsval.ptr = buf; + stringsval.length = strlen (arrayname); + strcpy (buf, arrayname); + current_type = TYPE_FIELD_TYPE (current_type, + arrayfieldindex - 1); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, stringsval); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + } + push_current_type (); } +#line 1639 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 21: +#line 324 "p-exp.y" /* yacc.c:1646 */ + { pop_current_type (); + write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); + if (current_type) + current_type = TYPE_TARGET_TYPE (current_type); } +#line 1648 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 22: +#line 333 "p-exp.y" /* yacc.c:1646 */ + { push_current_type (); + start_arglist (); } +#line 1655 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 23: +#line 336 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FUNCALL); + write_exp_elt_longcst (pstate, + (LONGEST) end_arglist ()); + write_exp_elt_opcode (pstate, OP_FUNCALL); + pop_current_type (); + if (current_type) + current_type = TYPE_TARGET_TYPE (current_type); + } +#line 1668 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 25: +#line 348 "p-exp.y" /* yacc.c:1646 */ + { arglist_len = 1; } +#line 1674 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 26: +#line 350 "p-exp.y" /* yacc.c:1646 */ + { arglist_len++; } +#line 1680 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 27: +#line 354 "p-exp.y" /* yacc.c:1646 */ + { if (current_type) + { + /* Allow automatic dereference of classes. */ + if ((TYPE_CODE (current_type) == TYPE_CODE_PTR) + && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_STRUCT) + && (TYPE_CODE ((yyvsp[-3].tval)) == TYPE_CODE_STRUCT)) + write_exp_elt_opcode (pstate, UNOP_IND); + } + write_exp_elt_opcode (pstate, UNOP_CAST); + write_exp_elt_type (pstate, (yyvsp[-3].tval)); + write_exp_elt_opcode (pstate, UNOP_CAST); + current_type = (yyvsp[-3].tval); } +#line 1697 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 28: +#line 369 "p-exp.y" /* yacc.c:1646 */ + { } +#line 1703 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 29: +#line 375 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_MUL); } +#line 1709 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 30: +#line 378 "p-exp.y" /* yacc.c:1646 */ + { + if (current_type && is_integral_type (current_type)) + leftdiv_is_integer = 1; + } +#line 1718 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 31: +#line 383 "p-exp.y" /* yacc.c:1646 */ + { + if (leftdiv_is_integer && current_type + && is_integral_type (current_type)) + { + write_exp_elt_opcode (pstate, UNOP_CAST); + write_exp_elt_type (pstate, + parse_type (pstate) + ->builtin_long_double); + current_type + = parse_type (pstate)->builtin_long_double; + write_exp_elt_opcode (pstate, UNOP_CAST); + leftdiv_is_integer = 0; + } + + write_exp_elt_opcode (pstate, BINOP_DIV); + } +#line 1739 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 32: +#line 402 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_INTDIV); } +#line 1745 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 33: +#line 406 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_REM); } +#line 1751 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 34: +#line 410 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ADD); } +#line 1757 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 35: +#line 414 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_SUB); } +#line 1763 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 36: +#line 418 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LSH); } +#line 1769 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 37: +#line 422 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_RSH); } +#line 1775 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 38: +#line 426 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_EQUAL); + current_type = parse_type (pstate)->builtin_bool; + } +#line 1783 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 39: +#line 432 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); + current_type = parse_type (pstate)->builtin_bool; + } +#line 1791 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 40: +#line 438 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LEQ); + current_type = parse_type (pstate)->builtin_bool; + } +#line 1799 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 41: +#line 444 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GEQ); + current_type = parse_type (pstate)->builtin_bool; + } +#line 1807 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 42: +#line 450 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_LESS); + current_type = parse_type (pstate)->builtin_bool; + } +#line 1815 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 43: +#line 456 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_GTR); + current_type = parse_type (pstate)->builtin_bool; + } +#line 1823 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 44: +#line 462 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); } +#line 1829 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 45: +#line 466 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); } +#line 1835 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 46: +#line 470 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); } +#line 1841 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 47: +#line 474 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, BINOP_ASSIGN); } +#line 1847 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 48: +#line 478 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_BOOL); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval)); + current_type = parse_type (pstate)->builtin_bool; + write_exp_elt_opcode (pstate, OP_BOOL); } +#line 1856 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 49: +#line 485 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_BOOL); + write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval)); + current_type = parse_type (pstate)->builtin_bool; + write_exp_elt_opcode (pstate, OP_BOOL); } +#line 1865 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 50: +#line 492 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, (yyvsp[0].typed_val_int).type); + current_type = (yyvsp[0].typed_val_int).type; + write_exp_elt_longcst (pstate, (LONGEST)((yyvsp[0].typed_val_int).val)); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 1875 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 51: +#line 500 "p-exp.y" /* yacc.c:1646 */ + { YYSTYPE val; + parse_number (pstate, (yyvsp[0].ssym).stoken.ptr, + (yyvsp[0].ssym).stoken.length, 0, &val); + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, val.typed_val_int.type); + current_type = val.typed_val_int.type; + write_exp_elt_longcst (pstate, (LONGEST) + val.typed_val_int.val); + write_exp_elt_opcode (pstate, OP_LONG); + } +#line 1890 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 52: +#line 514 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_FLOAT); + write_exp_elt_type (pstate, (yyvsp[0].typed_val_float).type); + current_type = (yyvsp[0].typed_val_float).type; + write_exp_elt_floatcst (pstate, (yyvsp[0].typed_val_float).val); + write_exp_elt_opcode (pstate, OP_FLOAT); } +#line 1900 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 54: +#line 527 "p-exp.y" /* yacc.c:1646 */ + { if (intvar) { + struct value * val, * mark; + + mark = value_mark (); + val = value_of_internalvar (parse_gdbarch (pstate), + intvar); + current_type = value_type (val); + value_release_to_mark (mark); + } + } +#line 1915 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 55: +#line 540 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_type (pstate)->builtin_int); + current_type = parse_type (pstate)->builtin_int; + (yyvsp[-1].tval) = check_typedef ((yyvsp[-1].tval)); + write_exp_elt_longcst (pstate, + (LONGEST) TYPE_LENGTH ((yyvsp[-1].tval))); + write_exp_elt_opcode (pstate, OP_LONG); } +#line 1928 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 56: +#line 551 "p-exp.y" /* yacc.c:1646 */ + { write_exp_elt_opcode (pstate, UNOP_SIZEOF); + current_type = parse_type (pstate)->builtin_int; } +#line 1935 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 57: +#line 555 "p-exp.y" /* yacc.c:1646 */ + { /* C strings are converted into array constants with + an explicit null byte added at the end. Thus + the array upper bound is the string length. + There is no such thing in C as a completely empty + string. */ + const char *sp = (yyvsp[0].sval).ptr; int count = (yyvsp[0].sval).length; + + while (count-- > 0) + { + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_type (pstate) + ->builtin_char); + write_exp_elt_longcst (pstate, + (LONGEST) (*sp++)); + write_exp_elt_opcode (pstate, OP_LONG); + } + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, + parse_type (pstate) + ->builtin_char); + write_exp_elt_longcst (pstate, (LONGEST)'\0'); + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_opcode (pstate, OP_ARRAY); + write_exp_elt_longcst (pstate, (LONGEST) 0); + write_exp_elt_longcst (pstate, + (LONGEST) ((yyvsp[0].sval).length)); + write_exp_elt_opcode (pstate, OP_ARRAY); } +#line 1968 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 58: +#line 587 "p-exp.y" /* yacc.c:1646 */ + { + struct value * this_val; + struct type * this_type; + write_exp_elt_opcode (pstate, OP_THIS); + write_exp_elt_opcode (pstate, OP_THIS); + /* We need type of this. */ + this_val + = value_of_this_silent (parse_language (pstate)); + if (this_val) + this_type = value_type (this_val); + else + this_type = NULL; + if (this_type) + { + if (TYPE_CODE (this_type) == TYPE_CODE_PTR) + { + this_type = TYPE_TARGET_TYPE (this_type); + write_exp_elt_opcode (pstate, UNOP_IND); + } + } + + current_type = this_type; + } +#line 1996 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 59: +#line 615 "p-exp.y" /* yacc.c:1646 */ + { + if ((yyvsp[0].ssym).sym.symbol != 0) + (yyval.bval) = SYMBOL_BLOCK_VALUE ((yyvsp[0].ssym).sym.symbol); + else + { + struct symtab *tem = + lookup_symtab (copy_name ((yyvsp[0].ssym).stoken)); + if (tem) + (yyval.bval) = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (tem), + STATIC_BLOCK); + else + error (_("No file or function \"%s\"."), + copy_name ((yyvsp[0].ssym).stoken)); + } + } +#line 2016 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 60: +#line 633 "p-exp.y" /* yacc.c:1646 */ + { struct symbol *tem + = lookup_symbol (copy_name ((yyvsp[0].sval)), (yyvsp[-2].bval), + VAR_DOMAIN, NULL).symbol; + + if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) + error (_("No function \"%s\" in specified context."), + copy_name ((yyvsp[0].sval))); + (yyval.bval) = SYMBOL_BLOCK_VALUE (tem); } +#line 2029 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 61: +#line 644 "p-exp.y" /* yacc.c:1646 */ + { struct block_symbol sym; + + sym = lookup_symbol (copy_name ((yyvsp[0].sval)), (yyvsp[-2].bval), + VAR_DOMAIN, NULL); + if (sym.symbol == 0) + error (_("No symbol \"%s\" in specified context."), + copy_name ((yyvsp[0].sval))); + + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, sym.block); + write_exp_elt_sym (pstate, sym.symbol); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); } +#line 2046 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 62: +#line 659 "p-exp.y" /* yacc.c:1646 */ + { + struct type *type = (yyvsp[-2].tval); + + if (TYPE_CODE (type) != TYPE_CODE_STRUCT + && TYPE_CODE (type) != TYPE_CODE_UNION) + error (_("`%s' is not defined as an aggregate type."), + TYPE_NAME (type)); + + write_exp_elt_opcode (pstate, OP_SCOPE); + write_exp_elt_type (pstate, type); + write_exp_string (pstate, (yyvsp[0].sval)); + write_exp_elt_opcode (pstate, OP_SCOPE); + } +#line 2064 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 64: +#line 676 "p-exp.y" /* yacc.c:1646 */ + { + char *name = copy_name ((yyvsp[0].sval)); + struct symbol *sym; + struct bound_minimal_symbol msymbol; + + sym = + lookup_symbol (name, (const struct block *) NULL, + VAR_DOMAIN, NULL).symbol; + if (sym) + { + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, NULL); + write_exp_elt_sym (pstate, sym); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + break; + } + + msymbol = lookup_bound_minimal_symbol (name); + if (msymbol.minsym != NULL) + write_exp_msymbol (pstate, msymbol); + else if (!have_full_symbols () + && !have_partial_symbols ()) + error (_("No symbol table is loaded. " + "Use the \"file\" command.")); + else + error (_("No symbol \"%s\" in current context."), + name); + } +#line 2097 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 65: +#line 707 "p-exp.y" /* yacc.c:1646 */ + { struct block_symbol sym = (yyvsp[0].ssym).sym; + + if (sym.symbol) + { + if (symbol_read_needs_frame (sym.symbol)) + innermost_block.update (sym); + + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, sym.block); + write_exp_elt_sym (pstate, sym.symbol); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + current_type = sym.symbol->type; } + else if ((yyvsp[0].ssym).is_a_field_of_this) + { + struct value * this_val; + struct type * this_type; + /* Object pascal: it hangs off of `this'. Must + not inadvertently convert from a method call + to data ref. */ + innermost_block.update (sym); + write_exp_elt_opcode (pstate, OP_THIS); + write_exp_elt_opcode (pstate, OP_THIS); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); + write_exp_string (pstate, (yyvsp[0].ssym).stoken); + write_exp_elt_opcode (pstate, STRUCTOP_PTR); + /* We need type of this. */ + this_val + = value_of_this_silent (parse_language (pstate)); + if (this_val) + this_type = value_type (this_val); + else + this_type = NULL; + if (this_type) + current_type = lookup_struct_elt_type ( + this_type, + copy_name ((yyvsp[0].ssym).stoken), 0); + else + current_type = NULL; + } + else + { + struct bound_minimal_symbol msymbol; + char *arg = copy_name ((yyvsp[0].ssym).stoken); + + msymbol = + lookup_bound_minimal_symbol (arg); + if (msymbol.minsym != NULL) + write_exp_msymbol (pstate, msymbol); + else if (!have_full_symbols () + && !have_partial_symbols ()) + error (_("No symbol table is loaded. " + "Use the \"file\" command.")); + else + error (_("No symbol \"%s\" in current context."), + copy_name ((yyvsp[0].ssym).stoken)); + } + } +#line 2159 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 68: +#line 783 "p-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_pointer_type ((yyvsp[0].tval)); } +#line 2165 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 69: +#line 785 "p-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = (yyvsp[0].tsym).type; } +#line 2171 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 70: +#line 787 "p-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_struct (copy_name ((yyvsp[0].sval)), + expression_context_block); } +#line 2178 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 71: +#line 790 "p-exp.y" /* yacc.c:1646 */ + { (yyval.tval) = lookup_struct (copy_name ((yyvsp[0].sval)), + expression_context_block); } +#line 2185 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 72: +#line 797 "p-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].ssym).stoken; } +#line 2191 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 73: +#line 798 "p-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].ssym).stoken; } +#line 2197 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 74: +#line 799 "p-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].tsym).stoken; } +#line 2203 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 75: +#line 800 "p-exp.y" /* yacc.c:1646 */ + { (yyval.sval) = (yyvsp[0].ssym).stoken; } +#line 2209 "p-exp.c.tmp" /* yacc.c:1646 */ + break; + + +#line 2213 "p-exp.c.tmp" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 814 "p-exp.y" /* yacc.c:1906 */ + + +/* Take care of parsing a number (anything that starts with a digit). + Set yylval and return the token type; update lexptr. + LEN is the number of characters in it. */ + +/*** Needs some error checking for the float case ***/ + +static int +parse_number (struct parser_state *par_state, + const char *p, int len, int parsed_float, YYSTYPE *putithere) +{ + /* FIXME: Shouldn't these be unsigned? We don't deal with negative values + here, and we do kind of silly things like cast to unsigned. */ + LONGEST n = 0; + LONGEST prevn = 0; + ULONGEST un; + + int i = 0; + int c; + int base = input_radix; + int unsigned_p = 0; + + /* Number of "L" suffixes encountered. */ + int long_p = 0; + + /* We have found a "L" or "U" suffix. */ + int found_suffix = 0; + + ULONGEST high_bit; + struct type *signed_type; + struct type *unsigned_type; + + if (parsed_float) + { + /* Handle suffixes: 'f' for float, 'l' for long double. + FIXME: This appears to be an extension -- do we want this? */ + if (len >= 1 && tolower (p[len - 1]) == 'f') + { + putithere->typed_val_float.type + = parse_type (par_state)->builtin_float; + len--; + } + else if (len >= 1 && tolower (p[len - 1]) == 'l') + { + putithere->typed_val_float.type + = parse_type (par_state)->builtin_long_double; + len--; + } + /* Default type for floating-point literals is double. */ + else + { + putithere->typed_val_float.type + = parse_type (par_state)->builtin_double; + } + + if (!parse_float (p, len, + putithere->typed_val_float.type, + putithere->typed_val_float.val)) + return ERROR; + return FLOAT; + } + + /* Handle base-switching prefixes 0x, 0t, 0d, 0. */ + if (p[0] == '0') + switch (p[1]) + { + case 'x': + case 'X': + if (len >= 3) + { + p += 2; + base = 16; + len -= 2; + } + break; + + case 't': + case 'T': + case 'd': + case 'D': + if (len >= 3) + { + p += 2; + base = 10; + len -= 2; + } + break; + + default: + base = 8; + break; + } + + while (len-- > 0) + { + c = *p++; + if (c >= 'A' && c <= 'Z') + c += 'a' - 'A'; + if (c != 'l' && c != 'u') + n *= base; + if (c >= '0' && c <= '9') + { + if (found_suffix) + return ERROR; + n += i = c - '0'; + } + else + { + if (base > 10 && c >= 'a' && c <= 'f') + { + if (found_suffix) + return ERROR; + n += i = c - 'a' + 10; + } + else if (c == 'l') + { + ++long_p; + found_suffix = 1; + } + else if (c == 'u') + { + unsigned_p = 1; + found_suffix = 1; + } + else + return ERROR; /* Char not a digit */ + } + if (i >= base) + return ERROR; /* Invalid digit in this base. */ + + /* Portably test for overflow (only works for nonzero values, so make + a second check for zero). FIXME: Can't we just make n and prevn + unsigned and avoid this? */ + if (c != 'l' && c != 'u' && (prevn >= n) && n != 0) + unsigned_p = 1; /* Try something unsigned. */ + + /* Portably test for unsigned overflow. + FIXME: This check is wrong; for example it doesn't find overflow + on 0x123456789 when LONGEST is 32 bits. */ + if (c != 'l' && c != 'u' && n != 0) + { + if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n)) + error (_("Numeric constant too large.")); + } + prevn = n; + } + + /* An integer constant is an int, a long, or a long long. An L + suffix forces it to be long; an LL suffix forces it to be long + long. If not forced to a larger size, it gets the first type of + the above that it fits in. To figure out whether it fits, we + shift it right and see whether anything remains. Note that we + can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one + operation, because many compilers will warn about such a shift + (which always produces a zero result). Sometimes gdbarch_int_bit + or gdbarch_long_bit will be that big, sometimes not. To deal with + the case where it is we just always shift the value more than + once, with fewer bits each time. */ + + un = (ULONGEST)n >> 2; + if (long_p == 0 + && (un >> (gdbarch_int_bit (parse_gdbarch (par_state)) - 2)) == 0) + { + high_bit + = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch (par_state)) - 1); + + /* A large decimal (not hex or octal) constant (between INT_MAX + and UINT_MAX) is a long or unsigned long, according to ANSI, + never an unsigned int, but this code treats it as unsigned + int. This probably should be fixed. GCC gives a warning on + such constants. */ + + unsigned_type = parse_type (par_state)->builtin_unsigned_int; + signed_type = parse_type (par_state)->builtin_int; + } + else if (long_p <= 1 + && (un >> (gdbarch_long_bit (parse_gdbarch (par_state)) - 2)) == 0) + { + high_bit + = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch (par_state)) - 1); + unsigned_type = parse_type (par_state)->builtin_unsigned_long; + signed_type = parse_type (par_state)->builtin_long; + } + else + { + int shift; + if (sizeof (ULONGEST) * HOST_CHAR_BIT + < gdbarch_long_long_bit (parse_gdbarch (par_state))) + /* A long long does not fit in a LONGEST. */ + shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1); + else + shift = (gdbarch_long_long_bit (parse_gdbarch (par_state)) - 1); + high_bit = (ULONGEST) 1 << shift; + unsigned_type = parse_type (par_state)->builtin_unsigned_long_long; + signed_type = parse_type (par_state)->builtin_long_long; + } + + putithere->typed_val_int.val = n; + + /* If the high bit of the worked out type is set then this number + has to be unsigned. */ + + if (unsigned_p || (n & high_bit)) + { + putithere->typed_val_int.type = unsigned_type; + } + else + { + putithere->typed_val_int.type = signed_type; + } + + return INT; +} + + +struct type_push +{ + struct type *stored; + struct type_push *next; +}; + +static struct type_push *tp_top = NULL; + +static void +push_current_type (void) +{ + struct type_push *tpnew; + tpnew = (struct type_push *) xmalloc (sizeof (struct type_push)); + tpnew->next = tp_top; + tpnew->stored = current_type; + current_type = NULL; + tp_top = tpnew; +} + +static void +pop_current_type (void) +{ + struct type_push *tp = tp_top; + if (tp) + { + current_type = tp->stored; + tp_top = tp->next; + xfree (tp); + } +} + +struct token +{ + const char *oper; + int token; + enum exp_opcode opcode; +}; + +static const struct token tokentab3[] = + { + {"shr", RSH, BINOP_END}, + {"shl", LSH, BINOP_END}, + {"and", ANDAND, BINOP_END}, + {"div", DIV, BINOP_END}, + {"not", NOT, BINOP_END}, + {"mod", MOD, BINOP_END}, + {"inc", INCREMENT, BINOP_END}, + {"dec", DECREMENT, BINOP_END}, + {"xor", XOR, BINOP_END} + }; + +static const struct token tokentab2[] = + { + {"or", OR, BINOP_END}, + {"<>", NOTEQUAL, BINOP_END}, + {"<=", LEQ, BINOP_END}, + {">=", GEQ, BINOP_END}, + {":=", ASSIGN, BINOP_END}, + {"::", COLONCOLON, BINOP_END} }; + +/* Allocate uppercased var: */ +/* make an uppercased copy of tokstart. */ +static char * +uptok (const char *tokstart, int namelen) +{ + int i; + char *uptokstart = (char *)xmalloc(namelen+1); + for (i = 0;i <= namelen;i++) + { + if ((tokstart[i]>='a' && tokstart[i]<='z')) + uptokstart[i] = tokstart[i]-('a'-'A'); + else + uptokstart[i] = tokstart[i]; + } + uptokstart[namelen]='\0'; + return uptokstart; +} + +/* Read one token, getting characters through lexptr. */ + +static int +yylex (void) +{ + int c; + int namelen; + const char *tokstart; + char *uptokstart; + const char *tokptr; + int explen, tempbufindex; + static char *tempbuf; + static int tempbufsize; + + retry: + + prev_lexptr = lexptr; + + tokstart = lexptr; + explen = strlen (lexptr); + + /* See if it is a special token of length 3. */ + if (explen > 2) + for (int i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++) + if (strncasecmp (tokstart, tokentab3[i].oper, 3) == 0 + && (!isalpha (tokentab3[i].oper[0]) || explen == 3 + || (!isalpha (tokstart[3]) + && !isdigit (tokstart[3]) && tokstart[3] != '_'))) + { + lexptr += 3; + yylval.opcode = tokentab3[i].opcode; + return tokentab3[i].token; + } + + /* See if it is a special token of length 2. */ + if (explen > 1) + for (int i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++) + if (strncasecmp (tokstart, tokentab2[i].oper, 2) == 0 + && (!isalpha (tokentab2[i].oper[0]) || explen == 2 + || (!isalpha (tokstart[2]) + && !isdigit (tokstart[2]) && tokstart[2] != '_'))) + { + lexptr += 2; + yylval.opcode = tokentab2[i].opcode; + return tokentab2[i].token; + } + + switch (c = *tokstart) + { + case 0: + if (search_field && parse_completion) + return COMPLETE; + else + return 0; + + case ' ': + case '\t': + case '\n': + lexptr++; + goto retry; + + case '\'': + /* We either have a character constant ('0' or '\177' for example) + or we have a quoted symbol reference ('foo(int,int)' in object pascal + for example). */ + lexptr++; + c = *lexptr++; + if (c == '\\') + c = parse_escape (parse_gdbarch (pstate), &lexptr); + else if (c == '\'') + error (_("Empty character constant.")); + + yylval.typed_val_int.val = c; + yylval.typed_val_int.type = parse_type (pstate)->builtin_char; + + c = *lexptr++; + if (c != '\'') + { + namelen = skip_quoted (tokstart) - tokstart; + if (namelen > 2) + { + lexptr = tokstart + namelen; + if (lexptr[-1] != '\'') + error (_("Unmatched single quote.")); + namelen -= 2; + tokstart++; + uptokstart = uptok(tokstart,namelen); + goto tryname; + } + error (_("Invalid character constant.")); + } + return INT; + + case '(': + paren_depth++; + lexptr++; + return c; + + case ')': + if (paren_depth == 0) + return 0; + paren_depth--; + lexptr++; + return c; + + case ',': + if (comma_terminates && paren_depth == 0) + return 0; + lexptr++; + return c; + + case '.': + /* Might be a floating point number. */ + if (lexptr[1] < '0' || lexptr[1] > '9') + { + goto symbol; /* Nope, must be a symbol. */ + } + + /* FALL THRU. */ + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + { + /* It's a number. */ + int got_dot = 0, got_e = 0, toktype; + const char *p = tokstart; + int hex = input_radix > 10; + + if (c == '0' && (p[1] == 'x' || p[1] == 'X')) + { + p += 2; + hex = 1; + } + else if (c == '0' && (p[1]=='t' || p[1]=='T' + || p[1]=='d' || p[1]=='D')) + { + p += 2; + hex = 0; + } + + for (;; ++p) + { + /* This test includes !hex because 'e' is a valid hex digit + and thus does not indicate a floating point number when + the radix is hex. */ + if (!hex && !got_e && (*p == 'e' || *p == 'E')) + got_dot = got_e = 1; + /* This test does not include !hex, because a '.' always indicates + a decimal floating point number regardless of the radix. */ + else if (!got_dot && *p == '.') + got_dot = 1; + else if (got_e && (p[-1] == 'e' || p[-1] == 'E') + && (*p == '-' || *p == '+')) + /* This is the sign of the exponent, not the end of the + number. */ + continue; + /* We will take any letters or digits. parse_number will + complain if past the radix, or if L or U are not final. */ + else if ((*p < '0' || *p > '9') + && ((*p < 'a' || *p > 'z') + && (*p < 'A' || *p > 'Z'))) + break; + } + toktype = parse_number (pstate, tokstart, + p - tokstart, got_dot | got_e, &yylval); + if (toktype == ERROR) + { + char *err_copy = (char *) alloca (p - tokstart + 1); + + memcpy (err_copy, tokstart, p - tokstart); + err_copy[p - tokstart] = 0; + error (_("Invalid number \"%s\"."), err_copy); + } + lexptr = p; + return toktype; + } + + case '+': + case '-': + case '*': + case '/': + case '|': + case '&': + case '^': + case '~': + case '!': + case '@': + case '<': + case '>': + case '[': + case ']': + case '?': + case ':': + case '=': + case '{': + case '}': + symbol: + lexptr++; + return c; + + case '"': + + /* Build the gdb internal form of the input string in tempbuf, + translating any standard C escape forms seen. Note that the + buffer is null byte terminated *only* for the convenience of + debugging gdb itself and printing the buffer contents when + the buffer contains no embedded nulls. Gdb does not depend + upon the buffer being null byte terminated, it uses the length + string instead. This allows gdb to handle C strings (as well + as strings in other languages) with embedded null bytes. */ + + tokptr = ++tokstart; + tempbufindex = 0; + + do { + /* Grow the static temp buffer if necessary, including allocating + the first one on demand. */ + if (tempbufindex + 1 >= tempbufsize) + { + tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64); + } + + switch (*tokptr) + { + case '\0': + case '"': + /* Do nothing, loop will terminate. */ + break; + case '\\': + ++tokptr; + c = parse_escape (parse_gdbarch (pstate), &tokptr); + if (c == -1) + { + continue; + } + tempbuf[tempbufindex++] = c; + break; + default: + tempbuf[tempbufindex++] = *tokptr++; + break; + } + } while ((*tokptr != '"') && (*tokptr != '\0')); + if (*tokptr++ != '"') + { + error (_("Unterminated string in expression.")); + } + tempbuf[tempbufindex] = '\0'; /* See note above. */ + yylval.sval.ptr = tempbuf; + yylval.sval.length = tempbufindex; + lexptr = tokptr; + return (STRING); + } + + if (!(c == '_' || c == '$' + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) + /* We must have come across a bad character (e.g. ';'). */ + error (_("Invalid character '%c' in expression."), c); + + /* It's a name. See how long it is. */ + namelen = 0; + for (c = tokstart[namelen]; + (c == '_' || c == '$' || (c >= '0' && c <= '9') + || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');) + { + /* Template parameter lists are part of the name. + FIXME: This mishandles `print $a<4&&$a>3'. */ + if (c == '<') + { + int i = namelen; + int nesting_level = 1; + while (tokstart[++i]) + { + if (tokstart[i] == '<') + nesting_level++; + else if (tokstart[i] == '>') + { + if (--nesting_level == 0) + break; + } + } + if (tokstart[i] == '>') + namelen = i; + else + break; + } + + /* do NOT uppercase internals because of registers !!! */ + c = tokstart[++namelen]; + } + + uptokstart = uptok(tokstart,namelen); + + /* The token "if" terminates the expression and is NOT + removed from the input stream. */ + if (namelen == 2 && uptokstart[0] == 'I' && uptokstart[1] == 'F') + { + xfree (uptokstart); + return 0; + } + + lexptr += namelen; + + tryname: + + /* Catch specific keywords. Should be done with a data structure. */ + switch (namelen) + { + case 6: + if (strcmp (uptokstart, "OBJECT") == 0) + { + xfree (uptokstart); + return CLASS; + } + if (strcmp (uptokstart, "RECORD") == 0) + { + xfree (uptokstart); + return STRUCT; + } + if (strcmp (uptokstart, "SIZEOF") == 0) + { + xfree (uptokstart); + return SIZEOF; + } + break; + case 5: + if (strcmp (uptokstart, "CLASS") == 0) + { + xfree (uptokstart); + return CLASS; + } + if (strcmp (uptokstart, "FALSE") == 0) + { + yylval.lval = 0; + xfree (uptokstart); + return FALSEKEYWORD; + } + break; + case 4: + if (strcmp (uptokstart, "TRUE") == 0) + { + yylval.lval = 1; + xfree (uptokstart); + return TRUEKEYWORD; + } + if (strcmp (uptokstart, "SELF") == 0) + { + /* Here we search for 'this' like + inserted in FPC stabs debug info. */ + static const char this_name[] = "this"; + + if (lookup_symbol (this_name, expression_context_block, + VAR_DOMAIN, NULL).symbol) + { + xfree (uptokstart); + return THIS; + } + } + break; + default: + break; + } + + yylval.sval.ptr = tokstart; + yylval.sval.length = namelen; + + if (*tokstart == '$') + { + char *tmp; + + /* $ is the normal prefix for pascal hexadecimal values + but this conflicts with the GDB use for debugger variables + so in expression to enter hexadecimal values + we still need to use C syntax with 0xff */ + write_dollar_variable (pstate, yylval.sval); + tmp = (char *) alloca (namelen + 1); + memcpy (tmp, tokstart, namelen); + tmp[namelen] = '\0'; + intvar = lookup_only_internalvar (tmp + 1); + xfree (uptokstart); + return DOLLAR_VARIABLE; + } + + /* Use token-type BLOCKNAME for symbols that happen to be defined as + functions or symtabs. If this is not so, then ... + Use token-type TYPENAME for symbols that happen to be defined + currently as names of types; NAME for other symbols. + The caller is not constrained to care about the distinction. */ + { + char *tmp = copy_name (yylval.sval); + struct symbol *sym; + struct field_of_this_result is_a_field_of_this; + int is_a_field = 0; + int hextype; + + is_a_field_of_this.type = NULL; + if (search_field && current_type) + is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); + if (is_a_field) + sym = NULL; + else + sym = lookup_symbol (tmp, expression_context_block, + VAR_DOMAIN, &is_a_field_of_this).symbol; + /* second chance uppercased (as Free Pascal does). */ + if (!sym && is_a_field_of_this.type == NULL && !is_a_field) + { + for (int i = 0; i <= namelen; i++) + { + if ((tmp[i] >= 'a' && tmp[i] <= 'z')) + tmp[i] -= ('a'-'A'); + } + if (search_field && current_type) + is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); + if (is_a_field) + sym = NULL; + else + sym = lookup_symbol (tmp, expression_context_block, + VAR_DOMAIN, &is_a_field_of_this).symbol; + } + /* Third chance Capitalized (as GPC does). */ + if (!sym && is_a_field_of_this.type == NULL && !is_a_field) + { + for (int i = 0; i <= namelen; i++) + { + if (i == 0) + { + if ((tmp[i] >= 'a' && tmp[i] <= 'z')) + tmp[i] -= ('a'-'A'); + } + else + if ((tmp[i] >= 'A' && tmp[i] <= 'Z')) + tmp[i] -= ('A'-'a'); + } + if (search_field && current_type) + is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); + if (is_a_field) + sym = NULL; + else + sym = lookup_symbol (tmp, expression_context_block, + VAR_DOMAIN, &is_a_field_of_this).symbol; + } + + if (is_a_field || (is_a_field_of_this.type != NULL)) + { + tempbuf = (char *) xrealloc (tempbuf, namelen + 1); + strncpy (tempbuf, tmp, namelen); + tempbuf [namelen] = 0; + yylval.sval.ptr = tempbuf; + yylval.sval.length = namelen; + yylval.ssym.sym.symbol = NULL; + yylval.ssym.sym.block = NULL; + xfree (uptokstart); + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + if (is_a_field) + return FIELDNAME; + else + return NAME; + } + /* Call lookup_symtab, not lookup_partial_symtab, in case there are + no psymtabs (coff, xcoff, or some future change to blow away the + psymtabs once once symbols are read). */ + if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) + || lookup_symtab (tmp)) + { + yylval.ssym.sym.symbol = sym; + yylval.ssym.sym.block = NULL; + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + xfree (uptokstart); + return BLOCKNAME; + } + if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) + { +#if 1 + /* Despite the following flaw, we need to keep this code enabled. + Because we can get called from check_stub_method, if we don't + handle nested types then it screws many operations in any + program which uses nested types. */ + /* In "A::x", if x is a member function of A and there happens + to be a type (nested or not, since the stabs don't make that + distinction) named x, then this code incorrectly thinks we + are dealing with nested types rather than a member function. */ + + const char *p; + const char *namestart; + struct symbol *best_sym; + + /* Look ahead to detect nested types. This probably should be + done in the grammar, but trying seemed to introduce a lot + of shift/reduce and reduce/reduce conflicts. It's possible + that it could be done, though. Or perhaps a non-grammar, but + less ad hoc, approach would work well. */ + + /* Since we do not currently have any way of distinguishing + a nested type from a non-nested one (the stabs don't tell + us whether a type is nested), we just ignore the + containing type. */ + + p = lexptr; + best_sym = sym; + while (1) + { + /* Skip whitespace. */ + while (*p == ' ' || *p == '\t' || *p == '\n') + ++p; + if (*p == ':' && p[1] == ':') + { + /* Skip the `::'. */ + p += 2; + /* Skip whitespace. */ + while (*p == ' ' || *p == '\t' || *p == '\n') + ++p; + namestart = p; + while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9') + || (*p >= 'a' && *p <= 'z') + || (*p >= 'A' && *p <= 'Z')) + ++p; + if (p != namestart) + { + struct symbol *cur_sym; + /* As big as the whole rest of the expression, which is + at least big enough. */ + char *ncopy + = (char *) alloca (strlen (tmp) + strlen (namestart) + + 3); + char *tmp1; + + tmp1 = ncopy; + memcpy (tmp1, tmp, strlen (tmp)); + tmp1 += strlen (tmp); + memcpy (tmp1, "::", 2); + tmp1 += 2; + memcpy (tmp1, namestart, p - namestart); + tmp1[p - namestart] = '\0'; + cur_sym = lookup_symbol (ncopy, expression_context_block, + VAR_DOMAIN, NULL).symbol; + if (cur_sym) + { + if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF) + { + best_sym = cur_sym; + lexptr = p; + } + else + break; + } + else + break; + } + else + break; + } + else + break; + } + + yylval.tsym.type = SYMBOL_TYPE (best_sym); +#else /* not 0 */ + yylval.tsym.type = SYMBOL_TYPE (sym); +#endif /* not 0 */ + xfree (uptokstart); + return TYPENAME; + } + yylval.tsym.type + = language_lookup_primitive_type (parse_language (pstate), + parse_gdbarch (pstate), tmp); + if (yylval.tsym.type != NULL) + { + xfree (uptokstart); + return TYPENAME; + } + + /* Input names that aren't symbols but ARE valid hex numbers, + when the input radix permits them, can be names or numbers + depending on the parse. Note we support radixes > 16 here. */ + if (!sym + && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) + || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10))) + { + YYSTYPE newlval; /* Its value is ignored. */ + hextype = parse_number (pstate, tokstart, namelen, 0, &newlval); + if (hextype == INT) + { + yylval.ssym.sym.symbol = sym; + yylval.ssym.sym.block = NULL; + yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL; + xfree (uptokstart); + return NAME_OR_INT; + } + } + + xfree(uptokstart); + /* Any other kind of symbol. */ + yylval.ssym.sym.symbol = sym; + yylval.ssym.sym.block = NULL; + return NAME; + } +} + +int +pascal_parse (struct parser_state *par_state) +{ + /* Setting up the parser state. */ + scoped_restore pstate_restore = make_scoped_restore (&pstate); + gdb_assert (par_state != NULL); + pstate = par_state; + + return yyparse (); +} + +static void +yyerror (const char *msg) +{ + if (prev_lexptr) + lexptr = prev_lexptr; + + error (_("A %s in expression, near `%s'."), msg, lexptr); +} diff --git a/gdb-8.3.1/gdb/rust-exp.c b/gdb-8.3.1/gdb/rust-exp.c new file mode 100644 index 0000000000000000000000000000000000000000..9a1bc8c6ae555fcf9508c9cf5a060f8c5fa98ff2 --- /dev/null +++ b/gdb-8.3.1/gdb/rust-exp.c @@ -0,0 +1,4778 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* Copy the first part of user declarations. */ +#line 30 "rust-exp.y" /* yacc.c:339 */ + + +#include "defs.h" + +#include "block.h" +#include "charset.h" +#include "cp-support.h" +#include "gdb_obstack.h" +#include "gdb_regex.h" +#include "rust-lang.h" +#include "parser-defs.h" +#include "common/selftest.h" +#include "value.h" +#include "common/vec.h" + +#define GDB_YY_REMAP_PREFIX rust +#include "yy-remap.h" + +#define RUSTSTYPE YYSTYPE + +struct rust_op; +typedef std::vector rust_op_vector; + +/* A typed integer constant. */ + +struct typed_val_int +{ + LONGEST val; + struct type *type; +}; + +/* A typed floating point constant. */ + +struct typed_val_float +{ + gdb_byte val[16]; + struct type *type; +}; + +/* An identifier and an expression. This is used to represent one + element of a struct initializer. */ + +struct set_field +{ + struct stoken name; + const struct rust_op *init; +}; + +typedef std::vector rust_set_vector; + + +#line 118 "rust-exp.c.tmp" /* yacc.c:339 */ + +# ifndef YY_NULLPTRPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTRPTR nullptr +# else +# define YY_NULLPTRPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + GDBVAR = 258, + IDENT = 259, + COMPLETE = 260, + INTEGER = 261, + DECIMAL_INTEGER = 262, + STRING = 263, + BYTESTRING = 264, + FLOAT = 265, + COMPOUND_ASSIGN = 266, + KW_AS = 267, + KW_IF = 268, + KW_TRUE = 269, + KW_FALSE = 270, + KW_SUPER = 271, + KW_SELF = 272, + KW_MUT = 273, + KW_EXTERN = 274, + KW_CONST = 275, + KW_FN = 276, + KW_SIZEOF = 277, + DOTDOT = 278, + DOTDOTEQ = 279, + OROR = 280, + ANDAND = 281, + EQEQ = 282, + NOTEQ = 283, + LTEQ = 284, + GTEQ = 285, + LSH = 286, + RSH = 287, + COLONCOLON = 288, + ARROW = 289, + UNARY = 290 + }; +#endif +/* Tokens. */ +#define GDBVAR 258 +#define IDENT 259 +#define COMPLETE 260 +#define INTEGER 261 +#define DECIMAL_INTEGER 262 +#define STRING 263 +#define BYTESTRING 264 +#define FLOAT 265 +#define COMPOUND_ASSIGN 266 +#define KW_AS 267 +#define KW_IF 268 +#define KW_TRUE 269 +#define KW_FALSE 270 +#define KW_SUPER 271 +#define KW_SELF 272 +#define KW_MUT 273 +#define KW_EXTERN 274 +#define KW_CONST 275 +#define KW_FN 276 +#define KW_SIZEOF 277 +#define DOTDOT 278 +#define DOTDOTEQ 279 +#define OROR 280 +#define ANDAND 281 +#define EQEQ 282 +#define NOTEQ 283 +#define LTEQ 284 +#define GTEQ 285 +#define LSH 286 +#define RSH 287 +#define COLONCOLON 288 +#define ARROW 289 +#define UNARY 290 + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED + +union YYSTYPE +{ +#line 83 "rust-exp.y" /* yacc.c:355 */ + + /* A typed integer constant. */ + struct typed_val_int typed_val_int; + + /* A typed floating point constant. */ + struct typed_val_float typed_val_float; + + /* An identifier or string. */ + struct stoken sval; + + /* A token representing an opcode, like "==". */ + enum exp_opcode opcode; + + /* A list of expressions; for example, the arguments to a function + call. */ + rust_op_vector *params; + + /* A list of field initializers. */ + rust_set_vector *field_inits; + + /* A single field initializer. */ + struct set_field one_field_init; + + /* An expression. */ + const struct rust_op *op; + + /* A plain integer, for example used to count the number of + "super::" prefixes on a path. */ + unsigned int depth; + +#line 256 "rust-exp.c.tmp" /* yacc.c:355 */ +}; + +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +int yyparse (struct rust_parser *parser); + + + +/* Copy the second part of user declarations. */ +#line 114 "rust-exp.y" /* yacc.c:358 */ + + +struct rust_parser; +static int rustyylex (YYSTYPE *, rust_parser *); +static void rustyyerror (rust_parser *parser, const char *msg); + +static void rust_push_back (char c); +static struct stoken make_stoken (const char *); +static struct block_symbol rust_lookup_symbol (const char *name, + const struct block *block, + const domain_enum domain); + +/* A regular expression for matching Rust numbers. This is split up + since it is very long and this gives us a way to comment the + sections. */ + +static const char *number_regex_text = + /* subexpression 1: allows use of alternation, otherwise uninteresting */ + "^(" + /* First comes floating point. */ + /* Recognize number after the decimal point, with optional + exponent and optional type suffix. + subexpression 2: allows "?", otherwise uninteresting + subexpression 3: if present, type suffix + */ + "[0-9][0-9_]*\\.[0-9][0-9_]*([eE][-+]?[0-9][0-9_]*)?(f32|f64)?" +#define FLOAT_TYPE1 3 + "|" + /* Recognize exponent without decimal point, with optional type + suffix. + subexpression 4: if present, type suffix + */ +#define FLOAT_TYPE2 4 + "[0-9][0-9_]*[eE][-+]?[0-9][0-9_]*(f32|f64)?" + "|" + /* "23." is a valid floating point number, but "23.e5" and + "23.f32" are not. So, handle the trailing-. case + separately. */ + "[0-9][0-9_]*\\." + "|" + /* Finally come integers. + subexpression 5: text of integer + subexpression 6: if present, type suffix + subexpression 7: allows use of alternation, otherwise uninteresting + */ +#define INT_TEXT 5 +#define INT_TYPE 6 + "(0x[a-fA-F0-9_]+|0o[0-7_]+|0b[01_]+|[0-9][0-9_]*)" + "([iu](size|8|16|32|64))?" + ")"; +/* The number of subexpressions to allocate space for, including the + "0th" whole match subexpression. */ +#define NUM_SUBEXPRESSIONS 8 + +/* The compiled number-matching regex. */ + +static regex_t number_regex; + +/* An instance of this is created before parsing, and destroyed when + parsing is finished. */ + +struct rust_parser +{ + rust_parser (struct parser_state *state) + : rust_ast (nullptr), + pstate (state) + { + } + + ~rust_parser () + { + } + + /* Create a new rust_set_vector. The storage for the new vector is + managed by this class. */ + rust_set_vector *new_set_vector () + { + rust_set_vector *result = new rust_set_vector; + set_vectors.push_back (std::unique_ptr (result)); + return result; + } + + /* Create a new rust_ops_vector. The storage for the new vector is + managed by this class. */ + rust_op_vector *new_op_vector () + { + rust_op_vector *result = new rust_op_vector; + op_vectors.push_back (std::unique_ptr (result)); + return result; + } + + /* Return the parser's language. */ + const struct language_defn *language () const + { + return parse_language (pstate); + } + + /* Return the parser's gdbarch. */ + struct gdbarch *arch () const + { + return parse_gdbarch (pstate); + } + + /* A helper to look up a Rust type, or fail. This only works for + types defined by rust_language_arch_info. */ + + struct type *get_type (const char *name) + { + struct type *type; + + type = language_lookup_primitive_type (language (), arch (), name); + if (type == NULL) + error (_("Could not find Rust type %s"), name); + return type; + } + + const char *copy_name (const char *name, int len); + struct stoken concat3 (const char *s1, const char *s2, const char *s3); + const struct rust_op *crate_name (const struct rust_op *name); + const struct rust_op *super_name (const struct rust_op *ident, + unsigned int n_supers); + + int lex_character (YYSTYPE *lvalp); + int lex_number (YYSTYPE *lvalp); + int lex_string (YYSTYPE *lvalp); + int lex_identifier (YYSTYPE *lvalp); + + struct type *rust_lookup_type (const char *name, const struct block *block); + std::vector convert_params_to_types (rust_op_vector *params); + struct type *convert_ast_to_type (const struct rust_op *operation); + const char *convert_name (const struct rust_op *operation); + void convert_params_to_expression (rust_op_vector *params, + const struct rust_op *top); + void convert_ast_to_expression (const struct rust_op *operation, + const struct rust_op *top, + bool want_type = false); + + struct rust_op *ast_basic_type (enum type_code typecode); + const struct rust_op *ast_operation (enum exp_opcode opcode, + const struct rust_op *left, + const struct rust_op *right); + const struct rust_op *ast_compound_assignment + (enum exp_opcode opcode, const struct rust_op *left, + const struct rust_op *rust_op); + const struct rust_op *ast_literal (struct typed_val_int val); + const struct rust_op *ast_dliteral (struct typed_val_float val); + const struct rust_op *ast_structop (const struct rust_op *left, + const char *name, + int completing); + const struct rust_op *ast_structop_anonymous + (const struct rust_op *left, struct typed_val_int number); + const struct rust_op *ast_unary (enum exp_opcode opcode, + const struct rust_op *expr); + const struct rust_op *ast_cast (const struct rust_op *expr, + const struct rust_op *type); + const struct rust_op *ast_call_ish (enum exp_opcode opcode, + const struct rust_op *expr, + rust_op_vector *params); + const struct rust_op *ast_path (struct stoken name, + rust_op_vector *params); + const struct rust_op *ast_string (struct stoken str); + const struct rust_op *ast_struct (const struct rust_op *name, + rust_set_vector *fields); + const struct rust_op *ast_range (const struct rust_op *lhs, + const struct rust_op *rhs, + bool inclusive); + const struct rust_op *ast_array_type (const struct rust_op *lhs, + struct typed_val_int val); + const struct rust_op *ast_slice_type (const struct rust_op *type); + const struct rust_op *ast_reference_type (const struct rust_op *type); + const struct rust_op *ast_pointer_type (const struct rust_op *type, + int is_mut); + const struct rust_op *ast_function_type (const struct rust_op *result, + rust_op_vector *params); + const struct rust_op *ast_tuple_type (rust_op_vector *params); + + + /* A pointer to this is installed globally. */ + auto_obstack obstack; + + /* Result of parsing. Points into obstack. */ + const struct rust_op *rust_ast; + + /* This keeps track of the various vectors we allocate. */ + std::vector> set_vectors; + std::vector> op_vectors; + + /* The parser state gdb gave us. */ + struct parser_state *pstate; +}; + +/* Rust AST operations. We build a tree of these; then lower them to + gdb expressions when parsing has completed. */ + +struct rust_op +{ + /* The opcode. */ + enum exp_opcode opcode; + /* If OPCODE is OP_TYPE, then this holds information about what type + is described by this node. */ + enum type_code typecode; + /* Indicates whether OPCODE actually represents a compound + assignment. For example, if OPCODE is GTGT and this is false, + then this rust_op represents an ordinary ">>"; but if this is + true, then this rust_op represents ">>=". Unused in other + cases. */ + unsigned int compound_assignment : 1; + /* Only used by a field expression; if set, indicates that the field + name occurred at the end of the expression and is eligible for + completion. */ + unsigned int completing : 1; + /* For OP_RANGE, indicates whether the range is inclusive or + exclusive. */ + unsigned int inclusive : 1; + /* Operands of expression. Which one is used and how depends on the + particular opcode. */ + RUSTSTYPE left; + RUSTSTYPE right; +}; + + +#line 493 "rust-exp.c.tmp" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or xmalloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined xmalloc) \ + && (defined YYFREE || defined xfree))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC xmalloc +# if ! defined xmalloc && ! defined EXIT_SUCCESS +void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE xfree +# if ! defined xfree && ! defined EXIT_SUCCESS +void xfree (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 62 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 1124 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 59 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 35 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 125 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 219 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 290 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 58, 2, 2, 2, 46, 40, 2, + 50, 52, 44, 42, 51, 43, 49, 45, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 55, 57, + 36, 35, 37, 2, 41, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 48, 2, 56, 39, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 53, 38, 54, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 47 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 432, 432, 445, 446, 447, 448, 449, 450, 451, + 452, 453, 454, 456, 457, 458, 462, 470, 487, 492, + 502, 510, 522, 525, 531, 540, 552, 554, 556, 558, + 563, 565, 567, 569, 571, 573, 578, 580, 582, 584, + 612, 614, 623, 635, 637, 642, 647, 652, 655, 658, + 667, 670, 673, 675, 680, 681, 682, 683, 687, 690, + 693, 696, 699, 702, 705, 708, 711, 714, 717, 720, + 723, 726, 729, 732, 735, 738, 741, 746, 751, 756, + 762, 767, 772, 781, 785, 790, 795, 799, 801, 805, + 807, 812, 814, 816, 821, 822, 824, 826, 828, 842, + 844, 850, 852, 860, 861, 863, 865, 867, 881, 883, + 892, 893, 895, 903, 904, 906, 908, 910, 912, 914, + 916, 918, 924, 925, 930, 936 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 0 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "GDBVAR", "IDENT", "COMPLETE", "INTEGER", + "DECIMAL_INTEGER", "STRING", "BYTESTRING", "FLOAT", "COMPOUND_ASSIGN", + "KW_AS", "KW_IF", "KW_TRUE", "KW_FALSE", "KW_SUPER", "KW_SELF", "KW_MUT", + "KW_EXTERN", "KW_CONST", "KW_FN", "KW_SIZEOF", "DOTDOT", "DOTDOTEQ", + "OROR", "ANDAND", "EQEQ", "NOTEQ", "LTEQ", "GTEQ", "LSH", "RSH", + "COLONCOLON", "ARROW", "'='", "'<'", "'>'", "'|'", "'^'", "'&'", "'@'", + "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY", "'['", "'.'", "'('", "','", + "')'", "'{'", "'}'", "':'", "']'", "';'", "'!'", "$accept", "start", + "expr", "tuple_expr", "unit_expr", "struct_expr", "struct_expr_tail", + "struct_expr_list", "array_expr", "range_expr", "literal", "field_expr", + "idx_expr", "unop_expr", "binop_expr", "binop_expr_expr", + "type_cast_expr", "assignment_expr", "compound_assignment_expr", + "paren_expr", "expr_list", "maybe_expr_list", "paren_expr_list", + "call_expr", "maybe_self_path", "super_path", "path_expr", + "path_for_expr", "identifier_path_for_expr", "path_for_type", + "just_identifiers_for_type", "identifier_path_for_type", "type", + "maybe_type_list", "type_list", YY_NULLPTRPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 61, 60, 62, 124, 94, + 38, 64, 43, 45, 42, 47, 37, 290, 91, 46, + 40, 44, 41, 123, 125, 58, 93, 59, 33 +}; +# endif + +#define YYPACT_NINF -181 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-181))) + +#define YYTABLE_NINF -123 + +#define yytable_value_is_error(Yytable_value) \ + (!!((Yytable_value) == (-123))) + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 423, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -18, 19, 8, 158, 423, 19, 211, 423, 423, 423, + 264, 317, 423, 49, 826, -181, -181, -181, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -181, 73, -181, 57, 85, 19, 85, 423, 866, 866, + 85, 423, 84, 84, 84, 84, 423, 463, -25, -181, + 701, 84, -181, 423, 546, 158, 423, 423, 423, 423, + 423, 423, 423, 423, 423, 423, 423, 423, 423, 423, + 423, 423, 423, 423, 423, 423, 423, 423, 90, 370, + -181, 103, 89, 5, -1, 85, 743, 84, 503, -3, + 423, 423, -181, 370, -181, 906, -181, 108, 109, 96, + 109, 551, 122, 546, 87, 73, -181, 63, -181, -181, + 866, 866, 941, 976, 1011, 1011, 1011, 1011, 80, 80, + 906, 1011, 1011, 1032, 1053, 1074, 144, -6, -6, 12, + 12, 12, 581, -181, -181, -181, 826, 97, 95, -181, + 116, 85, -43, 423, -181, 98, -181, 546, -181, 423, + -181, 621, 826, 102, 109, -181, 87, -181, 546, -181, + 546, 546, 93, -181, 105, 100, 99, 154, 546, -181, + -181, -181, 5, 423, 826, -181, -5, 661, -181, -181, + -181, 111, -27, -181, -181, 138, -181, 546, -181, -181, + 13, -181, 785, -181, -181, -181, 135, -181, 114, 115, + -181, -181, -181, 5, 546, -181, -181, -181, -181 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 87, 92, 99, 36, 37, 39, 40, 38, 41, 42, + 93, 0, 0, 35, 87, 0, 87, 87, 87, 87, + 87, 87, 87, 0, 2, 5, 6, 7, 9, 11, + 3, 8, 10, 12, 13, 54, 55, 56, 57, 14, + 15, 0, 4, 91, 94, 88, 98, 87, 33, 34, + 97, 87, 51, 47, 48, 50, 87, 81, 0, 17, + 0, 49, 1, 87, 87, 30, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 0, 83, + 86, 0, 0, 22, 0, 95, 0, 52, 81, 0, + 87, 87, 27, 83, 80, 79, 108, 0, 0, 0, + 0, 87, 0, 87, 87, 0, 113, 110, 103, 77, + 31, 32, 69, 70, 71, 72, 73, 74, 75, 76, + 78, 62, 63, 65, 66, 64, 59, 67, 68, 58, + 60, 61, 0, 43, 44, 45, 81, 84, 0, 89, + 0, 96, 21, 87, 23, 0, 100, 87, 53, 87, + 26, 0, 82, 0, 88, 107, 87, 106, 87, 117, + 87, 87, 0, 124, 0, 123, 0, 0, 87, 46, + 85, 90, 22, 87, 19, 18, 0, 0, 29, 16, + 104, 0, 0, 118, 119, 0, 121, 87, 105, 109, + 0, 25, 20, 102, 101, 28, 0, 116, 0, 0, + 125, 112, 111, 22, 87, 114, 115, 24, 120 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -181, -181, 0, -181, -181, -181, -181, -180, -181, -181, + -181, -181, -181, -181, -181, -181, -181, -181, -181, -181, + -19, 75, -181, -181, -59, 61, -181, -181, -4, -181, + -181, -74, -54, 18, -153 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 23, 146, 25, 26, 27, 154, 155, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 147, 148, 90, 40, 41, 92, 42, 43, 44, 116, + 117, 118, 173, 174, 175 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int16 yytable[] = +{ + 24, 58, 201, 156, 186, 115, 64, 46, 182, 152, + 119, 50, 183, 48, 49, 45, 52, 53, 54, 55, + 57, 60, 61, 2, 64, 200, 101, 203, 153, 207, + 195, 102, 204, 217, 165, 157, 167, 99, 84, 85, + 86, 95, 87, 88, 89, 211, 197, 96, 101, 62, + 212, 97, 115, 160, 115, 115, 98, 169, 47, 172, + 87, 88, 89, 105, 197, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 151, 91, + 190, 106, 64, 2, 143, 144, 177, 145, 115, 178, + 161, 162, 198, 106, 107, 150, 108, 115, 109, 115, + 93, 115, 115, 106, 192, 150, 193, 194, 94, 115, + 110, 81, 82, 83, 84, 85, 86, 111, 87, 88, + 89, 112, 87, 88, 89, 113, 149, 114, 115, -122, + 170, 164, 171, 210, 208, 209, 166, 180, 101, 181, + 195, 197, 185, 184, 189, 115, 64, 196, 199, 187, + 218, 1, 2, 206, 3, 4, 5, 6, 7, 214, + 215, 216, 8, 9, -87, 10, 176, 11, 163, 0, + 12, -123, -123, 202, 191, 0, 82, 83, 84, 85, + 86, 15, 87, 88, 89, 0, 0, 0, 16, 0, + 17, 18, 19, 0, 0, 0, 20, 0, 21, 0, + 0, 0, 0, 0, 1, 2, 22, 3, 4, 5, + 6, 7, 0, 0, 0, 8, 9, 0, 10, 51, + 11, 0, 0, 12, 13, 14, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, + 0, 16, 0, 17, 18, 19, 0, 0, 0, 20, + 0, 21, 0, 0, 0, 0, 0, 1, 2, 22, + 3, 4, 5, 6, 7, 0, 0, 0, 8, 9, + 0, 10, 56, 11, 0, 0, 12, 13, 14, 0, + 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, + 0, 0, 0, 0, 16, 0, 17, 18, 19, 0, + 0, 0, 20, 0, 21, 0, 0, 0, 0, 0, + 1, 2, 22, 3, 4, 5, 6, 7, 0, 0, + 0, 8, 9, 0, 10, 0, 11, 0, 0, 12, + 13, 14, 0, 0, 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 0, 0, 0, 16, 0, 17, + 18, 19, 0, 0, 0, 20, 0, 21, 0, 59, + 0, 0, 0, 1, 2, 22, 3, 4, 5, 6, + 7, 0, 0, 0, 8, 9, -87, 10, 0, 11, + 0, 0, 12, 13, 14, 0, 0, 0, 0, 0, + 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, + 16, 0, 17, 18, 19, 0, 0, 0, 20, 0, + 21, 0, 0, 0, 0, 0, 1, 2, 22, 3, + 4, 5, 6, 7, 0, 0, 0, 8, 9, 0, + 10, 0, 11, 0, 0, 12, 13, 14, 0, 0, + 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, + 0, 0, 0, 16, 0, 17, 18, 19, 0, 0, + 0, 20, 0, 21, 63, 64, 0, 0, 0, 0, + 0, 22, 0, 0, 0, 0, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 0, 0, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 0, 87, 88, 89, 63, 64, 0, 0, 0, 0, + 100, 0, 0, 0, 0, 0, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 0, 0, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 106, 87, 88, 89, 0, 106, 0, 0, 0, 0, + 159, 0, 0, 107, 0, 108, 0, 109, 107, 0, + 108, 0, 109, 0, 0, 0, 0, 0, 0, 110, + 0, 0, 0, 0, 110, 0, 111, 0, 0, 0, + 112, 111, 63, 64, 113, 112, 114, 0, 0, 168, + 0, 114, 0, 0, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 0, 0, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 0, 87, + 88, 89, 63, 64, 0, 0, 0, 179, 0, 0, + 0, 0, 0, 0, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 0, 0, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 0, 87, + 88, 89, 63, 64, 0, 0, 0, 188, 0, 0, + 0, 0, 0, 0, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 0, 0, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 0, 87, + 88, 89, 63, 64, 0, 0, 0, 205, 0, 0, + 0, 0, 0, 0, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 0, 0, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 0, 87, + 88, 89, 103, 104, 63, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 0, 0, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 0, 87, 88, 89, 0, 158, 63, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 0, 0, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 0, 87, 88, 89, 213, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 0, + 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 0, 87, 88, 89, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -123, + -123, 67, 68, 69, 70, 71, 72, 73, 74, 0, + 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 0, 87, 88, 89, 63, 64, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 67, 68, 69, 70, 71, 72, 73, 74, 0, + 0, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 64, 87, 88, 89, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 68, 69, 70, + 71, 72, 73, 74, 0, 0, 0, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 64, 87, + 88, 89, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 69, 70, 71, 72, 73, 74, 0, + 0, 0, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 64, 87, 88, 89, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -123, -123, + -123, -123, 73, 74, 64, 0, 0, -123, -123, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 0, 87, + 88, 89, 0, 73, 74, 64, 0, 0, 0, 0, + 0, 79, 80, 81, 82, 83, 84, 85, 86, 0, + 87, 88, 89, 0, 73, 74, 64, 0, 0, 0, + 0, 0, 0, 80, 81, 82, 83, 84, 85, 86, + 0, 87, 88, 89, 0, 73, 74, 0, 0, 0, + 0, 0, 0, 0, 0, 81, 82, 83, 84, 85, + 86, 0, 87, 88, 89 +}; + +static const yytype_int16 yycheck[] = +{ + 0, 20, 182, 4, 157, 64, 12, 11, 51, 4, + 64, 15, 55, 13, 14, 33, 16, 17, 18, 19, + 20, 21, 22, 4, 12, 178, 51, 32, 23, 56, + 57, 56, 37, 213, 108, 36, 110, 56, 44, 45, + 46, 45, 48, 49, 50, 32, 51, 47, 51, 0, + 37, 51, 111, 56, 113, 114, 56, 111, 50, 113, + 48, 49, 50, 63, 51, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 92, 16, + 164, 4, 12, 4, 4, 5, 33, 7, 157, 36, + 100, 101, 176, 4, 17, 16, 19, 166, 21, 168, + 53, 170, 171, 4, 168, 16, 170, 171, 33, 178, + 33, 41, 42, 43, 44, 45, 46, 40, 48, 49, + 50, 44, 48, 49, 50, 48, 33, 50, 197, 52, + 18, 33, 20, 197, 6, 7, 50, 52, 51, 33, + 57, 51, 54, 153, 52, 214, 12, 52, 4, 159, + 214, 3, 4, 52, 6, 7, 8, 9, 10, 34, + 56, 56, 14, 15, 16, 17, 115, 19, 103, -1, + 22, 23, 24, 183, 166, -1, 42, 43, 44, 45, + 46, 33, 48, 49, 50, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, -1, 48, -1, 50, -1, + -1, -1, -1, -1, 3, 4, 58, 6, 7, 8, + 9, 10, -1, -1, -1, 14, 15, -1, 17, 18, + 19, -1, -1, 22, 23, 24, -1, -1, -1, -1, + -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, -1, 48, + -1, 50, -1, -1, -1, -1, -1, 3, 4, 58, + 6, 7, 8, 9, 10, -1, -1, -1, 14, 15, + -1, 17, 18, 19, -1, -1, 22, 23, 24, -1, + -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, + -1, -1, -1, -1, 40, -1, 42, 43, 44, -1, + -1, -1, 48, -1, 50, -1, -1, -1, -1, -1, + 3, 4, 58, 6, 7, 8, 9, 10, -1, -1, + -1, 14, 15, -1, 17, -1, 19, -1, -1, 22, + 23, 24, -1, -1, -1, -1, -1, -1, -1, -1, + 33, -1, -1, -1, -1, -1, -1, 40, -1, 42, + 43, 44, -1, -1, -1, 48, -1, 50, -1, 52, + -1, -1, -1, 3, 4, 58, 6, 7, 8, 9, + 10, -1, -1, -1, 14, 15, 16, 17, -1, 19, + -1, -1, 22, 23, 24, -1, -1, -1, -1, -1, + -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, + 40, -1, 42, 43, 44, -1, -1, -1, 48, -1, + 50, -1, -1, -1, -1, -1, 3, 4, 58, 6, + 7, 8, 9, 10, -1, -1, -1, 14, 15, -1, + 17, -1, 19, -1, -1, 22, 23, 24, -1, -1, + -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, + -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, + -1, 48, -1, 50, 11, 12, -1, -1, -1, -1, + -1, 58, -1, -1, -1, -1, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, -1, -1, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + -1, 48, 49, 50, 11, 12, -1, -1, -1, -1, + 57, -1, -1, -1, -1, -1, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, -1, -1, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 4, 48, 49, 50, -1, 4, -1, -1, -1, -1, + 57, -1, -1, 17, -1, 19, -1, 21, 17, -1, + 19, -1, 21, -1, -1, -1, -1, -1, -1, 33, + -1, -1, -1, -1, 33, -1, 40, -1, -1, -1, + 44, 40, 11, 12, 48, 44, 50, -1, -1, 48, + -1, 50, -1, -1, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, -1, -1, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, -1, 48, + 49, 50, 11, 12, -1, -1, -1, 56, -1, -1, + -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, -1, -1, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, -1, 48, + 49, 50, 11, 12, -1, -1, -1, 56, -1, -1, + -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, -1, -1, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, -1, 48, + 49, 50, 11, 12, -1, -1, -1, 56, -1, -1, + -1, -1, -1, -1, 23, 24, 25, 26, 27, 28, + 29, 30, 31, 32, -1, -1, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, -1, 48, + 49, 50, 51, 52, 11, 12, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, -1, -1, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + -1, 48, 49, 50, -1, 52, 11, 12, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, -1, -1, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, -1, 48, 49, 50, 51, 11, 12, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, + -1, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, -1, 48, 49, 50, 11, 12, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, + -1, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, -1, 48, 49, 50, 11, 12, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 25, 26, 27, 28, 29, 30, 31, 32, -1, + -1, 35, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 12, 48, 49, 50, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 26, 27, 28, + 29, 30, 31, 32, -1, -1, -1, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 12, 48, + 49, 50, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 27, 28, 29, 30, 31, 32, -1, + -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 45, 46, 12, 48, 49, 50, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 27, 28, + 29, 30, 31, 32, 12, -1, -1, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, -1, 48, + 49, 50, -1, 31, 32, 12, -1, -1, -1, -1, + -1, 39, 40, 41, 42, 43, 44, 45, 46, -1, + 48, 49, 50, -1, 31, 32, 12, -1, -1, -1, + -1, -1, -1, 40, 41, 42, 43, 44, 45, 46, + -1, 48, 49, 50, -1, 31, 32, -1, -1, -1, + -1, -1, -1, -1, -1, 41, 42, 43, 44, 45, + 46, -1, 48, 49, 50 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 4, 6, 7, 8, 9, 10, 14, 15, + 17, 19, 22, 23, 24, 33, 40, 42, 43, 44, + 48, 50, 58, 60, 61, 62, 63, 64, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 82, 83, 85, 86, 87, 33, 87, 50, 61, 61, + 87, 18, 61, 61, 61, 61, 18, 61, 79, 52, + 61, 61, 0, 11, 12, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 48, 49, 50, + 81, 16, 84, 53, 33, 87, 61, 61, 61, 79, + 57, 51, 56, 51, 52, 61, 4, 17, 19, 21, + 33, 40, 44, 48, 50, 83, 88, 89, 90, 91, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 4, 5, 7, 61, 79, 80, 33, + 16, 87, 4, 23, 65, 66, 4, 36, 52, 57, + 56, 61, 61, 80, 33, 90, 50, 90, 48, 91, + 18, 20, 91, 91, 92, 93, 84, 33, 36, 56, + 52, 33, 51, 55, 61, 54, 93, 61, 56, 52, + 90, 92, 91, 91, 91, 57, 52, 51, 90, 4, + 93, 66, 61, 32, 37, 56, 52, 56, 6, 7, + 91, 32, 37, 51, 34, 56, 56, 66, 91 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 59, 60, 61, 61, 61, 61, 61, 61, 61, + 61, 61, 61, 61, 61, 61, 62, 63, 64, 65, + 65, 65, 66, 66, 66, 66, 67, 67, 67, 67, + 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, + 69, 69, 69, 70, 70, 70, 71, 72, 72, 72, + 72, 72, 72, 72, 73, 73, 73, 73, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 74, 74, 75, 76, 77, + 78, 79, 79, 80, 80, 81, 82, 83, 83, 84, + 84, 85, 85, 85, 86, 86, 86, 86, 86, 87, + 87, 87, 87, 88, 88, 88, 88, 88, 89, 89, + 90, 90, 90, 91, 91, 91, 91, 91, 91, 91, + 91, 91, 92, 92, 93, 93 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 5, 2, 4, 2, + 3, 1, 0, 1, 5, 3, 4, 3, 6, 5, + 2, 3, 3, 2, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 3, 3, 4, 2, 2, 2, + 2, 2, 3, 4, 1, 1, 1, 1, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 1, 3, 0, 1, 3, 2, 0, 2, 2, + 3, 1, 1, 1, 1, 3, 3, 2, 2, 1, + 3, 5, 5, 1, 3, 3, 2, 2, 1, 3, + 1, 4, 4, 1, 5, 5, 4, 2, 3, 3, + 6, 3, 0, 1, 1, 3 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (parser, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, parser); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct rust_parser *parser) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (parser); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct rust_parser *parser) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep, parser); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, struct rust_parser *parser) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , parser); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule, parser); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTRPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTRPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTRPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct rust_parser *parser) +{ + YYUSE (yyvaluep); + YYUSE (parser); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (struct rust_parser *parser) +{ +/* The lookahead symbol. */ +int yychar; + + +/* The semantic value of the lookahead symbol. */ +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to xreallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to xreallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (&yylval, parser); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 433 "rust-exp.y" /* yacc.c:1646 */ + { + /* If we are completing and see a valid parse, + rust_ast will already have been set. */ + if (parser->rust_ast == NULL) + parser->rust_ast = (yyvsp[0].op); + } +#line 1922 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 16: +#line 463 "rust-exp.y" /* yacc.c:1646 */ + { + (yyvsp[-1].params)->push_back ((yyvsp[-3].op)); + error (_("Tuple expressions not supported yet")); + } +#line 1931 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 17: +#line 471 "rust-exp.y" /* yacc.c:1646 */ + { + struct typed_val_int val; + + val.type + = (language_lookup_primitive_type + (parser->language (), parser->arch (), + "()")); + val.val = 0; + (yyval.op) = parser->ast_literal (val); + } +#line 1946 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 18: +#line 488 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_struct ((yyvsp[-3].op), (yyvsp[-1].field_inits)); } +#line 1952 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 19: +#line 493 "rust-exp.y" /* yacc.c:1646 */ + { + struct set_field sf; + + sf.name.ptr = NULL; + sf.name.length = 0; + sf.init = (yyvsp[0].op); + + (yyval.one_field_init) = sf; + } +#line 1966 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 20: +#line 503 "rust-exp.y" /* yacc.c:1646 */ + { + struct set_field sf; + + sf.name = (yyvsp[-2].sval); + sf.init = (yyvsp[0].op); + (yyval.one_field_init) = sf; + } +#line 1978 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 21: +#line 511 "rust-exp.y" /* yacc.c:1646 */ + { + struct set_field sf; + + sf.name = (yyvsp[0].sval); + sf.init = parser->ast_path ((yyvsp[0].sval), NULL); + (yyval.one_field_init) = sf; + } +#line 1990 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 22: +#line 522 "rust-exp.y" /* yacc.c:1646 */ + { + (yyval.field_inits) = parser->new_set_vector (); + } +#line 1998 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 23: +#line 526 "rust-exp.y" /* yacc.c:1646 */ + { + rust_set_vector *result = parser->new_set_vector (); + result->push_back ((yyvsp[0].one_field_init)); + (yyval.field_inits) = result; + } +#line 2008 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 24: +#line 532 "rust-exp.y" /* yacc.c:1646 */ + { + struct set_field sf; + + sf.name = (yyvsp[-4].sval); + sf.init = (yyvsp[-2].op); + (yyvsp[0].field_inits)->push_back (sf); + (yyval.field_inits) = (yyvsp[0].field_inits); + } +#line 2021 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 25: +#line 541 "rust-exp.y" /* yacc.c:1646 */ + { + struct set_field sf; + + sf.name = (yyvsp[-2].sval); + sf.init = parser->ast_path ((yyvsp[-2].sval), NULL); + (yyvsp[0].field_inits)->push_back (sf); + (yyval.field_inits) = (yyvsp[0].field_inits); + } +#line 2034 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 26: +#line 553 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_call_ish (OP_ARRAY, NULL, (yyvsp[-1].params)); } +#line 2040 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 27: +#line 555 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_call_ish (OP_ARRAY, NULL, (yyvsp[-1].params)); } +#line 2046 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 28: +#line 557 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (OP_RUST_ARRAY, (yyvsp[-3].op), (yyvsp[-1].op)); } +#line 2052 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 29: +#line 559 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (OP_RUST_ARRAY, (yyvsp[-3].op), (yyvsp[-1].op)); } +#line 2058 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 30: +#line 564 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_range ((yyvsp[-1].op), NULL, false); } +#line 2064 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 31: +#line 566 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_range ((yyvsp[-2].op), (yyvsp[0].op), false); } +#line 2070 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 32: +#line 568 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_range ((yyvsp[-2].op), (yyvsp[0].op), true); } +#line 2076 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 33: +#line 570 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_range (NULL, (yyvsp[0].op), false); } +#line 2082 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 34: +#line 572 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_range (NULL, (yyvsp[0].op), true); } +#line 2088 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 35: +#line 574 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_range (NULL, NULL, false); } +#line 2094 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 36: +#line 579 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_literal ((yyvsp[0].typed_val_int)); } +#line 2100 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 37: +#line 581 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_literal ((yyvsp[0].typed_val_int)); } +#line 2106 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 38: +#line 583 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_dliteral ((yyvsp[0].typed_val_float)); } +#line 2112 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 39: +#line 585 "rust-exp.y" /* yacc.c:1646 */ + { + struct set_field field; + struct typed_val_int val; + struct stoken token; + + rust_set_vector *fields = parser->new_set_vector (); + + /* Wrap the raw string in the &str struct. */ + field.name.ptr = "data_ptr"; + field.name.length = strlen (field.name.ptr); + field.init = parser->ast_unary (UNOP_ADDR, + parser->ast_string ((yyvsp[0].sval))); + fields->push_back (field); + + val.type = parser->get_type ("usize"); + val.val = (yyvsp[0].sval).length; + + field.name.ptr = "length"; + field.name.length = strlen (field.name.ptr); + field.init = parser->ast_literal (val); + fields->push_back (field); + + token.ptr = "&str"; + token.length = strlen (token.ptr); + (yyval.op) = parser->ast_struct (parser->ast_path (token, NULL), + fields); + } +#line 2144 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 40: +#line 613 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_string ((yyvsp[0].sval)); } +#line 2150 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 41: +#line 615 "rust-exp.y" /* yacc.c:1646 */ + { + struct typed_val_int val; + + val.type = language_bool_type (parser->language (), + parser->arch ()); + val.val = 1; + (yyval.op) = parser->ast_literal (val); + } +#line 2163 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 42: +#line 624 "rust-exp.y" /* yacc.c:1646 */ + { + struct typed_val_int val; + + val.type = language_bool_type (parser->language (), + parser->arch ()); + val.val = 0; + (yyval.op) = parser->ast_literal (val); + } +#line 2176 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 43: +#line 636 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_structop ((yyvsp[-2].op), (yyvsp[0].sval).ptr, 0); } +#line 2182 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 44: +#line 638 "rust-exp.y" /* yacc.c:1646 */ + { + (yyval.op) = parser->ast_structop ((yyvsp[-2].op), (yyvsp[0].sval).ptr, 1); + parser->rust_ast = (yyval.op); + } +#line 2191 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 45: +#line 643 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_structop_anonymous ((yyvsp[-2].op), (yyvsp[0].typed_val_int)); } +#line 2197 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 46: +#line 648 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_SUBSCRIPT, (yyvsp[-3].op), (yyvsp[-1].op)); } +#line 2203 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 47: +#line 653 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_unary (UNOP_PLUS, (yyvsp[0].op)); } +#line 2209 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 48: +#line 656 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_unary (UNOP_NEG, (yyvsp[0].op)); } +#line 2215 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 49: +#line 659 "rust-exp.y" /* yacc.c:1646 */ + { + /* Note that we provide a Rust-specific evaluator + override for UNOP_COMPLEMENT, so it can do the + right thing for both bool and integral + values. */ + (yyval.op) = parser->ast_unary (UNOP_COMPLEMENT, (yyvsp[0].op)); + } +#line 2227 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 50: +#line 668 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_unary (UNOP_IND, (yyvsp[0].op)); } +#line 2233 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 51: +#line 671 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_unary (UNOP_ADDR, (yyvsp[0].op)); } +#line 2239 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 52: +#line 674 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_unary (UNOP_ADDR, (yyvsp[0].op)); } +#line 2245 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 53: +#line 676 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_unary (UNOP_SIZEOF, (yyvsp[-1].op)); } +#line 2251 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 58: +#line 688 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_MUL, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2257 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 59: +#line 691 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_REPEAT, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2263 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 60: +#line 694 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_DIV, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2269 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 61: +#line 697 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_REM, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2275 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 62: +#line 700 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_LESS, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2281 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 63: +#line 703 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_GTR, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2287 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 64: +#line 706 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_BITWISE_AND, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2293 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 65: +#line 709 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_BITWISE_IOR, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2299 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 66: +#line 712 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_BITWISE_XOR, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2305 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 67: +#line 715 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_ADD, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2311 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 68: +#line 718 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_SUB, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2317 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 69: +#line 721 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_LOGICAL_OR, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2323 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 70: +#line 724 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_LOGICAL_AND, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2329 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 71: +#line 727 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_EQUAL, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2335 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 72: +#line 730 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_NOTEQUAL, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2341 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 73: +#line 733 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_LEQ, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2347 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 74: +#line 736 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_GEQ, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2353 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 75: +#line 739 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_LSH, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2359 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 76: +#line 742 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_RSH, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2365 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 77: +#line 747 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_cast ((yyvsp[-2].op), (yyvsp[0].op)); } +#line 2371 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 78: +#line 752 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_operation (BINOP_ASSIGN, (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2377 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 79: +#line 757 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_compound_assignment ((yyvsp[-1].opcode), (yyvsp[-2].op), (yyvsp[0].op)); } +#line 2383 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 80: +#line 763 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = (yyvsp[-1].op); } +#line 2389 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 81: +#line 768 "rust-exp.y" /* yacc.c:1646 */ + { + (yyval.params) = parser->new_op_vector (); + (yyval.params)->push_back ((yyvsp[0].op)); + } +#line 2398 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 82: +#line 773 "rust-exp.y" /* yacc.c:1646 */ + { + (yyvsp[-2].params)->push_back ((yyvsp[0].op)); + (yyval.params) = (yyvsp[-2].params); + } +#line 2407 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 83: +#line 781 "rust-exp.y" /* yacc.c:1646 */ + { + /* The result can't be NULL. */ + (yyval.params) = parser->new_op_vector (); + } +#line 2416 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 84: +#line 786 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.params) = (yyvsp[0].params); } +#line 2422 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 85: +#line 791 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.params) = (yyvsp[-1].params); } +#line 2428 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 86: +#line 796 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_call_ish (OP_FUNCALL, (yyvsp[-1].op), (yyvsp[0].params)); } +#line 2434 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 89: +#line 806 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.depth) = 1; } +#line 2440 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 90: +#line 808 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.depth) = (yyvsp[-2].depth) + 1; } +#line 2446 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 91: +#line 813 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = (yyvsp[0].op); } +#line 2452 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 92: +#line 815 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_path ((yyvsp[0].sval), NULL); } +#line 2458 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 93: +#line 817 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_path (make_stoken ("self"), NULL); } +#line 2464 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 95: +#line 823 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->super_name ((yyvsp[0].op), 0); } +#line 2470 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 96: +#line 825 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->super_name ((yyvsp[0].op), (yyvsp[-1].depth)); } +#line 2476 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 97: +#line 827 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->crate_name ((yyvsp[0].op)); } +#line 2482 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 98: +#line 829 "rust-exp.y" /* yacc.c:1646 */ + { + /* This is a gdb extension to make it possible to + refer to items in other crates. It just bypasses + adding the current crate to the front of the + name. */ + (yyval.op) = parser->ast_path (parser->concat3 ("::", + (yyvsp[0].op)->left.sval.ptr, + NULL), + (yyvsp[0].op)->right.params); + } +#line 2497 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 99: +#line 843 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_path ((yyvsp[0].sval), NULL); } +#line 2503 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 100: +#line 845 "rust-exp.y" /* yacc.c:1646 */ + { + (yyval.op) = parser->ast_path (parser->concat3 ((yyvsp[-2].op)->left.sval.ptr, + "::", (yyvsp[0].sval).ptr), + NULL); + } +#line 2513 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 101: +#line 851 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_path ((yyvsp[-4].op)->left.sval, (yyvsp[-1].params)); } +#line 2519 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 102: +#line 853 "rust-exp.y" /* yacc.c:1646 */ + { + (yyval.op) = parser->ast_path ((yyvsp[-4].op)->left.sval, (yyvsp[-1].params)); + rust_push_back ('>'); + } +#line 2528 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 104: +#line 862 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->super_name ((yyvsp[0].op), 0); } +#line 2534 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 105: +#line 864 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->super_name ((yyvsp[0].op), (yyvsp[-1].depth)); } +#line 2540 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 106: +#line 866 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->crate_name ((yyvsp[0].op)); } +#line 2546 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 107: +#line 868 "rust-exp.y" /* yacc.c:1646 */ + { + /* This is a gdb extension to make it possible to + refer to items in other crates. It just bypasses + adding the current crate to the front of the + name. */ + (yyval.op) = parser->ast_path (parser->concat3 ("::", + (yyvsp[0].op)->left.sval.ptr, + NULL), + (yyvsp[0].op)->right.params); + } +#line 2561 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 108: +#line 882 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_path ((yyvsp[0].sval), NULL); } +#line 2567 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 109: +#line 884 "rust-exp.y" /* yacc.c:1646 */ + { + (yyval.op) = parser->ast_path (parser->concat3 ((yyvsp[-2].op)->left.sval.ptr, + "::", (yyvsp[0].sval).ptr), + NULL); + } +#line 2577 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 111: +#line 894 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_path ((yyvsp[-3].op)->left.sval, (yyvsp[-1].params)); } +#line 2583 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 112: +#line 896 "rust-exp.y" /* yacc.c:1646 */ + { + (yyval.op) = parser->ast_path ((yyvsp[-3].op)->left.sval, (yyvsp[-1].params)); + rust_push_back ('>'); + } +#line 2592 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 114: +#line 905 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_array_type ((yyvsp[-3].op), (yyvsp[-1].typed_val_int)); } +#line 2598 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 115: +#line 907 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_array_type ((yyvsp[-3].op), (yyvsp[-1].typed_val_int)); } +#line 2604 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 116: +#line 909 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_slice_type ((yyvsp[-1].op)); } +#line 2610 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 117: +#line 911 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_reference_type ((yyvsp[0].op)); } +#line 2616 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 118: +#line 913 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_pointer_type ((yyvsp[0].op), 1); } +#line 2622 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 119: +#line 915 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_pointer_type ((yyvsp[0].op), 0); } +#line 2628 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 120: +#line 917 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_function_type ((yyvsp[0].op), (yyvsp[-3].params)); } +#line 2634 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 121: +#line 919 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.op) = parser->ast_tuple_type ((yyvsp[-1].params)); } +#line 2640 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 122: +#line 924 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.params) = NULL; } +#line 2646 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 123: +#line 926 "rust-exp.y" /* yacc.c:1646 */ + { (yyval.params) = (yyvsp[0].params); } +#line 2652 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 124: +#line 931 "rust-exp.y" /* yacc.c:1646 */ + { + rust_op_vector *result = parser->new_op_vector (); + result->push_back ((yyvsp[0].op)); + (yyval.params) = result; + } +#line 2662 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + case 125: +#line 937 "rust-exp.y" /* yacc.c:1646 */ + { + (yyvsp[-2].params)->push_back ((yyvsp[0].op)); + (yyval.params) = (yyvsp[-2].params); + } +#line 2671 "rust-exp.c.tmp" /* yacc.c:1646 */ + break; + + +#line 2675 "rust-exp.c.tmp" /* yacc.c:1646 */ + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (parser, YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (parser, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, parser); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp, parser); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (parser, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, parser); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, parser); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 943 "rust-exp.y" /* yacc.c:1906 */ + + +/* A struct of this type is used to describe a token. */ + +struct token_info +{ + const char *name; + int value; + enum exp_opcode opcode; +}; + +/* Identifier tokens. */ + +static const struct token_info identifier_tokens[] = +{ + { "as", KW_AS, OP_NULL }, + { "false", KW_FALSE, OP_NULL }, + { "if", 0, OP_NULL }, + { "mut", KW_MUT, OP_NULL }, + { "const", KW_CONST, OP_NULL }, + { "self", KW_SELF, OP_NULL }, + { "super", KW_SUPER, OP_NULL }, + { "true", KW_TRUE, OP_NULL }, + { "extern", KW_EXTERN, OP_NULL }, + { "fn", KW_FN, OP_NULL }, + { "sizeof", KW_SIZEOF, OP_NULL }, +}; + +/* Operator tokens, sorted longest first. */ + +static const struct token_info operator_tokens[] = +{ + { ">>=", COMPOUND_ASSIGN, BINOP_RSH }, + { "<<=", COMPOUND_ASSIGN, BINOP_LSH }, + + { "<<", LSH, OP_NULL }, + { ">>", RSH, OP_NULL }, + { "&&", ANDAND, OP_NULL }, + { "||", OROR, OP_NULL }, + { "==", EQEQ, OP_NULL }, + { "!=", NOTEQ, OP_NULL }, + { "<=", LTEQ, OP_NULL }, + { ">=", GTEQ, OP_NULL }, + { "+=", COMPOUND_ASSIGN, BINOP_ADD }, + { "-=", COMPOUND_ASSIGN, BINOP_SUB }, + { "*=", COMPOUND_ASSIGN, BINOP_MUL }, + { "/=", COMPOUND_ASSIGN, BINOP_DIV }, + { "%=", COMPOUND_ASSIGN, BINOP_REM }, + { "&=", COMPOUND_ASSIGN, BINOP_BITWISE_AND }, + { "|=", COMPOUND_ASSIGN, BINOP_BITWISE_IOR }, + { "^=", COMPOUND_ASSIGN, BINOP_BITWISE_XOR }, + { "..=", DOTDOTEQ, OP_NULL }, + + { "::", COLONCOLON, OP_NULL }, + { "..", DOTDOT, OP_NULL }, + { "->", ARROW, OP_NULL } +}; + +/* Helper function to copy to the name obstack. */ + +const char * +rust_parser::copy_name (const char *name, int len) +{ + return (const char *) obstack_copy0 (&obstack, name, len); +} + +/* Helper function to make an stoken from a C string. */ + +static struct stoken +make_stoken (const char *p) +{ + struct stoken result; + + result.ptr = p; + result.length = strlen (result.ptr); + return result; +} + +/* Helper function to concatenate three strings on the name + obstack. */ + +struct stoken +rust_parser::concat3 (const char *s1, const char *s2, const char *s3) +{ + return make_stoken (obconcat (&obstack, s1, s2, s3, (char *) NULL)); +} + +/* Return an AST node referring to NAME, but relative to the crate's + name. */ + +const struct rust_op * +rust_parser::crate_name (const struct rust_op *name) +{ + std::string crate = rust_crate_for_block (expression_context_block); + struct stoken result; + + gdb_assert (name->opcode == OP_VAR_VALUE); + + if (crate.empty ()) + error (_("Could not find crate for current location")); + result = make_stoken (obconcat (&obstack, "::", crate.c_str (), "::", + name->left.sval.ptr, (char *) NULL)); + + return ast_path (result, name->right.params); +} + +/* Create an AST node referring to a "super::" qualified name. IDENT + is the base name and N_SUPERS is how many "super::"s were + provided. N_SUPERS can be zero. */ + +const struct rust_op * +rust_parser::super_name (const struct rust_op *ident, unsigned int n_supers) +{ + const char *scope = block_scope (expression_context_block); + int offset; + + gdb_assert (ident->opcode == OP_VAR_VALUE); + + if (scope[0] == '\0') + error (_("Couldn't find namespace scope for self::")); + + if (n_supers > 0) + { + int len; + std::vector offsets; + unsigned int current_len; + + current_len = cp_find_first_component (scope); + while (scope[current_len] != '\0') + { + offsets.push_back (current_len); + gdb_assert (scope[current_len] == ':'); + /* The "::". */ + current_len += 2; + current_len += cp_find_first_component (scope + + current_len); + } + + len = offsets.size (); + if (n_supers >= len) + error (_("Too many super:: uses from '%s'"), scope); + + offset = offsets[len - n_supers]; + } + else + offset = strlen (scope); + + obstack_grow (&obstack, "::", 2); + obstack_grow (&obstack, scope, offset); + obstack_grow (&obstack, "::", 2); + obstack_grow0 (&obstack, ident->left.sval.ptr, ident->left.sval.length); + + return ast_path (make_stoken ((const char *) obstack_finish (&obstack)), + ident->right.params); +} + +/* A helper that updates the innermost block as appropriate. */ + +static void +update_innermost_block (struct block_symbol sym) +{ + if (symbol_read_needs_frame (sym.symbol)) + innermost_block.update (sym); +} + +/* Lex a hex number with at least MIN digits and at most MAX + digits. */ + +static uint32_t +lex_hex (int min, int max) +{ + uint32_t result = 0; + int len = 0; + /* We only want to stop at MAX if we're lexing a byte escape. */ + int check_max = min == max; + + while ((check_max ? len <= max : 1) + && ((lexptr[0] >= 'a' && lexptr[0] <= 'f') + || (lexptr[0] >= 'A' && lexptr[0] <= 'F') + || (lexptr[0] >= '0' && lexptr[0] <= '9'))) + { + result *= 16; + if (lexptr[0] >= 'a' && lexptr[0] <= 'f') + result = result + 10 + lexptr[0] - 'a'; + else if (lexptr[0] >= 'A' && lexptr[0] <= 'F') + result = result + 10 + lexptr[0] - 'A'; + else + result = result + lexptr[0] - '0'; + ++lexptr; + ++len; + } + + if (len < min) + error (_("Not enough hex digits seen")); + if (len > max) + { + gdb_assert (min != max); + error (_("Overlong hex escape")); + } + + return result; +} + +/* Lex an escape. IS_BYTE is true if we're lexing a byte escape; + otherwise we're lexing a character escape. */ + +static uint32_t +lex_escape (int is_byte) +{ + uint32_t result; + + gdb_assert (lexptr[0] == '\\'); + ++lexptr; + switch (lexptr[0]) + { + case 'x': + ++lexptr; + result = lex_hex (2, 2); + break; + + case 'u': + if (is_byte) + error (_("Unicode escape in byte literal")); + ++lexptr; + if (lexptr[0] != '{') + error (_("Missing '{' in Unicode escape")); + ++lexptr; + result = lex_hex (1, 6); + /* Could do range checks here. */ + if (lexptr[0] != '}') + error (_("Missing '}' in Unicode escape")); + ++lexptr; + break; + + case 'n': + result = '\n'; + ++lexptr; + break; + case 'r': + result = '\r'; + ++lexptr; + break; + case 't': + result = '\t'; + ++lexptr; + break; + case '\\': + result = '\\'; + ++lexptr; + break; + case '0': + result = '\0'; + ++lexptr; + break; + case '\'': + result = '\''; + ++lexptr; + break; + case '"': + result = '"'; + ++lexptr; + break; + + default: + error (_("Invalid escape \\%c in literal"), lexptr[0]); + } + + return result; +} + +/* Lex a character constant. */ + +int +rust_parser::lex_character (YYSTYPE *lvalp) +{ + int is_byte = 0; + uint32_t value; + + if (lexptr[0] == 'b') + { + is_byte = 1; + ++lexptr; + } + gdb_assert (lexptr[0] == '\''); + ++lexptr; + /* This should handle UTF-8 here. */ + if (lexptr[0] == '\\') + value = lex_escape (is_byte); + else + { + value = lexptr[0] & 0xff; + ++lexptr; + } + + if (lexptr[0] != '\'') + error (_("Unterminated character literal")); + ++lexptr; + + lvalp->typed_val_int.val = value; + lvalp->typed_val_int.type = get_type (is_byte ? "u8" : "char"); + + return INTEGER; +} + +/* Return the offset of the double quote if STR looks like the start + of a raw string, or 0 if STR does not start a raw string. */ + +static int +starts_raw_string (const char *str) +{ + const char *save = str; + + if (str[0] != 'r') + return 0; + ++str; + while (str[0] == '#') + ++str; + if (str[0] == '"') + return str - save; + return 0; +} + +/* Return true if STR looks like the end of a raw string that had N + hashes at the start. */ + +static bool +ends_raw_string (const char *str, int n) +{ + int i; + + gdb_assert (str[0] == '"'); + for (i = 0; i < n; ++i) + if (str[i + 1] != '#') + return false; + return true; +} + +/* Lex a string constant. */ + +int +rust_parser::lex_string (YYSTYPE *lvalp) +{ + int is_byte = lexptr[0] == 'b'; + int raw_length; + + if (is_byte) + ++lexptr; + raw_length = starts_raw_string (lexptr); + lexptr += raw_length; + gdb_assert (lexptr[0] == '"'); + ++lexptr; + + while (1) + { + uint32_t value; + + if (raw_length > 0) + { + if (lexptr[0] == '"' && ends_raw_string (lexptr, raw_length - 1)) + { + /* Exit with lexptr pointing after the final "#". */ + lexptr += raw_length; + break; + } + else if (lexptr[0] == '\0') + error (_("Unexpected EOF in string")); + + value = lexptr[0] & 0xff; + if (is_byte && value > 127) + error (_("Non-ASCII value in raw byte string")); + obstack_1grow (&obstack, value); + + ++lexptr; + } + else if (lexptr[0] == '"') + { + /* Make sure to skip the quote. */ + ++lexptr; + break; + } + else if (lexptr[0] == '\\') + { + value = lex_escape (is_byte); + + if (is_byte) + obstack_1grow (&obstack, value); + else + convert_between_encodings ("UTF-32", "UTF-8", (gdb_byte *) &value, + sizeof (value), sizeof (value), + &obstack, translit_none); + } + else if (lexptr[0] == '\0') + error (_("Unexpected EOF in string")); + else + { + value = lexptr[0] & 0xff; + if (is_byte && value > 127) + error (_("Non-ASCII value in byte string")); + obstack_1grow (&obstack, value); + ++lexptr; + } + } + + lvalp->sval.length = obstack_object_size (&obstack); + lvalp->sval.ptr = (const char *) obstack_finish (&obstack); + return is_byte ? BYTESTRING : STRING; +} + +/* Return true if STRING starts with whitespace followed by a digit. */ + +static bool +space_then_number (const char *string) +{ + const char *p = string; + + while (p[0] == ' ' || p[0] == '\t') + ++p; + if (p == string) + return false; + + return *p >= '0' && *p <= '9'; +} + +/* Return true if C can start an identifier. */ + +static bool +rust_identifier_start_p (char c) +{ + return ((c >= 'a' && c <= 'z') + || (c >= 'A' && c <= 'Z') + || c == '_' + || c == '$'); +} + +/* Lex an identifier. */ + +int +rust_parser::lex_identifier (YYSTYPE *lvalp) +{ + const char *start = lexptr; + unsigned int length; + const struct token_info *token; + int i; + int is_gdb_var = lexptr[0] == '$'; + + gdb_assert (rust_identifier_start_p (lexptr[0])); + + ++lexptr; + + /* For the time being this doesn't handle Unicode rules. Non-ASCII + identifiers are gated anyway. */ + while ((lexptr[0] >= 'a' && lexptr[0] <= 'z') + || (lexptr[0] >= 'A' && lexptr[0] <= 'Z') + || lexptr[0] == '_' + || (is_gdb_var && lexptr[0] == '$') + || (lexptr[0] >= '0' && lexptr[0] <= '9')) + ++lexptr; + + + length = lexptr - start; + token = NULL; + for (i = 0; i < ARRAY_SIZE (identifier_tokens); ++i) + { + if (length == strlen (identifier_tokens[i].name) + && strncmp (identifier_tokens[i].name, start, length) == 0) + { + token = &identifier_tokens[i]; + break; + } + } + + if (token != NULL) + { + if (token->value == 0) + { + /* Leave the terminating token alone. */ + lexptr = start; + return 0; + } + } + else if (token == NULL + && (strncmp (start, "thread", length) == 0 + || strncmp (start, "task", length) == 0) + && space_then_number (lexptr)) + { + /* "task" or "thread" followed by a number terminates the + parse, per gdb rules. */ + lexptr = start; + return 0; + } + + if (token == NULL || (parse_completion && lexptr[0] == '\0')) + lvalp->sval = make_stoken (copy_name (start, length)); + + if (parse_completion && lexptr[0] == '\0') + { + /* Prevent rustyylex from returning two COMPLETE tokens. */ + prev_lexptr = lexptr; + return COMPLETE; + } + + if (token != NULL) + return token->value; + if (is_gdb_var) + return GDBVAR; + return IDENT; +} + +/* Lex an operator. */ + +static int +lex_operator (YYSTYPE *lvalp) +{ + const struct token_info *token = NULL; + int i; + + for (i = 0; i < ARRAY_SIZE (operator_tokens); ++i) + { + if (strncmp (operator_tokens[i].name, lexptr, + strlen (operator_tokens[i].name)) == 0) + { + lexptr += strlen (operator_tokens[i].name); + token = &operator_tokens[i]; + break; + } + } + + if (token != NULL) + { + lvalp->opcode = token->opcode; + return token->value; + } + + return *lexptr++; +} + +/* Lex a number. */ + +int +rust_parser::lex_number (YYSTYPE *lvalp) +{ + regmatch_t subexps[NUM_SUBEXPRESSIONS]; + int match; + int is_integer = 0; + int could_be_decimal = 1; + int implicit_i32 = 0; + const char *type_name = NULL; + struct type *type; + int end_index; + int type_index = -1; + int i; + + match = regexec (&number_regex, lexptr, ARRAY_SIZE (subexps), subexps, 0); + /* Failure means the regexp is broken. */ + gdb_assert (match == 0); + + if (subexps[INT_TEXT].rm_so != -1) + { + /* Integer part matched. */ + is_integer = 1; + end_index = subexps[INT_TEXT].rm_eo; + if (subexps[INT_TYPE].rm_so == -1) + { + type_name = "i32"; + implicit_i32 = 1; + } + else + { + type_index = INT_TYPE; + could_be_decimal = 0; + } + } + else if (subexps[FLOAT_TYPE1].rm_so != -1) + { + /* Found floating point type suffix. */ + end_index = subexps[FLOAT_TYPE1].rm_so; + type_index = FLOAT_TYPE1; + } + else if (subexps[FLOAT_TYPE2].rm_so != -1) + { + /* Found floating point type suffix. */ + end_index = subexps[FLOAT_TYPE2].rm_so; + type_index = FLOAT_TYPE2; + } + else + { + /* Any other floating point match. */ + end_index = subexps[0].rm_eo; + type_name = "f64"; + } + + /* We need a special case if the final character is ".". In this + case we might need to parse an integer. For example, "23.f()" is + a request for a trait method call, not a syntax error involving + the floating point number "23.". */ + gdb_assert (subexps[0].rm_eo > 0); + if (lexptr[subexps[0].rm_eo - 1] == '.') + { + const char *next = skip_spaces (&lexptr[subexps[0].rm_eo]); + + if (rust_identifier_start_p (*next) || *next == '.') + { + --subexps[0].rm_eo; + is_integer = 1; + end_index = subexps[0].rm_eo; + type_name = "i32"; + could_be_decimal = 1; + implicit_i32 = 1; + } + } + + /* Compute the type name if we haven't already. */ + std::string type_name_holder; + if (type_name == NULL) + { + gdb_assert (type_index != -1); + type_name_holder = std::string (lexptr + subexps[type_index].rm_so, + (subexps[type_index].rm_eo + - subexps[type_index].rm_so)); + type_name = type_name_holder.c_str (); + } + + /* Look up the type. */ + type = get_type (type_name); + + /* Copy the text of the number and remove the "_"s. */ + std::string number; + for (i = 0; i < end_index && lexptr[i]; ++i) + { + if (lexptr[i] == '_') + could_be_decimal = 0; + else + number.push_back (lexptr[i]); + } + + /* Advance past the match. */ + lexptr += subexps[0].rm_eo; + + /* Parse the number. */ + if (is_integer) + { + uint64_t value; + int radix = 10; + int offset = 0; + + if (number[0] == '0') + { + if (number[1] == 'x') + radix = 16; + else if (number[1] == 'o') + radix = 8; + else if (number[1] == 'b') + radix = 2; + if (radix != 10) + { + offset = 2; + could_be_decimal = 0; + } + } + + value = strtoul (number.c_str () + offset, NULL, radix); + if (implicit_i32 && value >= ((uint64_t) 1) << 31) + type = get_type ("i64"); + + lvalp->typed_val_int.val = value; + lvalp->typed_val_int.type = type; + } + else + { + lvalp->typed_val_float.type = type; + bool parsed = parse_float (number.c_str (), number.length (), + lvalp->typed_val_float.type, + lvalp->typed_val_float.val); + gdb_assert (parsed); + } + + return is_integer ? (could_be_decimal ? DECIMAL_INTEGER : INTEGER) : FLOAT; +} + +/* The lexer. */ + +static int +rustyylex (YYSTYPE *lvalp, rust_parser *parser) +{ + /* Skip all leading whitespace. */ + while (lexptr[0] == ' ' || lexptr[0] == '\t' || lexptr[0] == '\r' + || lexptr[0] == '\n') + ++lexptr; + + /* If we hit EOF and we're completing, then return COMPLETE -- maybe + we're completing an empty string at the end of a field_expr. + But, we don't want to return two COMPLETE tokens in a row. */ + if (lexptr[0] == '\0' && lexptr == prev_lexptr) + return 0; + prev_lexptr = lexptr; + if (lexptr[0] == '\0') + { + if (parse_completion) + { + lvalp->sval = make_stoken (""); + return COMPLETE; + } + return 0; + } + + if (lexptr[0] >= '0' && lexptr[0] <= '9') + return parser->lex_number (lvalp); + else if (lexptr[0] == 'b' && lexptr[1] == '\'') + return parser->lex_character (lvalp); + else if (lexptr[0] == 'b' && lexptr[1] == '"') + return parser->lex_string (lvalp); + else if (lexptr[0] == 'b' && starts_raw_string (lexptr + 1)) + return parser->lex_string (lvalp); + else if (starts_raw_string (lexptr)) + return parser->lex_string (lvalp); + else if (rust_identifier_start_p (lexptr[0])) + return parser->lex_identifier (lvalp); + else if (lexptr[0] == '"') + return parser->lex_string (lvalp); + else if (lexptr[0] == '\'') + return parser->lex_character (lvalp); + else if (lexptr[0] == '}' || lexptr[0] == ']') + { + /* Falls through to lex_operator. */ + --paren_depth; + } + else if (lexptr[0] == '(' || lexptr[0] == '{') + { + /* Falls through to lex_operator. */ + ++paren_depth; + } + else if (lexptr[0] == ',' && comma_terminates && paren_depth == 0) + return 0; + + return lex_operator (lvalp); +} + +/* Push back a single character to be re-lexed. */ + +static void +rust_push_back (char c) +{ + /* Can't be called before any lexing. */ + gdb_assert (prev_lexptr != NULL); + + --lexptr; + gdb_assert (*lexptr == c); +} + + + +/* Make an arbitrary operation and fill in the fields. */ + +const struct rust_op * +rust_parser::ast_operation (enum exp_opcode opcode, const struct rust_op *left, + const struct rust_op *right) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = opcode; + result->left.op = left; + result->right.op = right; + + return result; +} + +/* Make a compound assignment operation. */ + +const struct rust_op * +rust_parser::ast_compound_assignment (enum exp_opcode opcode, + const struct rust_op *left, + const struct rust_op *right) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = opcode; + result->compound_assignment = 1; + result->left.op = left; + result->right.op = right; + + return result; +} + +/* Make a typed integer literal operation. */ + +const struct rust_op * +rust_parser::ast_literal (struct typed_val_int val) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = OP_LONG; + result->left.typed_val_int = val; + + return result; +} + +/* Make a typed floating point literal operation. */ + +const struct rust_op * +rust_parser::ast_dliteral (struct typed_val_float val) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = OP_FLOAT; + result->left.typed_val_float = val; + + return result; +} + +/* Make a unary operation. */ + +const struct rust_op * +rust_parser::ast_unary (enum exp_opcode opcode, const struct rust_op *expr) +{ + return ast_operation (opcode, expr, NULL); +} + +/* Make a cast operation. */ + +const struct rust_op * +rust_parser::ast_cast (const struct rust_op *expr, const struct rust_op *type) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = UNOP_CAST; + result->left.op = expr; + result->right.op = type; + + return result; +} + +/* Make a call-like operation. This is nominally a function call, but + when lowering we may discover that it actually represents the + creation of a tuple struct. */ + +const struct rust_op * +rust_parser::ast_call_ish (enum exp_opcode opcode, const struct rust_op *expr, + rust_op_vector *params) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = opcode; + result->left.op = expr; + result->right.params = params; + + return result; +} + +/* Make a structure creation operation. */ + +const struct rust_op * +rust_parser::ast_struct (const struct rust_op *name, rust_set_vector *fields) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = OP_AGGREGATE; + result->left.op = name; + result->right.field_inits = fields; + + return result; +} + +/* Make an identifier path. */ + +const struct rust_op * +rust_parser::ast_path (struct stoken path, rust_op_vector *params) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = OP_VAR_VALUE; + result->left.sval = path; + result->right.params = params; + + return result; +} + +/* Make a string constant operation. */ + +const struct rust_op * +rust_parser::ast_string (struct stoken str) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = OP_STRING; + result->left.sval = str; + + return result; +} + +/* Make a field expression. */ + +const struct rust_op * +rust_parser::ast_structop (const struct rust_op *left, const char *name, + int completing) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = STRUCTOP_STRUCT; + result->completing = completing; + result->left.op = left; + result->right.sval = make_stoken (name); + + return result; +} + +/* Make an anonymous struct operation, like 'x.0'. */ + +const struct rust_op * +rust_parser::ast_structop_anonymous (const struct rust_op *left, + struct typed_val_int number) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = STRUCTOP_ANONYMOUS; + result->left.op = left; + result->right.typed_val_int = number; + + return result; +} + +/* Make a range operation. */ + +const struct rust_op * +rust_parser::ast_range (const struct rust_op *lhs, const struct rust_op *rhs, + bool inclusive) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = OP_RANGE; + result->inclusive = inclusive; + result->left.op = lhs; + result->right.op = rhs; + + return result; +} + +/* A helper function to make a type-related AST node. */ + +struct rust_op * +rust_parser::ast_basic_type (enum type_code typecode) +{ + struct rust_op *result = OBSTACK_ZALLOC (&obstack, struct rust_op); + + result->opcode = OP_TYPE; + result->typecode = typecode; + return result; +} + +/* Create an AST node describing an array type. */ + +const struct rust_op * +rust_parser::ast_array_type (const struct rust_op *lhs, + struct typed_val_int val) +{ + struct rust_op *result = ast_basic_type (TYPE_CODE_ARRAY); + + result->left.op = lhs; + result->right.typed_val_int = val; + return result; +} + +/* Create an AST node describing a reference type. */ + +const struct rust_op * +rust_parser::ast_slice_type (const struct rust_op *type) +{ + /* Use TYPE_CODE_COMPLEX just because it is handy. */ + struct rust_op *result = ast_basic_type (TYPE_CODE_COMPLEX); + + result->left.op = type; + return result; +} + +/* Create an AST node describing a reference type. */ + +const struct rust_op * +rust_parser::ast_reference_type (const struct rust_op *type) +{ + struct rust_op *result = ast_basic_type (TYPE_CODE_REF); + + result->left.op = type; + return result; +} + +/* Create an AST node describing a pointer type. */ + +const struct rust_op * +rust_parser::ast_pointer_type (const struct rust_op *type, int is_mut) +{ + struct rust_op *result = ast_basic_type (TYPE_CODE_PTR); + + result->left.op = type; + /* For the time being we ignore is_mut. */ + return result; +} + +/* Create an AST node describing a function type. */ + +const struct rust_op * +rust_parser::ast_function_type (const struct rust_op *rtype, + rust_op_vector *params) +{ + struct rust_op *result = ast_basic_type (TYPE_CODE_FUNC); + + result->left.op = rtype; + result->right.params = params; + return result; +} + +/* Create an AST node describing a tuple type. */ + +const struct rust_op * +rust_parser::ast_tuple_type (rust_op_vector *params) +{ + struct rust_op *result = ast_basic_type (TYPE_CODE_STRUCT); + + result->left.params = params; + return result; +} + +/* A helper to appropriately munge NAME and BLOCK depending on the + presence of a leading "::". */ + +static void +munge_name_and_block (const char **name, const struct block **block) +{ + /* If it is a global reference, skip the current block in favor of + the static block. */ + if (strncmp (*name, "::", 2) == 0) + { + *name += 2; + *block = block_static_block (*block); + } +} + +/* Like lookup_symbol, but handles Rust namespace conventions, and + doesn't require field_of_this_result. */ + +static struct block_symbol +rust_lookup_symbol (const char *name, const struct block *block, + const domain_enum domain) +{ + struct block_symbol result; + + munge_name_and_block (&name, &block); + + result = lookup_symbol (name, block, domain, NULL); + if (result.symbol != NULL) + update_innermost_block (result); + return result; +} + +/* Look up a type, following Rust namespace conventions. */ + +struct type * +rust_parser::rust_lookup_type (const char *name, const struct block *block) +{ + struct block_symbol result; + struct type *type; + + munge_name_and_block (&name, &block); + + result = lookup_symbol (name, block, STRUCT_DOMAIN, NULL); + if (result.symbol != NULL) + { + update_innermost_block (result); + return SYMBOL_TYPE (result.symbol); + } + + type = lookup_typename (language (), arch (), name, NULL, 1); + if (type != NULL) + return type; + + /* Last chance, try a built-in type. */ + return language_lookup_primitive_type (language (), arch (), name); +} + +/* Convert a vector of rust_ops representing types to a vector of + types. */ + +std::vector +rust_parser::convert_params_to_types (rust_op_vector *params) +{ + std::vector result; + + if (params != nullptr) + { + for (const rust_op *op : *params) + result.push_back (convert_ast_to_type (op)); + } + + return result; +} + +/* Convert a rust_op representing a type to a struct type *. */ + +struct type * +rust_parser::convert_ast_to_type (const struct rust_op *operation) +{ + struct type *type, *result = NULL; + + if (operation->opcode == OP_VAR_VALUE) + { + const char *varname = convert_name (operation); + + result = rust_lookup_type (varname, expression_context_block); + if (result == NULL) + error (_("No typed name '%s' in current context"), varname); + return result; + } + + gdb_assert (operation->opcode == OP_TYPE); + + switch (operation->typecode) + { + case TYPE_CODE_ARRAY: + type = convert_ast_to_type (operation->left.op); + if (operation->right.typed_val_int.val < 0) + error (_("Negative array length")); + result = lookup_array_range_type (type, 0, + operation->right.typed_val_int.val - 1); + break; + + case TYPE_CODE_COMPLEX: + { + struct type *usize = get_type ("usize"); + + type = convert_ast_to_type (operation->left.op); + result = rust_slice_type ("&[*gdb*]", type, usize); + } + break; + + case TYPE_CODE_REF: + case TYPE_CODE_PTR: + /* For now we treat &x and *x identically. */ + type = convert_ast_to_type (operation->left.op); + result = lookup_pointer_type (type); + break; + + case TYPE_CODE_FUNC: + { + std::vector args + (convert_params_to_types (operation->right.params)); + struct type **argtypes = NULL; + + type = convert_ast_to_type (operation->left.op); + if (!args.empty ()) + argtypes = args.data (); + + result + = lookup_function_type_with_arguments (type, args.size (), + argtypes); + result = lookup_pointer_type (result); + } + break; + + case TYPE_CODE_STRUCT: + { + std::vector args + (convert_params_to_types (operation->left.params)); + int i; + const char *name; + + obstack_1grow (&obstack, '('); + for (i = 0; i < args.size (); ++i) + { + std::string type_name = type_to_string (args[i]); + + if (i > 0) + obstack_1grow (&obstack, ','); + obstack_grow_str (&obstack, type_name.c_str ()); + } + + obstack_grow_str0 (&obstack, ")"); + name = (const char *) obstack_finish (&obstack); + + /* We don't allow creating new tuple types (yet), but we do + allow looking up existing tuple types. */ + result = rust_lookup_type (name, expression_context_block); + if (result == NULL) + error (_("could not find tuple type '%s'"), name); + } + break; + + default: + gdb_assert_not_reached ("unhandled opcode in convert_ast_to_type"); + } + + gdb_assert (result != NULL); + return result; +} + +/* A helper function to turn a rust_op representing a name into a full + name. This applies generic arguments as needed. The returned name + is allocated on the work obstack. */ + +const char * +rust_parser::convert_name (const struct rust_op *operation) +{ + int i; + + gdb_assert (operation->opcode == OP_VAR_VALUE); + + if (operation->right.params == NULL) + return operation->left.sval.ptr; + + std::vector types + (convert_params_to_types (operation->right.params)); + + obstack_grow_str (&obstack, operation->left.sval.ptr); + obstack_1grow (&obstack, '<'); + for (i = 0; i < types.size (); ++i) + { + std::string type_name = type_to_string (types[i]); + + if (i > 0) + obstack_1grow (&obstack, ','); + + obstack_grow_str (&obstack, type_name.c_str ()); + } + obstack_grow_str0 (&obstack, ">"); + + return (const char *) obstack_finish (&obstack); +} + +/* A helper function that converts a vec of rust_ops to a gdb + expression. */ + +void +rust_parser::convert_params_to_expression (rust_op_vector *params, + const struct rust_op *top) +{ + for (const rust_op *elem : *params) + convert_ast_to_expression (elem, top); +} + +/* Lower a rust_op to a gdb expression. STATE is the parser state. + OPERATION is the operation to lower. TOP is a pointer to the + top-most operation; it is used to handle the special case where the + top-most expression is an identifier and can be optionally lowered + to OP_TYPE. WANT_TYPE is a flag indicating that, if the expression + is the name of a type, then emit an OP_TYPE for it (rather than + erroring). If WANT_TYPE is set, then the similar TOP handling is + not done. */ + +void +rust_parser::convert_ast_to_expression (const struct rust_op *operation, + const struct rust_op *top, + bool want_type) +{ + switch (operation->opcode) + { + case OP_LONG: + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, operation->left.typed_val_int.type); + write_exp_elt_longcst (pstate, operation->left.typed_val_int.val); + write_exp_elt_opcode (pstate, OP_LONG); + break; + + case OP_FLOAT: + write_exp_elt_opcode (pstate, OP_FLOAT); + write_exp_elt_type (pstate, operation->left.typed_val_float.type); + write_exp_elt_floatcst (pstate, operation->left.typed_val_float.val); + write_exp_elt_opcode (pstate, OP_FLOAT); + break; + + case STRUCTOP_STRUCT: + { + convert_ast_to_expression (operation->left.op, top); + + if (operation->completing) + mark_struct_expression (pstate); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + write_exp_string (pstate, operation->right.sval); + write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); + } + break; + + case STRUCTOP_ANONYMOUS: + { + convert_ast_to_expression (operation->left.op, top); + + write_exp_elt_opcode (pstate, STRUCTOP_ANONYMOUS); + write_exp_elt_longcst (pstate, operation->right.typed_val_int.val); + write_exp_elt_opcode (pstate, STRUCTOP_ANONYMOUS); + } + break; + + case UNOP_SIZEOF: + convert_ast_to_expression (operation->left.op, top, true); + write_exp_elt_opcode (pstate, UNOP_SIZEOF); + break; + + case UNOP_PLUS: + case UNOP_NEG: + case UNOP_COMPLEMENT: + case UNOP_IND: + case UNOP_ADDR: + convert_ast_to_expression (operation->left.op, top); + write_exp_elt_opcode (pstate, operation->opcode); + break; + + case BINOP_SUBSCRIPT: + case BINOP_MUL: + case BINOP_REPEAT: + case BINOP_DIV: + case BINOP_REM: + case BINOP_LESS: + case BINOP_GTR: + case BINOP_BITWISE_AND: + case BINOP_BITWISE_IOR: + case BINOP_BITWISE_XOR: + case BINOP_ADD: + case BINOP_SUB: + case BINOP_LOGICAL_OR: + case BINOP_LOGICAL_AND: + case BINOP_EQUAL: + case BINOP_NOTEQUAL: + case BINOP_LEQ: + case BINOP_GEQ: + case BINOP_LSH: + case BINOP_RSH: + case BINOP_ASSIGN: + case OP_RUST_ARRAY: + convert_ast_to_expression (operation->left.op, top); + convert_ast_to_expression (operation->right.op, top); + if (operation->compound_assignment) + { + write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); + write_exp_elt_opcode (pstate, operation->opcode); + write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); + } + else + write_exp_elt_opcode (pstate, operation->opcode); + + if (operation->compound_assignment + || operation->opcode == BINOP_ASSIGN) + { + struct type *type; + + type = language_lookup_primitive_type (parse_language (pstate), + parse_gdbarch (pstate), + "()"); + + write_exp_elt_opcode (pstate, OP_LONG); + write_exp_elt_type (pstate, type); + write_exp_elt_longcst (pstate, 0); + write_exp_elt_opcode (pstate, OP_LONG); + + write_exp_elt_opcode (pstate, BINOP_COMMA); + } + break; + + case UNOP_CAST: + { + struct type *type = convert_ast_to_type (operation->right.op); + + convert_ast_to_expression (operation->left.op, top); + write_exp_elt_opcode (pstate, UNOP_CAST); + write_exp_elt_type (pstate, type); + write_exp_elt_opcode (pstate, UNOP_CAST); + } + break; + + case OP_FUNCALL: + { + if (operation->left.op->opcode == OP_VAR_VALUE) + { + struct type *type; + const char *varname = convert_name (operation->left.op); + + type = rust_lookup_type (varname, expression_context_block); + if (type != NULL) + { + /* This is actually a tuple struct expression, not a + call expression. */ + rust_op_vector *params = operation->right.params; + + if (TYPE_CODE (type) != TYPE_CODE_NAMESPACE) + { + if (!rust_tuple_struct_type_p (type)) + error (_("Type %s is not a tuple struct"), varname); + + for (int i = 0; i < params->size (); ++i) + { + char *cell = get_print_cell (); + + xsnprintf (cell, PRINT_CELL_SIZE, "__%d", i); + write_exp_elt_opcode (pstate, OP_NAME); + write_exp_string (pstate, make_stoken (cell)); + write_exp_elt_opcode (pstate, OP_NAME); + + convert_ast_to_expression ((*params)[i], top); + } + + write_exp_elt_opcode (pstate, OP_AGGREGATE); + write_exp_elt_type (pstate, type); + write_exp_elt_longcst (pstate, 2 * params->size ()); + write_exp_elt_opcode (pstate, OP_AGGREGATE); + break; + } + } + } + convert_ast_to_expression (operation->left.op, top); + convert_params_to_expression (operation->right.params, top); + write_exp_elt_opcode (pstate, OP_FUNCALL); + write_exp_elt_longcst (pstate, operation->right.params->size ()); + write_exp_elt_longcst (pstate, OP_FUNCALL); + } + break; + + case OP_ARRAY: + gdb_assert (operation->left.op == NULL); + convert_params_to_expression (operation->right.params, top); + write_exp_elt_opcode (pstate, OP_ARRAY); + write_exp_elt_longcst (pstate, 0); + write_exp_elt_longcst (pstate, operation->right.params->size () - 1); + write_exp_elt_longcst (pstate, OP_ARRAY); + break; + + case OP_VAR_VALUE: + { + struct block_symbol sym; + const char *varname; + + if (operation->left.sval.ptr[0] == '$') + { + write_dollar_variable (pstate, operation->left.sval); + break; + } + + varname = convert_name (operation); + sym = rust_lookup_symbol (varname, expression_context_block, + VAR_DOMAIN); + if (sym.symbol != NULL && SYMBOL_CLASS (sym.symbol) != LOC_TYPEDEF) + { + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + write_exp_elt_block (pstate, sym.block); + write_exp_elt_sym (pstate, sym.symbol); + write_exp_elt_opcode (pstate, OP_VAR_VALUE); + } + else + { + struct type *type = NULL; + + if (sym.symbol != NULL) + { + gdb_assert (SYMBOL_CLASS (sym.symbol) == LOC_TYPEDEF); + type = SYMBOL_TYPE (sym.symbol); + } + if (type == NULL) + type = rust_lookup_type (varname, expression_context_block); + if (type == NULL) + error (_("No symbol '%s' in current context"), varname); + + if (!want_type + && TYPE_CODE (type) == TYPE_CODE_STRUCT + && TYPE_NFIELDS (type) == 0) + { + /* A unit-like struct. */ + write_exp_elt_opcode (pstate, OP_AGGREGATE); + write_exp_elt_type (pstate, type); + write_exp_elt_longcst (pstate, 0); + write_exp_elt_opcode (pstate, OP_AGGREGATE); + } + else if (want_type || operation == top) + { + write_exp_elt_opcode (pstate, OP_TYPE); + write_exp_elt_type (pstate, type); + write_exp_elt_opcode (pstate, OP_TYPE); + } + else + error (_("Found type '%s', which can't be " + "evaluated in this context"), + varname); + } + } + break; + + case OP_AGGREGATE: + { + int length; + rust_set_vector *fields = operation->right.field_inits; + struct type *type; + const char *name; + + length = 0; + for (const set_field &init : *fields) + { + if (init.name.ptr != NULL) + { + write_exp_elt_opcode (pstate, OP_NAME); + write_exp_string (pstate, init.name); + write_exp_elt_opcode (pstate, OP_NAME); + ++length; + } + + convert_ast_to_expression (init.init, top); + ++length; + + if (init.name.ptr == NULL) + { + /* This is handled differently from Ada in our + evaluator. */ + write_exp_elt_opcode (pstate, OP_OTHERS); + } + } + + name = convert_name (operation->left.op); + type = rust_lookup_type (name, expression_context_block); + if (type == NULL) + error (_("Could not find type '%s'"), operation->left.sval.ptr); + + if (TYPE_CODE (type) != TYPE_CODE_STRUCT + || rust_tuple_type_p (type) + || rust_tuple_struct_type_p (type)) + error (_("Struct expression applied to non-struct type")); + + write_exp_elt_opcode (pstate, OP_AGGREGATE); + write_exp_elt_type (pstate, type); + write_exp_elt_longcst (pstate, length); + write_exp_elt_opcode (pstate, OP_AGGREGATE); + } + break; + + case OP_STRING: + { + write_exp_elt_opcode (pstate, OP_STRING); + write_exp_string (pstate, operation->left.sval); + write_exp_elt_opcode (pstate, OP_STRING); + } + break; + + case OP_RANGE: + { + enum range_type kind = BOTH_BOUND_DEFAULT; + + if (operation->left.op != NULL) + { + convert_ast_to_expression (operation->left.op, top); + kind = HIGH_BOUND_DEFAULT; + } + if (operation->right.op != NULL) + { + convert_ast_to_expression (operation->right.op, top); + if (kind == BOTH_BOUND_DEFAULT) + kind = (operation->inclusive + ? LOW_BOUND_DEFAULT : LOW_BOUND_DEFAULT_EXCLUSIVE); + else + { + gdb_assert (kind == HIGH_BOUND_DEFAULT); + kind = (operation->inclusive + ? NONE_BOUND_DEFAULT : NONE_BOUND_DEFAULT_EXCLUSIVE); + } + } + else + { + /* Nothing should make an inclusive range without an upper + bound. */ + gdb_assert (!operation->inclusive); + } + + write_exp_elt_opcode (pstate, OP_RANGE); + write_exp_elt_longcst (pstate, kind); + write_exp_elt_opcode (pstate, OP_RANGE); + } + break; + + default: + gdb_assert_not_reached ("unhandled opcode in convert_ast_to_expression"); + } +} + + + +/* The parser as exposed to gdb. */ + +int +rust_parse (struct parser_state *state) +{ + int result; + + /* This sets various globals and also clears them on + destruction. */ + rust_parser parser (state); + + result = rustyyparse (&parser); + + if (!result || (parse_completion && parser.rust_ast != NULL)) + parser.convert_ast_to_expression (parser.rust_ast, parser.rust_ast); + + return result; +} + +/* The parser error handler. */ + +static void +rustyyerror (rust_parser *parser, const char *msg) +{ + const char *where = prev_lexptr ? prev_lexptr : lexptr; + error (_("%s in expression, near `%s'."), msg, where); +} + + + +#if GDB_SELF_TEST + +/* Initialize the lexer for testing. */ + +static void +rust_lex_test_init (const char *input) +{ + prev_lexptr = NULL; + lexptr = input; + paren_depth = 0; +} + +/* A test helper that lexes a string, expecting a single token. It + returns the lexer data for this token. */ + +static RUSTSTYPE +rust_lex_test_one (rust_parser *parser, const char *input, int expected) +{ + int token; + RUSTSTYPE result; + + rust_lex_test_init (input); + + token = rustyylex (&result, parser); + SELF_CHECK (token == expected); + + if (token) + { + RUSTSTYPE ignore; + token = rustyylex (&ignore, parser); + SELF_CHECK (token == 0); + } + + return result; +} + +/* Test that INPUT lexes as the integer VALUE. */ + +static void +rust_lex_int_test (rust_parser *parser, const char *input, int value, int kind) +{ + RUSTSTYPE result = rust_lex_test_one (parser, input, kind); + SELF_CHECK (result.typed_val_int.val == value); +} + +/* Test that INPUT throws an exception with text ERR. */ + +static void +rust_lex_exception_test (rust_parser *parser, const char *input, + const char *err) +{ + TRY + { + /* The "kind" doesn't matter. */ + rust_lex_test_one (parser, input, DECIMAL_INTEGER); + SELF_CHECK (0); + } + CATCH (except, RETURN_MASK_ERROR) + { + SELF_CHECK (strcmp (except.message, err) == 0); + } + END_CATCH +} + +/* Test that INPUT lexes as the identifier, string, or byte-string + VALUE. KIND holds the expected token kind. */ + +static void +rust_lex_stringish_test (rust_parser *parser, const char *input, + const char *value, int kind) +{ + RUSTSTYPE result = rust_lex_test_one (parser, input, kind); + SELF_CHECK (result.sval.length == strlen (value)); + SELF_CHECK (strncmp (result.sval.ptr, value, result.sval.length) == 0); +} + +/* Helper to test that a string parses as a given token sequence. */ + +static void +rust_lex_test_sequence (rust_parser *parser, const char *input, int len, + const int expected[]) +{ + int i; + + lexptr = input; + paren_depth = 0; + + for (i = 0; i < len; ++i) + { + RUSTSTYPE ignore; + int token = rustyylex (&ignore, parser); + + SELF_CHECK (token == expected[i]); + } +} + +/* Tests for an integer-parsing corner case. */ + +static void +rust_lex_test_trailing_dot (rust_parser *parser) +{ + const int expected1[] = { DECIMAL_INTEGER, '.', IDENT, '(', ')', 0 }; + const int expected2[] = { INTEGER, '.', IDENT, '(', ')', 0 }; + const int expected3[] = { FLOAT, EQEQ, '(', ')', 0 }; + const int expected4[] = { DECIMAL_INTEGER, DOTDOT, DECIMAL_INTEGER, 0 }; + + rust_lex_test_sequence (parser, "23.g()", ARRAY_SIZE (expected1), expected1); + rust_lex_test_sequence (parser, "23_0.g()", ARRAY_SIZE (expected2), + expected2); + rust_lex_test_sequence (parser, "23.==()", ARRAY_SIZE (expected3), + expected3); + rust_lex_test_sequence (parser, "23..25", ARRAY_SIZE (expected4), expected4); +} + +/* Tests of completion. */ + +static void +rust_lex_test_completion (rust_parser *parser) +{ + const int expected[] = { IDENT, '.', COMPLETE, 0 }; + + parse_completion = 1; + + rust_lex_test_sequence (parser, "something.wha", ARRAY_SIZE (expected), + expected); + rust_lex_test_sequence (parser, "something.", ARRAY_SIZE (expected), + expected); + + parse_completion = 0; +} + +/* Test pushback. */ + +static void +rust_lex_test_push_back (rust_parser *parser) +{ + int token; + RUSTSTYPE lval; + + rust_lex_test_init (">>="); + + token = rustyylex (&lval, parser); + SELF_CHECK (token == COMPOUND_ASSIGN); + SELF_CHECK (lval.opcode == BINOP_RSH); + + rust_push_back ('='); + + token = rustyylex (&lval, parser); + SELF_CHECK (token == '='); + + token = rustyylex (&lval, parser); + SELF_CHECK (token == 0); +} + +/* Unit test the lexer. */ + +static void +rust_lex_tests (void) +{ + int i; + + // Set up dummy "parser", so that rust_type works. + struct parser_state ps (0, &rust_language_defn, target_gdbarch ()); + rust_parser parser (&ps); + + rust_lex_test_one (&parser, "", 0); + rust_lex_test_one (&parser, " \t \n \r ", 0); + rust_lex_test_one (&parser, "thread 23", 0); + rust_lex_test_one (&parser, "task 23", 0); + rust_lex_test_one (&parser, "th 104", 0); + rust_lex_test_one (&parser, "ta 97", 0); + + rust_lex_int_test (&parser, "'z'", 'z', INTEGER); + rust_lex_int_test (&parser, "'\\xff'", 0xff, INTEGER); + rust_lex_int_test (&parser, "'\\u{1016f}'", 0x1016f, INTEGER); + rust_lex_int_test (&parser, "b'z'", 'z', INTEGER); + rust_lex_int_test (&parser, "b'\\xfe'", 0xfe, INTEGER); + rust_lex_int_test (&parser, "b'\\xFE'", 0xfe, INTEGER); + rust_lex_int_test (&parser, "b'\\xfE'", 0xfe, INTEGER); + + /* Test all escapes in both modes. */ + rust_lex_int_test (&parser, "'\\n'", '\n', INTEGER); + rust_lex_int_test (&parser, "'\\r'", '\r', INTEGER); + rust_lex_int_test (&parser, "'\\t'", '\t', INTEGER); + rust_lex_int_test (&parser, "'\\\\'", '\\', INTEGER); + rust_lex_int_test (&parser, "'\\0'", '\0', INTEGER); + rust_lex_int_test (&parser, "'\\''", '\'', INTEGER); + rust_lex_int_test (&parser, "'\\\"'", '"', INTEGER); + + rust_lex_int_test (&parser, "b'\\n'", '\n', INTEGER); + rust_lex_int_test (&parser, "b'\\r'", '\r', INTEGER); + rust_lex_int_test (&parser, "b'\\t'", '\t', INTEGER); + rust_lex_int_test (&parser, "b'\\\\'", '\\', INTEGER); + rust_lex_int_test (&parser, "b'\\0'", '\0', INTEGER); + rust_lex_int_test (&parser, "b'\\''", '\'', INTEGER); + rust_lex_int_test (&parser, "b'\\\"'", '"', INTEGER); + + rust_lex_exception_test (&parser, "'z", "Unterminated character literal"); + rust_lex_exception_test (&parser, "b'\\x0'", "Not enough hex digits seen"); + rust_lex_exception_test (&parser, "b'\\u{0}'", + "Unicode escape in byte literal"); + rust_lex_exception_test (&parser, "'\\x0'", "Not enough hex digits seen"); + rust_lex_exception_test (&parser, "'\\u0'", "Missing '{' in Unicode escape"); + rust_lex_exception_test (&parser, "'\\u{0", "Missing '}' in Unicode escape"); + rust_lex_exception_test (&parser, "'\\u{0000007}", "Overlong hex escape"); + rust_lex_exception_test (&parser, "'\\u{}", "Not enough hex digits seen"); + rust_lex_exception_test (&parser, "'\\Q'", "Invalid escape \\Q in literal"); + rust_lex_exception_test (&parser, "b'\\Q'", "Invalid escape \\Q in literal"); + + rust_lex_int_test (&parser, "23", 23, DECIMAL_INTEGER); + rust_lex_int_test (&parser, "2_344__29", 234429, INTEGER); + rust_lex_int_test (&parser, "0x1f", 0x1f, INTEGER); + rust_lex_int_test (&parser, "23usize", 23, INTEGER); + rust_lex_int_test (&parser, "23i32", 23, INTEGER); + rust_lex_int_test (&parser, "0x1_f", 0x1f, INTEGER); + rust_lex_int_test (&parser, "0b1_101011__", 0x6b, INTEGER); + rust_lex_int_test (&parser, "0o001177i64", 639, INTEGER); + + rust_lex_test_trailing_dot (&parser); + + rust_lex_test_one (&parser, "23.", FLOAT); + rust_lex_test_one (&parser, "23.99f32", FLOAT); + rust_lex_test_one (&parser, "23e7", FLOAT); + rust_lex_test_one (&parser, "23E-7", FLOAT); + rust_lex_test_one (&parser, "23e+7", FLOAT); + rust_lex_test_one (&parser, "23.99e+7f64", FLOAT); + rust_lex_test_one (&parser, "23.82f32", FLOAT); + + rust_lex_stringish_test (&parser, "hibob", "hibob", IDENT); + rust_lex_stringish_test (&parser, "hibob__93", "hibob__93", IDENT); + rust_lex_stringish_test (&parser, "thread", "thread", IDENT); + + rust_lex_stringish_test (&parser, "\"string\"", "string", STRING); + rust_lex_stringish_test (&parser, "\"str\\ting\"", "str\ting", STRING); + rust_lex_stringish_test (&parser, "\"str\\\"ing\"", "str\"ing", STRING); + rust_lex_stringish_test (&parser, "r\"str\\ing\"", "str\\ing", STRING); + rust_lex_stringish_test (&parser, "r#\"str\\ting\"#", "str\\ting", STRING); + rust_lex_stringish_test (&parser, "r###\"str\\\"ing\"###", "str\\\"ing", + STRING); + + rust_lex_stringish_test (&parser, "b\"string\"", "string", BYTESTRING); + rust_lex_stringish_test (&parser, "b\"\x73tring\"", "string", BYTESTRING); + rust_lex_stringish_test (&parser, "b\"str\\\"ing\"", "str\"ing", BYTESTRING); + rust_lex_stringish_test (&parser, "br####\"\\x73tring\"####", "\\x73tring", + BYTESTRING); + + for (i = 0; i < ARRAY_SIZE (identifier_tokens); ++i) + rust_lex_test_one (&parser, identifier_tokens[i].name, + identifier_tokens[i].value); + + for (i = 0; i < ARRAY_SIZE (operator_tokens); ++i) + rust_lex_test_one (&parser, operator_tokens[i].name, + operator_tokens[i].value); + + rust_lex_test_completion (&parser); + rust_lex_test_push_back (&parser); +} + +#endif /* GDB_SELF_TEST */ + +void +_initialize_rust_exp (void) +{ + int code = regcomp (&number_regex, number_regex_text, REG_EXTENDED); + /* If the regular expression was incorrect, it was a programming + error. */ + gdb_assert (code == 0); + +#if GDB_SELF_TEST + selftests::register_test ("rust-lex", rust_lex_tests); +#endif +} diff --git a/gdb-8.3.1/gdb/testsuite/lib/pdtrace b/gdb-8.3.1/gdb/testsuite/lib/pdtrace new file mode 100755 index 0000000000000000000000000000000000000000..e44f34c40a22134de617513425e3674af08cfae6 --- /dev/null +++ b/gdb-8.3.1/gdb/testsuite/lib/pdtrace @@ -0,0 +1,1033 @@ +#!/bin/sh + +# A Poor(but Free)'s Man dtrace +# +# Copyright (C) 2014-2019 Free Software Foundation, Inc. +# +# Contributed by Oracle, Inc. +# +# This file is part of GDB. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# . + +# DISCLAIMER DISCLAIMER DISCLAIMER +# This script is a test tool. As such it is in no way intended to +# replace the "real" dtrace command for any practical purpose, apart +# from testing the DTrace USDT probes support in GDB. + +# that said... +# +# pdtrace is a limited dtrace program, implementing a subset of its +# functionality: +# +# - The generation of an ELF file containing an embedded dtrace +# program. Equivalent to dtrace -G. +# +# - The generation of a header file with definitions for static +# probes. Equivalent to dtrace -h. +# +# This allows to generate DTrace static probes without having to use +# the user-level DTrace components. The generated objects are 100% +# compatible with DTrace and can be traced by the dtrace kernel module +# like if they were generated by dtrace. +# +# Some of the known limitations of this implementation are: +# - The input d-script must describe one provider, and only one. +# - The "probe " directives in the d-file must not include argument +# names, just the types. Thus something like `char *' is valid, but +# `char *name' is not. +# - The command line options must precede other arguments, since the +# script uses the (more) portable getopts. +# - Each probe header in the d-script must be contained in +# a single line. +# - strip -K removes the debugging information from the input object +# file. +# - The supported target platforms are i[3456]86 and x86_64. +# +# Please keep this code as portable as possible. Restrict yourself to +# POSIX sh. + +# This script uses the following external programs, defined in +# variables. Some of them are substituted by autoconf. + +TR=tr +NM=i386-pc-linux-gnu-nm +EGREP=egrep +SED=sed +CUT=cut +READELF=i386-pc-linux-gnu-readelf +SORT=sort +EXPR=expr +WC=wc +UNIQ=uniq +HEAD=head +SEQ=seq +AS=i386-pc-linux-gnu-as +STRIP=i386-pc-linux-gnu-strip +TRUE=true + +# Sizes for several DOF structures, in bytes. +# +# See linux/dtrace/dof.h for the definition of the referred +# structures. + +dof_hdrsize=64 # sizeof(dtrace_dof_hdr) +dof_secsize=32 # sizeof(dtrace_dof_sect) +dof_probesize=48 # sizeof(dtrace_dof_probe) +dof_providersize=44 # sizeof(dtrace_dof_provider) + +# Types for the several DOF sections. +# +# See linux/dtrace/dof_defines.h for a complete list of section types +# along with their values. + +dof_sect_type_strtab=8 +dof_sect_type_provider=15 +dof_sect_type_probes=16 +dof_sect_type_prargs=17 +dof_sect_type_proffs=18 +dof_sect_type_prenoffs=26 + +### Functions + +# Write a message to the standard error output and exit with an error +# status. +# +# Arguments: +# $1 error message. + +f_panic() +{ + echo "error: $1" 1>&2; exit 1 +} + +# Write a usage message to the standard output and exit with an error +# status. + +f_usage() +{ + printf "Usage: pdtrace [-32|-64] [-GhV] [-o output] [-s script] [ args ... ]\n\n" + + printf "\t-32 generate 32-bit ELF files\n" + printf "\t-64 generate 64-bit ELF files\n\n" + + printf "\t-G generate an ELF file containing embedded dtrace program\n" + printf "\t-h generate a header file with definitions for static probes\n" + printf "\t-o set output file\n" + printf "\t-s handle probes according to the specified D script\n" + printf "\t-V report the DTrace API version implemented by the tool\n" + exit 2 +} + +# Write a version message to the standard output and exit with a +# successful status. + +f_version() +{ + echo "pdtrace: Sun D 1.6.3" + exit +} + +# Add a new record to a list and return it. +# +# Arguments: +# $1 is the list. +# $2 is the new record + +f_add_record() +{ + rec=$1 + test -n "$rec" && \ + { rec=$(printf %s\\n "$rec"; echo x); rec=${rec%x}; } + printf %s "$rec$2" +} + +# Collect the providers and probes information from the input object +# file. +# +# This function sets the values of the following global variables. +# The values are structured in records, each record in a line. The +# fields of each record are separated in some cases by white +# characters and in other cases by colon (:) characters. +# +# The type codes in the line format descriptors are: +# S: string, D: decimal number +# +# probes +# Regular probes and is-enabled probes. +# TYPE(S) PROVIDER(S) NAME(S) OFFSET(D) BASE(D) BASE_SYM(S) +# base_probes +# Base probes, i.e. probes sharing provider, name and container. +# PROVIDER(S) NAME(S) BASE(D) BASE_SYM(S) +# providers +# List of providers. +# PROVIDER(S) +# All the offsets are expressed in bytes. +# +# Input globals: +# objfile +# Output globals: +# probes, base_probes, providers + +probes= +base_probes= +providers= +probes_args= + +f_collect_probes() +{ + # Probe points are function calls to undefined functions featuring + # distinct names for both normal probes and is-enabled probes. + PROBE_REGEX="(__dtrace_([a-zA-Z_]+)___([a-zA-Z_]+))" + EPROBE_REGEX="(__dtraceenabled_([a-zA-Z_]+)___([a-zA-Z_]+))" + + while read type symbol provider name; do + test -z "$type" && f_panic "No probe points found in $objfile" + + provider=$(printf %s $provider | $TR -s _) + name=$(printf %s $name | $TR -s _) + + # Search the object file for relocations defined for the + # probe symbols. Then calculate the base address of the + # probe (along with the symbol associated with that base + # address) and the offset of the probe point. + for offset in $($READELF -W -r $objfile | $EGREP $symbol | $CUT -d' ' -f1) + do + # Figure out the base address for the probe. This is + # done finding the function name in the text section of + # the object file located above the probed point. But + # note that the relocation is for the address operand of + # the call instruction, so we have to subtract 1 to find + # the real probed point. + offset=$((0x$offset - 1)) + + # The addresses of is-enabled probes must point to the + # first NOP instruction in their patched instructions + # sequences, so modify them (see f_patch_objfile for the + # instruction sequences). + if test "$type" = "e"; then + if test "$objbits" -eq "32"; then + offset=$((offset + 2)) + else # 64 bits + offset=$((offset + 3)) + fi + fi + + # Determine the base address of the probe and its + # corresponding function name. + funcs=$($NM -td $objfile | $EGREP "^[0-9]+ T " \ + | $CUT -d' ' -f1,3 | $SORT -n -r | $TR ' ' :) + for fun in $funcs; do + func_off=$(printf %s $fun | $CUT -d: -f1) + func_sym=$(printf %s $fun | $CUT -d: -f2) + # Note that `expr' is used to remove leading zeros + # to avoid FUNC_OFF to be interpreted as an octal + # number in arithmetic contexts. + test "$func_off" -le "$offset" && \ + { base=$($EXPR $func_off + 0); break; } + done + test -n "$base" || \ + f_panic "could not find base address for probe at $objfile($o)" + + # Emit the record for the probe. + probes=$(f_add_record "$probes" \ + "$type $provider $name $(($offset - $base)) $base $func_sym") + done + done < loadable section. + f_gen_asm ".4byte 1\t/* uint32_t dofs_flags */" + f_gen_asm ".4byte $4\t/* uint32_t dofs_entsize */" + f_gen_asm ".8byte $5\t/* uint64_t dofs_offset */" + f_gen_asm ".8byte $6\t/* uint64_t dofs_size */" +} + +# Generate a DOF program and assembly it in the output file. +# +# The DOF program generated by this function has the following +# structure: +# +# HEADER +# STRTAB OFFTAB EOFFTAB [PROBES PROVIDER]... +# STRTAB_SECT OFFTAB_SECT EOFFTAB_SECT ARGTAB_SECT [PROBES_SECT PROVIDER_SECT]... +# +# Input globals: +# probes, base_probes, providers, probes_args, BCOUNT + +f_gen_dof_program() +{ + ###### Variables used to cache information needed later. + + # Number of section headers in the generated DOF program. + dof_secnum=0 + # Offset of section headers in the generated DOF program, in bytes. + dof_secoff=0 + + # Sizes of the STRTAB, OFFTAB and EOFFTAB sections, in bytes. + strtab_size=0 + offtab_size=0 + eofftab_size=0 + + # Offsets of the STRTAB, OFFTAB EOFFTAB and PROBES sections in the + # generated DOF program. In bytes. + strtab_offset=0 + offtab_offset=0 + eofftab_offset=0 + argtab_offset=0 + probes_offset=0 + + # Indexes of the section headers of the STRTAB, OFFTAB, EOFFTAB and + # PROBES sections in the sections array. + strtab_sect_index=0 + offtab_sect_index=0 + eofftab_sect_index=0 + argtab_sect_index=0 + probes_sect_index=0 + + # First offsets and eoffsets of the base-probes. + # Lines: PROVIDER(S) NAME(S) BASE(D) (DOF_OFFSET(D)|DOF_EOFFSET(D)) + probes_dof_offsets= + probes_dof_eoffsets= + + # Offsets in the STRTAB section for the first type of base probes. + # Record per line: PROVIDER(S) NAME(S) BASE(D) OFFSET(D) + probes_dof_types= + + + # Offsets of the provider names in the provider's STRTAB section. + # Lines: PROVIDER(S) OFFSET(D) + providers_dof_names= + + # Offsets of the base-probe names in the provider's STRTAB section. + # Lines: PROVIDER(S) NAME(S) BASE(D) OFFSET(D) + probes_dof_names= + + # Offsets of the provider sections in the DOF program. + # Lines: PROVIDER(S) OFFSET(D) + providers_offsets= + + ###### Generation phase. + + # The header of the DOF program contains a `struct + # dtrace_dof_hdr'. Record its size, but it is written at the end + # of the function. + f_incr_bcount $dof_hdrsize; f_align_bcount 8 + + # The STRTAB section immediately follows the header. It contains + # the following set of packed null-terminated strings: + # + # [PROVIDER [BASE_PROBE_NAME [BASE_PROBE_ARG_TYPE...]]...]... + strtab_offset=$BCOUNT + strtab_sect_index=$dof_secnum + dof_secnum=$((dof_secnum + 1)) + f_gen_asm "" + f_gen_asm "/* The STRTAB section. */" + f_gen_asm ".balign 8" + # Add the provider names. + off=0 + while read provider; do + strtab_size=$(($strtab_size + ${#prov} + 1)) + # Note the funny mangling... + f_gen_asm ".asciz \"$(printf %s $provider | $TR _ -)\"" + providers_dof_names=$(f_add_record "$providers_dof_names" \ + "$provider $off") + off=$(($off + ${#provider} + 1)) + + # Add the base-probe names. + while read p_provider name base base_sym; do + test "$p_provider" = "$provider" || continue + # And yes, more funny mangling... + f_gen_asm ".asciz \"$(printf %s $name | $TR _ -)\"" + probes_dof_names=$(f_add_record "$probes_dof_names" \ + "$p_provider $name $base $off") + off=$(($off + ${#name} + 1)) + while read args; do + a_provider=$(printf %s "$args" | $CUT -d: -f1) + a_name=$(printf %s "$args" | $CUT -d: -f2) + test "$a_provider" = "$p_provider" \ + && test "$a_name" = "$name" \ + || continue + + probes_dof_types=$(f_add_record "$probes_dof_types" \ + "$a_provider $name $base $off") + nargs=$(printf %s "$args" | $CUT -d: -f3) + for n in $($SEQ $nargs); do + arg=$(printf %s "$args" | $CUT -d: -f$(($n + 3))) + f_gen_asm ".asciz \"${arg}\"" + off=$(($off + ${#arg} + 1)) + done + done < /dev/null + break + fi + done < /dev/null) + test "$byte" = "$x86_op_jmp32" && nopret="$x86_op_ret" + + # Determine the patching sequence. It depends on the type of + # probe at hand (regular or is-enabled) and also if + # manipulating a 32bit or 64bit binary. + patchseq= + case $type in + p) patchseq=$(printf %s%s%s%s%s \ + "$nopret" \ + "$x86_op_nop" \ + "$x86_op_nop" \ + "$x86_op_nop" \ + "$x86_op_nop") + ;; + e) test "$objbits" -eq 64 && \ + patchseq=$(printf %s%s%s%s%s \ + "$x86_op_rex_rax" \ + "$x86_op_xor_eax_0" \ + "$x86_op_xor_eax_1" \ + "$nopret" \ + "$x86_op_nop") + test "$objbits" -eq 32 && \ + patchseq=$(printf %s%s%s%s%s \ + "$x86_op_xor_eax_0" \ + "$x86_op_xor_eax_1" \ + "$nopret" \ + "$x86_op_nop" \ + "$x86_op_nop") + ;; + *) f_panic "internal error: wrong probe type $type";; + esac + + # Patch! + printf %s "$patchseq" \ + | dd of=$objfile conv=notrunc count=5 ibs=1 bs=1 seek=$probe_off 2> /dev/null + done <\n" + printf "#include \n" + printf \\n\\n + + printf "#ifdef __cplusplus\nextern \"C\" {\n#endif\n" + + printf "#define _DTRACE_VERSION 1\n\n" + + provider=$(cat $dfile | $EGREP "^ *provider +([a-zA-Z_]+)" \ + | $SED -E -e 's/^ *provider +([a-zA-Z]+).*/\1/') + test -z "$provider" \ + && f_panic "unable to parse the provider name from $dfile." + u_provider=$(printf %s "$provider" | $TR a-z A-Z | $TR -s _) + + cat $dfile | $EGREP "^ *probe +[a-zA-Z_]+ *\(.*\);" | \ + while read line; do + # Extract the probe name. + name=$(printf %s "$line" \ + | $SED -E -e 's/^ *probe +([a-zA-Z_]+).*/\1/') + u_name=$(printf %s "$name" | $TR a-z A-Z | $TR -s _) + + # Generate an arg1,arg2,...,argN line for the probe. + args=""; nargs=0; aline=$(printf %s "$line" | $SED -e 's/.*(\(.*\)).*/\1/') + set -f; IFS=, + for arg in $aline; do + args="${args}arg${nargs}," + nargs=$((nargs + 1)) + done + set +f; unset IFS + args=${args%,} + + echo "#if _DTRACE_VERSION" + echo "" + + # Emit the macros for the probe. + echo "#define ${u_provider}_${u_name}($args) \\" + echo " __dtrace_${provider}___${name}($args)" + echo "#define ${u_provider}_${u_name}_ENABLED() \\" + echo " __dtraceenabled_${provider}___${name}()" + + # Emit the extern definitions for the probe dummy + # functions. + echo "" + printf %s\\n "$line" \ + | $SED -E -e "s/^ *probe +/extern void __dtrace_${provider}___/" + echo "extern int __dtraceenabled_${provider}___${name}(void);" + + + printf "\n#else\n" + + # Emit empty macros for the probe + echo "#define ${u_provider}_${u_name}($args)" + echo "#define ${u_provider}_${u_name}_ENABLED() (0)" + + printf "\n#endif /* _DTRACE_VERSION */\n" + done + + printf "#ifdef __cplusplus\n}\n#endif\n\n" + printf "#endif /* _${guard}_H */\n" +} + +### Main program. + +# Process command line arguments. + +test "$#" -eq "0" && f_usage + +genelf=0 +genheader=0 +objbits=64 +ofile= +dfile= +while getopts VG3264hs:o: name; do + case $name in + V) f_version;; + s) dfile="$OPTARG"; + test -f "$dfile" || f_panic "cannot read $dfile";; + o) ofile="$OPTARG";; + G) genelf=1;; + h) genheader=1;; + # Note the trick to support -32 + 3) objbits=666;; + 2) test "$objbits" -eq 666 || f_usage; objbits=32;; + # Likewise for -64 + 6) objbits=777;; + 4) test "$objbits" -eq 777 || f_usage; objbits=64;; + ?) f_usage;; + esac +done +shift $(($OPTIND - 1)) + +test "$objbits" -eq "32" || test "$objbits" -eq "64" \ + || f_usage + +test $((genelf + genheader)) -gt 1 && \ + { echo "Please use either -G or -h."; f_usage; } + +test -n "$dfile" || { echo "Please specify a .d file with -s."; exit 2; } + +if test "$genelf" -gt 0; then + # In this mode there must be a remaining argument: the name of the + # object file to inspect for probed points. + test "$#" -ne "1" && f_usage + test -f "$1" || f_panic "cannot read $1" + objfile=$1 + + # Collect probe information from the input object file and the + # d-script. + f_collect_probes $objfile + f_collect_probes_args $dfile + + # Generate the assembly code and assemble the DOF program in + # OFILE. Then patch OBJFILE to remove the dummy probe calls. + f_gen_dof_program + f_patch_objfile $objfile +fi + +if test "$genheader" -gt 0; then + test -n "$ofile" || { echo "Please specify an output file with -o."; exit 2; } + + # In this mode no extra arguments shall be present. + test "$#" -ne "0" && f_usage + + f_gen_header_file > $ofile +fi + +# pdtrace ends here. diff --git a/gdb.spec b/gdb.spec index 56e8f9d995eefe512e4ef7d3fa8fdc8878d5cbe3..98c9645baae06917b55e6ec84dc2136a91471aea 100644 --- a/gdb.spec +++ b/gdb.spec @@ -165,6 +165,7 @@ Patch118: gdb-rhbz1704406-disable-style-log-output-2of3.patch Patch119: gdb-rhbz1704406-disable-style-log-output-3of3.patch Patch120: gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch Patch121: gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch +Patch122: gdb-6.6-buildid-locate-rpm-configure-error.patch # Fedora patch end BuildRequires: rpm-libs @@ -414,6 +415,9 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb/command/backtrace.py %{_infodir}/gdb.info* %changelog +* Sat May 6 2023 liying - 8.3.1-9 +- Fix error gdb configure error + * Thu Jan 16 2020 openEuler Buildteam - 8.3.1-9 - rpm upgrade successful, delete the dependence to librpm8