clang -cc1 -cc1 -triple amd64-unknown-openbsd7.0 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name p-exp.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 1 -pic-is-pie -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/gnu/usr.bin/binutils/obj/gdb -resource-dir /usr/local/lib/clang/13.0.0 -D PIE_DEFAULT=1 -I . -I /usr/src/gnu/usr.bin/binutils/gdb -I /usr/src/gnu/usr.bin/binutils/gdb/config -D LOCALEDIR="/usr/share/locale" -D HAVE_CONFIG_H -I /usr/src/gnu/usr.bin/binutils/gdb/../include/opcode -I ../bfd -I /usr/src/gnu/usr.bin/binutils/gdb/../bfd -I /usr/src/gnu/usr.bin/binutils/gdb/../include -I ../intl -I /usr/src/gnu/usr.bin/binutils/gdb/../intl -D MI_OUT=1 -D TUI=1 -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/gnu/usr.bin/binutils/obj/gdb -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fgnuc-version=4.2.1 -fcommon -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/vmm/scan-build/2022-01-12-194120-40624-1 -x c p-exp.c
| 1 | #include <stdlib.h> |
| 2 | #include <string.h> |
| 3 | #define YYBYACC 1 |
| 4 | #define YYMAJOR 1 |
| 5 | #define YYMINOR 9 |
| 6 | #define YYLEX yylex() |
| 7 | #define YYEMPTY -1 |
| 8 | #define yyclearin (yychar=(YYEMPTY)) |
| 9 | #define yyerrok (yyerrflag=0) |
| 10 | #define YYRECOVERING() (yyerrflag!=0) |
| 11 | #define YYPREFIX "yy" |
| 12 | #line 47 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 13 | |
| 14 | #include "defs.h" |
| 15 | #include "gdb_string.h" |
| 16 | #include <ctype.h> |
| 17 | #include "expression.h" |
| 18 | #include "value.h" |
| 19 | #include "parser-defs.h" |
| 20 | #include "language.h" |
| 21 | #include "p-lang.h" |
| 22 | #include "bfd.h" /* Required by objfiles.h. */ |
| 23 | #include "symfile.h" /* Required by objfiles.h. */ |
| 24 | #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ |
| 25 | #include "block.h" |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | #define yymaxdepth pascal_maxdepth |
| 35 | #define yyparse pascal_parse |
| 36 | #define yylex pascal_lex |
| 37 | #define yyerror pascal_error |
| 38 | #define yylval pascal_lval |
| 39 | #define yychar pascal_char |
| 40 | #define yydebug pascal_debug |
| 41 | #define yypact pascal_pact |
| 42 | #define yyr1 pascal_r1 |
| 43 | #define yyr2 pascal_r2 |
| 44 | #define yydef pascal_def |
| 45 | #define yychk pascal_chk |
| 46 | #define yypgo pascal_pgo |
| 47 | #define yyact pascal_act |
| 48 | #define yyexca pascal_exca |
| 49 | #define yyerrflag pascal_errflag |
| 50 | #define yynerrs pascal_nerrs |
| 51 | #define yyps pascal_ps |
| 52 | #define yypv pascal_pv |
| 53 | #define yys pascal_s |
| 54 | #define yy_yys pascal_yys |
| 55 | #define yystate pascal_state |
| 56 | #define yytmp pascal_tmp |
| 57 | #define yyv pascal_v |
| 58 | #define yy_yyv pascal_yyv |
| 59 | #define yyval pascal_val |
| 60 | #define yylloc pascal_lloc |
| 61 | #define yyreds pascal_reds /* With YYDEBUG defined */ |
| 62 | #define yytoks pascal_toks /* With YYDEBUG defined */ |
| 63 | #define yyname pascal_name /* With YYDEBUG defined */ |
| 64 | #define yyrule pascal_rule /* With YYDEBUG defined */ |
| 65 | #define yylhs pascal_yylhs |
| 66 | #define yylen pascal_yylen |
| 67 | #define yydefred pascal_yydefred |
| 68 | #define yydgoto pascal_yydgoto |
| 69 | #define yysindex pascal_yysindex |
| 70 | #define yyrindex pascal_yyrindex |
| 71 | #define yygindex pascal_yygindex |
| 72 | #define yytable pascal_yytable |
| 73 | #define yycheck pascal_yycheck |
| 74 | |
| 75 | #ifndef YYDEBUG |
| 76 | #define YYDEBUG 1 /* Default to yydebug support */ |
| 77 | #endif |
| 78 | |
| 79 | #define YYFPRINTF parser_fprintf |
| 80 | |
| 81 | int yyparse (void); |
| 82 | |
| 83 | static int yylex (void); |
| 84 | |
| 85 | void |
| 86 | yyerror (char *); |
| 87 | |
| 88 | static char * uptok (char *, int); |
| 89 | #line 129 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 90 | #ifndef YYSTYPE_DEFINED |
| 91 | #define YYSTYPE_DEFINED |
| 92 | typedef union |
| 93 | { |
| 94 | LONGEST lval; |
| 95 | struct { |
| 96 | LONGEST val; |
| 97 | struct type *type; |
| 98 | } typed_val_int; |
| 99 | struct { |
| 100 | DOUBLEST dval; |
| 101 | struct type *type; |
| 102 | } typed_val_float; |
| 103 | struct symbol *sym; |
| 104 | struct type *tval; |
| 105 | struct stoken sval; |
| 106 | struct ttype tsym; |
| 107 | struct symtoken ssym; |
| 108 | int voidval; |
| 109 | struct block *bval; |
| 110 | enum exp_opcode opcode; |
| 111 | struct internalvar *ivar; |
| 112 | |
| 113 | struct type **tvec; |
| 114 | int *ivec; |
| 115 | } YYSTYPE; |
| 116 | #endif /* YYSTYPE_DEFINED */ |
| 117 | #line 155 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 118 | |
| 119 | static int |
| 120 | parse_number (char *, int, int, YYSTYPE *); |
| 121 | |
| 122 | static struct type *current_type; |
| 123 | |
| 124 | static void push_current_type (void); |
| 125 | static void pop_current_type (void); |
| 126 | static int search_field; |
| 127 | #define INT 257 |
| 128 | #define FLOAT 258 |
| 129 | #define STRING 259 |
| 130 | #define FIELDNAME 260 |
| 131 | #define NAME 261 |
| 132 | #define TYPENAME 262 |
| 133 | #define NAME_OR_INT 263 |
| 134 | #define STRUCT 264 |
| 135 | #define CLASS 265 |
| 136 | #define SIZEOF 266 |
| 137 | #define COLONCOLON 267 |
| 138 | #define ERROR 268 |
| 139 | #define VARIABLE 269 |
| 140 | #define THIS 270 |
| 141 | #define TRUEKEYWORD 271 |
| 142 | #define FALSEKEYWORD 272 |
| 143 | #define ABOVE_COMMA 273 |
| 144 | #define ASSIGN 274 |
| 145 | #define NOT 275 |
| 146 | #define OR 276 |
| 147 | #define XOR 277 |
| 148 | #define ANDAND 278 |
| 149 | #define NOTEQUAL 279 |
| 150 | #define LEQ 280 |
| 151 | #define GEQ 281 |
| 152 | #define LSH 282 |
| 153 | #define RSH 283 |
| 154 | #define DIV 284 |
| 155 | #define MOD 285 |
| 156 | #define UNARY 286 |
| 157 | #define INCREMENT 287 |
| 158 | #define DECREMENT 288 |
| 159 | #define ARROW 289 |
| 160 | #define BLOCKNAME 290 |
| 161 | #define YYERRCODE 256 |
| 162 | const short yylhs[] = |
| 163 | { -1, |
| 164 | 13, 0, 4, 4, 3, 2, 2, 1, 1, 1, |
| 165 | 1, 1, 1, 14, 1, 15, 1, 17, 1, 16, |
| 166 | 16, 16, 1, 1, 1, 1, 1, 1, 1, 1, |
| 167 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 168 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 169 | 1, 1, 12, 12, 5, 6, 5, 5, 5, 9, |
| 170 | 7, 7, 8, 8, 8, 8, 10, 10, 10, 10, |
| 171 | 11, 11, |
| 172 | }; |
| 173 | const short yylen[] = |
| 174 | { 2, |
| 175 | 0, 2, 1, 1, 1, 1, 3, 2, 2, 2, |
| 176 | 2, 4, 4, 0, 4, 0, 5, 0, 5, 0, |
| 177 | 1, 3, 4, 3, 3, 3, 3, 3, 3, 3, |
| 178 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
| 179 | 3, 3, 1, 1, 1, 1, 1, 1, 1, 4, |
| 180 | 1, 1, 1, 3, 3, 3, 1, 2, 1, 1, |
| 181 | 1, 3, 2, 1, 2, 2, 1, 1, 1, 1, |
| 182 | 1, 1, |
| 183 | }; |
| 184 | const short yydefred[] = |
| 185 | { 1, |
| 186 | 0, 0, 45, 47, 51, 71, 64, 46, 0, 0, |
| 187 | 0, 0, 49, 52, 43, 44, 0, 0, 0, 0, |
| 188 | 0, 0, 0, 0, 0, 0, 4, 2, 48, 57, |
| 189 | 0, 0, 61, 59, 0, 67, 69, 70, 68, 65, |
| 190 | 66, 0, 58, 0, 0, 0, 0, 0, 0, 0, |
| 191 | 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 192 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, |
| 193 | 16, 18, 8, 0, 0, 0, 0, 0, 0, 0, |
| 194 | 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, |
| 195 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 196 | 0, 0, 0, 0, 0, 62, 56, 0, 50, 0, |
| 197 | 12, 13, 15, 0, 0, 0, 23, 17, 0, 19, |
| 198 | 0, |
| 199 | }; |
| 200 | const short yydgoto[] = |
| 201 | { 1, |
| 202 | 25, 26, 27, 28, 29, 30, 45, 32, 33, 40, |
| 203 | 34, 35, 2, 101, 102, 116, 103, |
| 204 | }; |
| 205 | const short yysindex[] = |
| 206 | { 0, |
| 207 | 0, 534, 0, 0, 0, 0, 0, 0, -28, -28, |
| 208 | -35, -28, 0, 0, 0, 0, 534, 534, 534, -27, |
| 209 | -22, 534, -86, 0, 599, -11, 0, 0, 0, 0, |
| 210 | -5, -230, 0, 0, -229, 0, 0, 0, 0, 0, |
| 211 | 0, -86, 0, 70, -5, 70, 70, 534, 534, -24, |
| 212 | 0, 534, 534, 534, 534, 534, 534, 534, 534, 534, |
| 213 | 534, 534, 534, 534, 534, 534, 534, 534, 534, 0, |
| 214 | 0, 0, 0, 534, 534, -40, -28, 9, -228, 549, |
| 215 | 561, 0, 599, 611, 623, 825, 875, 875, -36, -36, |
| 216 | -36, -36, 494, 494, 494, 494, 536, 536, 70, 70, |
| 217 | -209, 534, 534, 599, 573, 0, 0, 0, 0, 30, |
| 218 | 0, 0, 0, -41, 599, -19, 0, 0, 534, 0, |
| 219 | 599,}; |
| 220 | const short yyrindex[] = |
| 221 | { 0, |
| 222 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 223 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 224 | 0, 0, 0, 1, 12, 74, 0, 0, 0, 0, |
| 225 | 75, 14, 0, 0, 0, 0, 0, 0, 0, 0, |
| 226 | 0, 0, 0, 36, 0, 59, 89, 0, 0, 0, |
| 227 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 228 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 229 | 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, |
| 230 | 0, 0, 32, 504, 49, 16, 82, 491, 445, 456, |
| 231 | 469, 482, 170, 183, 196, 287, 146, 158, 112, 124, |
| 232 | 0, 0, -15, 229, 0, 0, 0, 24, 0, 0, |
| 233 | 0, 0, 0, 0, -14, 0, 0, 0, 0, 0, |
| 234 | -13,}; |
| 235 | const short yygindex[] = |
| 236 | { 0, |
| 237 | 893, -3, 0, 0, 0, 0, -2, -8, 0, 11, |
| 238 | 0, 0, 0, 0, 0, 0, 0, |
| 239 | }; |
| 240 | #define YYTABLESIZE 1160 |
| 241 | const short yytable[] = |
| 242 | { 31, |
| 243 | 72, 106, 74, 72, 42, 68, 66, 23, 67, 70, |
| 244 | 69, 6, 48, 60, 51, 39, 82, 49, 50, 74, |
| 245 | 41, 120, 43, 55, 119, 20, 21, 22, 20, 21, |
| 246 | 22, 42, 74, 79, 75, 11, 76, 77, 110, 78, |
| 247 | 72, 72, 72, 72, 72, 72, 72, 72, 40, 109, |
| 248 | 113, 118, 6, 60, 71, 6, 39, 73, 9, 39, |
| 249 | 72, 72, 72, 55, 55, 55, 55, 55, 55, 55, |
| 250 | 55, 106, 42, 3, 5, 42, 11, 11, 11, 11, |
| 251 | 11, 33, 11, 55, 55, 55, 107, 108, 10, 40, |
| 252 | 60, 72, 40, 72, 72, 11, 11, 11, 114, 9, |
| 253 | 9, 9, 9, 9, 6, 9, 0, 0, 39, 72, |
| 254 | 0, 25, 0, 0, 55, 70, 55, 55, 9, 9, |
| 255 | 9, 0, 33, 26, 42, 33, 0, 0, 11, 10, |
| 256 | 10, 10, 10, 10, 0, 10, 0, 0, 0, 0, |
| 257 | 0, 40, 33, 0, 0, 29, 0, 0, 10, 10, |
| 258 | 10, 9, 25, 25, 25, 25, 25, 30, 25, 0, |
| 259 | 71, 0, 0, 73, 26, 26, 26, 26, 26, 31, |
| 260 | 26, 25, 25, 25, 33, 7, 0, 9, 10, 0, |
| 261 | 0, 10, 32, 26, 26, 26, 29, 0, 29, 29, |
| 262 | 29, 0, 0, 0, 0, 27, 0, 0, 30, 0, |
| 263 | 30, 30, 30, 0, 25, 29, 29, 29, 0, 0, |
| 264 | 31, 0, 0, 31, 0, 0, 26, 30, 30, 30, |
| 265 | 36, 37, 38, 32, 0, 0, 32, 0, 7, 31, |
| 266 | 31, 31, 36, 37, 38, 0, 27, 0, 29, 27, |
| 267 | 0, 0, 32, 32, 32, 62, 63, 64, 65, 39, |
| 268 | 30, 0, 0, 0, 0, 27, 27, 27, 0, 0, |
| 269 | 0, 39, 31, 0, 0, 0, 0, 53, 0, 7, |
| 270 | 0, 0, 7, 0, 72, 32, 72, 72, 72, 72, |
| 271 | 72, 72, 72, 72, 72, 72, 28, 0, 27, 39, |
| 272 | 54, 39, 39, 39, 0, 0, 0, 55, 0, 55, |
| 273 | 55, 55, 55, 55, 55, 55, 55, 55, 55, 11, |
| 274 | 0, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
| 275 | 11, 7, 40, 0, 40, 40, 0, 28, 0, 0, |
| 276 | 28, 0, 9, 0, 9, 9, 9, 9, 9, 9, |
| 277 | 9, 9, 9, 9, 0, 0, 28, 28, 28, 0, |
| 278 | 0, 0, 0, 0, 0, 33, 0, 33, 33, 33, |
| 279 | 33, 0, 10, 0, 10, 10, 10, 10, 10, 10, |
| 280 | 10, 10, 10, 10, 0, 0, 0, 0, 0, 28, |
| 281 | 0, 0, 0, 0, 0, 25, 0, 25, 25, 25, |
| 282 | 25, 25, 25, 25, 25, 25, 25, 26, 0, 26, |
| 283 | 26, 26, 26, 26, 26, 26, 26, 26, 26, 0, |
| 284 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, |
| 285 | 0, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
| 286 | 29, 30, 0, 30, 30, 30, 30, 30, 30, 30, |
| 287 | 30, 30, 30, 31, 37, 31, 31, 31, 31, 31, |
| 288 | 31, 31, 31, 31, 31, 38, 32, 0, 32, 32, |
| 289 | 32, 32, 32, 32, 32, 32, 32, 32, 35, 27, |
| 290 | 0, 27, 27, 27, 27, 27, 27, 27, 27, 27, |
| 291 | 27, 36, 0, 0, 0, 37, 0, 0, 37, 0, |
| 292 | 34, 0, 0, 0, 0, 0, 38, 0, 0, 38, |
| 293 | 0, 0, 0, 41, 37, 37, 37, 0, 0, 35, |
| 294 | 0, 0, 35, 0, 0, 38, 38, 38, 0, 0, |
| 295 | 0, 0, 36, 0, 0, 36, 0, 0, 35, 35, |
| 296 | 35, 34, 0, 72, 34, 68, 66, 37, 67, 70, |
| 297 | 69, 36, 36, 36, 41, 0, 0, 41, 38, 0, |
| 298 | 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, |
| 299 | 28, 35, 28, 28, 28, 28, 28, 28, 28, 28, |
| 300 | 28, 28, 0, 22, 36, 72, 0, 68, 19, 0, |
| 301 | 0, 70, 69, 34, 71, 0, 0, 73, 72, 111, |
| 302 | 68, 66, 0, 67, 70, 69, 41, 18, 0, 0, |
| 303 | 72, 112, 68, 66, 0, 67, 70, 69, 58, 56, |
| 304 | 59, 0, 72, 117, 68, 66, 0, 67, 70, 69, |
| 305 | 58, 56, 59, 0, 0, 0, 71, 23, 0, 73, |
| 306 | 0, 0, 58, 56, 59, 0, 0, 0, 72, 71, |
| 307 | 68, 66, 73, 67, 70, 69, 0, 0, 0, 0, |
| 308 | 72, 71, 68, 66, 73, 67, 70, 69, 58, 56, |
| 309 | 59, 0, 72, 71, 68, 66, 73, 67, 70, 69, |
| 310 | 58, 56, 59, 0, 0, 0, 0, 0, 0, 0, |
| 311 | 0, 0, 58, 56, 59, 0, 0, 0, 0, 71, |
| 312 | 0, 0, 73, 0, 0, 0, 0, 0, 0, 0, |
| 313 | 0, 71, 0, 0, 73, 0, 0, 0, 0, 0, |
| 314 | 0, 0, 0, 71, 0, 0, 73, 0, 37, 0, |
| 315 | 37, 37, 37, 37, 37, 37, 0, 0, 0, 38, |
| 316 | 0, 38, 38, 38, 38, 38, 38, 0, 0, 0, |
| 317 | 0, 0, 35, 0, 35, 35, 35, 35, 35, 35, |
| 318 | 0, 0, 0, 0, 0, 36, 0, 36, 36, 36, |
| 319 | 36, 36, 36, 0, 34, 0, 34, 34, 34, 34, |
| 320 | 0, 0, 0, 0, 0, 0, 0, 41, 0, 41, |
| 321 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 322 | 3, 4, 5, 0, 6, 7, 8, 9, 10, 11, |
| 323 | 12, 0, 13, 14, 15, 16, 0, 0, 17, 0, |
| 324 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 325 | 20, 21, 52, 24, 53, 54, 55, 57, 60, 61, |
| 326 | 62, 63, 64, 65, 52, 0, 53, 54, 55, 57, |
| 327 | 60, 61, 62, 63, 64, 65, 52, 0, 53, 54, |
| 328 | 55, 57, 60, 61, 62, 63, 64, 65, 0, 0, |
| 329 | 0, 0, 0, 0, 72, 0, 68, 66, 0, 67, |
| 330 | 70, 69, 52, 0, 53, 54, 55, 57, 60, 61, |
| 331 | 62, 63, 64, 65, 58, 56, 59, 54, 55, 57, |
| 332 | 60, 61, 62, 63, 64, 65, 0, 0, 0, 0, |
| 333 | 55, 57, 60, 61, 62, 63, 64, 65, 0, 44, |
| 334 | 46, 47, 0, 0, 72, 71, 68, 66, 73, 67, |
| 335 | 70, 69, 0, 0, 0, 0, 0, 0, 0, 0, |
| 336 | 0, 0, 0, 0, 58, 0, 59, 0, 0, 0, |
| 337 | 80, 81, 0, 0, 83, 84, 85, 86, 87, 88, |
| 338 | 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, |
| 339 | 99, 100, 0, 0, 0, 71, 104, 105, 73, 0, |
| 340 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 341 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 342 | 0, 0, 0, 0, 0, 115, 0, 0, 0, 0, |
| 343 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 344 | 0, 121, 0, 0, 0, 0, 0, 0, 0, 0, |
| 345 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 346 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 347 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 348 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 349 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 350 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 351 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 352 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 353 | 0, 0, 0, 57, 60, 61, 62, 63, 64, 65, |
| 354 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 355 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 356 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 357 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 358 | 0, 0, 0, 0, 60, 61, 62, 63, 64, 65, |
| 359 | }; |
| 360 | const short yycheck[] = |
| 361 | { 2, |
| 362 | 0, 42, 44, 40, 40, 42, 43, 94, 45, 46, |
| 363 | 47, 0, 40, 0, 23, 0, 41, 40, 22, 44, |
| 364 | 10, 41, 12, 0, 44, 41, 41, 41, 44, 44, |
| 365 | 44, 0, 44, 42, 40, 0, 267, 267, 267, 42, |
| 366 | 40, 41, 42, 43, 44, 45, 46, 47, 0, 41, |
| 367 | 260, 93, 41, 40, 91, 44, 41, 94, 0, 44, |
| 368 | 60, 61, 62, 40, 41, 42, 43, 44, 45, 46, |
| 369 | 47, 42, 41, 0, 0, 44, 41, 42, 43, 44, |
| 370 | 45, 0, 47, 60, 61, 62, 76, 77, 0, 41, |
| 371 | 41, 91, 44, 93, 94, 60, 61, 62, 102, 41, |
| 372 | 42, 43, 44, 45, 93, 47, -1, -1, 93, 40, |
| 373 | -1, 0, -1, -1, 91, 46, 93, 94, 60, 61, |
| 374 | 62, -1, 41, 0, 93, 44, -1, -1, 93, 41, |
| 375 | 42, 43, 44, 45, -1, 47, -1, -1, -1, -1, |
| 376 | -1, 93, 61, -1, -1, 0, -1, -1, 60, 61, |
| 377 | 62, 93, 41, 42, 43, 44, 45, 0, 47, -1, |
| 378 | 91, -1, -1, 94, 41, 42, 43, 44, 45, 0, |
| 379 | 47, 60, 61, 62, 93, 262, -1, 264, 265, -1, |
| 380 | -1, 93, 0, 60, 61, 62, 41, -1, 43, 44, |
| 381 | 45, -1, -1, -1, -1, 0, -1, -1, 41, -1, |
| 382 | 43, 44, 45, -1, 93, 60, 61, 62, -1, -1, |
| 383 | 41, -1, -1, 44, -1, -1, 93, 60, 61, 62, |
| 384 | 261, 262, 263, 41, -1, -1, 44, -1, 0, 60, |
| 385 | 61, 62, 261, 262, 263, -1, 41, -1, 93, 44, |
| 386 | -1, -1, 60, 61, 62, 282, 283, 284, 285, 290, |
| 387 | 93, -1, -1, -1, -1, 60, 61, 62, -1, -1, |
| 388 | -1, 290, 93, -1, -1, -1, -1, 267, -1, 41, |
| 389 | -1, -1, 44, -1, 274, 93, 276, 277, 278, 279, |
| 390 | 280, 281, 282, 283, 284, 285, 0, -1, 93, 274, |
| 391 | 267, 276, 277, 278, -1, -1, -1, 274, -1, 276, |
| 392 | 277, 278, 279, 280, 281, 282, 283, 284, 285, 274, |
| 393 | -1, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 394 | 285, 93, 274, -1, 276, 277, -1, 41, -1, -1, |
| 395 | 44, -1, 274, -1, 276, 277, 278, 279, 280, 281, |
| 396 | 282, 283, 284, 285, -1, -1, 60, 61, 62, -1, |
| 397 | -1, -1, -1, -1, -1, 274, -1, 276, 277, 278, |
| 398 | 279, -1, 274, -1, 276, 277, 278, 279, 280, 281, |
| 399 | 282, 283, 284, 285, -1, -1, -1, -1, -1, 93, |
| 400 | -1, -1, -1, -1, -1, 274, -1, 276, 277, 278, |
| 401 | 279, 280, 281, 282, 283, 284, 285, 274, -1, 276, |
| 402 | 277, 278, 279, 280, 281, 282, 283, 284, 285, -1, |
| 403 | -1, -1, -1, -1, -1, -1, -1, -1, -1, 274, |
| 404 | -1, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 405 | 285, 274, -1, 276, 277, 278, 279, 280, 281, 282, |
| 406 | 283, 284, 285, 274, 0, 276, 277, 278, 279, 280, |
| 407 | 281, 282, 283, 284, 285, 0, 274, -1, 276, 277, |
| 408 | 278, 279, 280, 281, 282, 283, 284, 285, 0, 274, |
| 409 | -1, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 410 | 285, 0, -1, -1, -1, 41, -1, -1, 44, -1, |
| 411 | 0, -1, -1, -1, -1, -1, 41, -1, -1, 44, |
| 412 | -1, -1, -1, 0, 60, 61, 62, -1, -1, 41, |
| 413 | -1, -1, 44, -1, -1, 60, 61, 62, -1, -1, |
| 414 | -1, -1, 41, -1, -1, 44, -1, -1, 60, 61, |
| 415 | 62, 41, -1, 40, 44, 42, 43, 93, 45, 46, |
| 416 | 47, 60, 61, 62, 41, -1, -1, 44, 93, -1, |
| 417 | -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, |
| 418 | 274, 93, 276, 277, 278, 279, 280, 281, 282, 283, |
| 419 | 284, 285, -1, 40, 93, 40, -1, 42, 45, -1, |
| 420 | -1, 46, 47, 93, 91, -1, -1, 94, 40, 41, |
| 421 | 42, 43, -1, 45, 46, 47, 93, 64, -1, -1, |
| 422 | 40, 41, 42, 43, -1, 45, 46, 47, 60, 61, |
| 423 | 62, -1, 40, 41, 42, 43, -1, 45, 46, 47, |
| 424 | 60, 61, 62, -1, -1, -1, 91, 94, -1, 94, |
| 425 | -1, -1, 60, 61, 62, -1, -1, -1, 40, 91, |
| 426 | 42, 43, 94, 45, 46, 47, -1, -1, -1, -1, |
| 427 | 40, 91, 42, 43, 94, 45, 46, 47, 60, 61, |
| 428 | 62, -1, 40, 91, 42, 43, 94, 45, 46, 47, |
| 429 | 60, 61, 62, -1, -1, -1, -1, -1, -1, -1, |
| 430 | -1, -1, 60, 61, 62, -1, -1, -1, -1, 91, |
| 431 | -1, -1, 94, -1, -1, -1, -1, -1, -1, -1, |
| 432 | -1, 91, -1, -1, 94, -1, -1, -1, -1, -1, |
| 433 | -1, -1, -1, 91, -1, -1, 94, -1, 274, -1, |
| 434 | 276, 277, 278, 279, 280, 281, -1, -1, -1, 274, |
| 435 | -1, 276, 277, 278, 279, 280, 281, -1, -1, -1, |
| 436 | -1, -1, 274, -1, 276, 277, 278, 279, 280, 281, |
| 437 | -1, -1, -1, -1, -1, 274, -1, 276, 277, 278, |
| 438 | 279, 280, 281, -1, 274, -1, 276, 277, 278, 279, |
| 439 | -1, -1, -1, -1, -1, -1, -1, 274, -1, 276, |
| 440 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 441 | 257, 258, 259, -1, 261, 262, 263, 264, 265, 266, |
| 442 | 267, -1, 269, 270, 271, 272, -1, -1, 275, -1, |
| 443 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 444 | 287, 288, 274, 290, 276, 277, 278, 279, 280, 281, |
| 445 | 282, 283, 284, 285, 274, -1, 276, 277, 278, 279, |
| 446 | 280, 281, 282, 283, 284, 285, 274, -1, 276, 277, |
| 447 | 278, 279, 280, 281, 282, 283, 284, 285, -1, -1, |
| 448 | -1, -1, -1, -1, 40, -1, 42, 43, -1, 45, |
| 449 | 46, 47, 274, -1, 276, 277, 278, 279, 280, 281, |
| 450 | 282, 283, 284, 285, 60, 61, 62, 277, 278, 279, |
| 451 | 280, 281, 282, 283, 284, 285, -1, -1, -1, -1, |
| 452 | 278, 279, 280, 281, 282, 283, 284, 285, -1, 17, |
| 453 | 18, 19, -1, -1, 40, 91, 42, 43, 94, 45, |
| 454 | 46, 47, -1, -1, -1, -1, -1, -1, -1, -1, |
| 455 | -1, -1, -1, -1, 60, -1, 62, -1, -1, -1, |
| 456 | 48, 49, -1, -1, 52, 53, 54, 55, 56, 57, |
| 457 | 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, |
| 458 | 68, 69, -1, -1, -1, 91, 74, 75, 94, -1, |
| 459 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 460 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 461 | -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, |
| 462 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 463 | -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, |
| 464 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 465 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 466 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 467 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 468 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 469 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 470 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 471 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 472 | -1, -1, -1, 279, 280, 281, 282, 283, 284, 285, |
| 473 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 474 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 475 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 476 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 477 | -1, -1, -1, -1, 280, 281, 282, 283, 284, 285, |
| 478 | }; |
| 479 | #define YYFINAL 1 |
| 480 | #ifndef YYDEBUG |
| 481 | #define YYDEBUG 0 |
| 482 | #endif |
| 483 | #define YYMAXTOKEN 290 |
| 484 | #if YYDEBUG |
| 485 | const char * const yyname[] = |
| 486 | { |
| 487 | "end-of-file",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,0,0,0,0,0,0,0, |
| 488 | 0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,0,0,0,0,0,0,0,0, |
| 489 | 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,0,0, |
| 490 | 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,0,0,0,0,0, |
| 491 | 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,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 492 | 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,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 493 | 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,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 494 | 0,0,0,0,0,0,0,0,0,0,0,0,0,"INT","FLOAT","STRING","FIELDNAME","NAME","TYPENAME", |
| 495 | "NAME_OR_INT","STRUCT","CLASS","SIZEOF","COLONCOLON","ERROR","VARIABLE","THIS", |
| 496 | "TRUEKEYWORD","FALSEKEYWORD","ABOVE_COMMA","ASSIGN","NOT","OR","XOR","ANDAND", |
| 497 | "NOTEQUAL","LEQ","GEQ","LSH","RSH","DIV","MOD","UNARY","INCREMENT","DECREMENT", |
| 498 | "ARROW","BLOCKNAME", |
| 499 | }; |
| 500 | const char * const yyrule[] = |
| 501 | {"$accept : start", |
| 502 | "$$1 :", |
| 503 | "start : $$1 normal_start", |
| 504 | "normal_start : exp1", |
| 505 | "normal_start : type_exp", |
| 506 | "type_exp : type", |
| 507 | "exp1 : exp", |
| 508 | "exp1 : exp1 ',' exp", |
| 509 | "exp : exp '^'", |
| 510 | "exp : '@' exp", |
| 511 | "exp : '-' exp", |
| 512 | "exp : NOT exp", |
| 513 | "exp : INCREMENT '(' exp ')'", |
| 514 | "exp : DECREMENT '(' exp ')'", |
| 515 | "$$2 :", |
| 516 | "exp : exp '.' $$2 FIELDNAME", |
| 517 | "$$3 :", |
| 518 | "exp : exp '[' $$3 exp1 ']'", |
| 519 | "$$4 :", |
| 520 | "exp : exp '(' $$4 arglist ')'", |
| 521 | "arglist :", |
| 522 | "arglist : exp", |
| 523 | "arglist : arglist ',' exp", |
| 524 | "exp : type '(' exp ')'", |
| 525 | "exp : '(' exp1 ')'", |
| 526 | "exp : exp '*' exp", |
| 527 | "exp : exp '/' exp", |
| 528 | "exp : exp DIV exp", |
| 529 | "exp : exp MOD exp", |
| 530 | "exp : exp '+' exp", |
| 531 | "exp : exp '-' exp", |
| 532 | "exp : exp LSH exp", |
| 533 | "exp : exp RSH exp", |
| 534 | "exp : exp '=' exp", |
| 535 | "exp : exp NOTEQUAL exp", |
| 536 | "exp : exp LEQ exp", |
| 537 | "exp : exp GEQ exp", |
| 538 | "exp : exp '<' exp", |
| 539 | "exp : exp '>' exp", |
| 540 | "exp : exp ANDAND exp", |
| 541 | "exp : exp XOR exp", |
| 542 | "exp : exp OR exp", |
| 543 | "exp : exp ASSIGN exp", |
| 544 | "exp : TRUEKEYWORD", |
| 545 | "exp : FALSEKEYWORD", |
| 546 | "exp : INT", |
| 547 | "exp : NAME_OR_INT", |
| 548 | "exp : FLOAT", |
| 549 | "exp : variable", |
| 550 | "exp : VARIABLE", |
| 551 | "exp : SIZEOF '(' type ')'", |
| 552 | "exp : STRING", |
| 553 | "exp : THIS", |
| 554 | "block : BLOCKNAME", |
| 555 | "block : block COLONCOLON name", |
| 556 | "variable : block COLONCOLON name", |
| 557 | "qualified_name : typebase COLONCOLON name", |
| 558 | "variable : qualified_name", |
| 559 | "variable : COLONCOLON name", |
| 560 | "variable : name_not_typename", |
| 561 | "ptype : typebase", |
| 562 | "type : ptype", |
| 563 | "type : typebase COLONCOLON '*'", |
| 564 | "typebase : '^' typebase", |
| 565 | "typebase : TYPENAME", |
| 566 | "typebase : STRUCT name", |
| 567 | "typebase : CLASS name", |
| 568 | "name : NAME", |
| 569 | "name : BLOCKNAME", |
| 570 | "name : TYPENAME", |
| 571 | "name : NAME_OR_INT", |
| 572 | "name_not_typename : NAME", |
| 573 | "name_not_typename : BLOCKNAME", |
| 574 | }; |
| 575 | #endif |
| 576 | #ifdef YYSTACKSIZE |
| 577 | #undef YYMAXDEPTH |
| 578 | #define YYMAXDEPTH YYSTACKSIZE |
| 579 | #else |
| 580 | #ifdef YYMAXDEPTH |
| 581 | #define YYSTACKSIZE YYMAXDEPTH |
| 582 | #else |
| 583 | #define YYSTACKSIZE 10000 |
| 584 | #define YYMAXDEPTH 10000 |
| 585 | #endif |
| 586 | #endif |
| 587 | #define YYINITSTACKSIZE 200 |
| 588 | |
| 589 | int yydebug; |
| 590 | int yynerrs; |
| 591 | int yyerrflag; |
| 592 | int yychar; |
| 593 | short *yyssp; |
| 594 | YYSTYPE *yyvsp; |
| 595 | YYSTYPE yyval; |
| 596 | YYSTYPE yylval; |
| 597 | short *yyss; |
| 598 | short *yysslim; |
| 599 | YYSTYPE *yyvs; |
| 600 | unsigned int yystacksize; |
| 601 | int yyparse(void); |
| 602 | #line 758 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 603 | |
| 604 | |
| 605 | |
| 606 | |
| 607 | |
| 608 | |
| 609 | |
| 610 | static int |
| 611 | parse_number (p, len, parsed_float, putithere) |
| 612 | char *p; |
| 613 | int len; |
| 614 | int parsed_float; |
| 615 | YYSTYPE *putithere; |
| 616 | { |
| 617 | |
| 618 | |
| 619 | LONGEST n = 0; |
| 620 | LONGEST prevn = 0; |
| 621 | ULONGEST un; |
| 622 | |
| 623 | int i = 0; |
| 624 | int c; |
| 625 | int base = input_radix; |
| 626 | int unsigned_p = 0; |
| 627 | |
| 628 | |
| 629 | int long_p = 0; |
| 630 | |
| 631 | |
| 632 | int found_suffix = 0; |
| 633 | |
| 634 | ULONGEST high_bit; |
| 635 | struct type *signed_type; |
| 636 | struct type *unsigned_type; |
| 637 | |
| 638 | if (parsed_float) |
| |
| 639 | { |
| 640 | |
| 641 | char c; |
| 642 | int num = 0; |
| 643 | char saved_char = p[len]; |
| 644 | |
| 645 | p[len] = 0; |
| 646 | if (sizeof (putithere->typed_val_float.dval) <= sizeof (float)) |
| 647 | num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval,&c); |
| 648 | else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double)) |
| 649 | num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval,&c); |
| 650 | else |
| 651 | { |
| 652 | #ifdef SCANF_HAS_LONG_DOUBLE |
| 653 | num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval,&c); |
| 654 | #else |
| 655 | |
| 656 | |
| 657 | |
| 658 | double temp; |
| 659 | num = sscanf (p, "%lg%c", &temp,&c); |
| 660 | putithere->typed_val_float.dval = temp; |
| 661 | #endif |
| 662 | } |
| 663 | p[len] = saved_char; |
| 664 | if (num != 1) |
| 665 | return ERROR; |
| 666 | |
| 667 | |
| 668 | c = tolower (p[len - 1]); |
| 669 | |
| 670 | if (c == 'f') |
| 671 | putithere->typed_val_float.type = builtin_type_float; |
| 672 | else if (c == 'l') |
| 673 | putithere->typed_val_float.type = builtin_type_long_double; |
| 674 | else if (isdigit (c) || c == '.') |
| 675 | putithere->typed_val_float.type = builtin_type_double; |
| 676 | else |
| 677 | return ERROR; |
| 678 | |
| 679 | return FLOAT; |
| 680 | } |
| 681 | |
| 682 | |
| 683 | if (p[0] == '0') |
| 48 | | Assuming the condition is false | |
|
| |
| 684 | switch (p[1]) |
| 685 | { |
| 686 | case 'x': |
| 687 | case 'X': |
| 688 | if (len >= 3) |
| 689 | { |
| 690 | p += 2; |
| 691 | base = 16; |
| 692 | len -= 2; |
| 693 | } |
| 694 | break; |
| 695 | |
| 696 | case 't': |
| 697 | case 'T': |
| 698 | case 'd': |
| 699 | case 'D': |
| 700 | if (len >= 3) |
| 701 | { |
| 702 | p += 2; |
| 703 | base = 10; |
| 704 | len -= 2; |
| 705 | } |
| 706 | break; |
| 707 | |
| 708 | default: |
| 709 | base = 8; |
| 710 | break; |
| 711 | } |
| 712 | |
| 713 | while (len-- > 0) |
| 50 | | Assuming the condition is true | |
|
| 51 | | Loop condition is true. Entering loop body | |
|
| 714 | { |
| 715 | c = *p++; |
| 716 | if (c >= 'A' && c <= 'Z') |
| 52 | | Assuming the condition is false | |
|
| 717 | c += 'a' - 'A'; |
| 718 | if (c != 'l' && c != 'u') |
| |
| 719 | n *= base; |
| 720 | if (c >= '0' && c <= '9') |
| 54 | | Assuming the condition is false | |
|
| 721 | { |
| 722 | if (found_suffix) |
| 723 | return ERROR; |
| 724 | n += i = c - '0'; |
| 725 | } |
| 726 | else |
| 727 | { |
| 728 | if (base > 10 && c >= 'a' && c <= 'f') |
| 55 | | Assuming 'base' is <= 10 | |
|
| 729 | { |
| 730 | if (found_suffix) |
| 731 | return ERROR; |
| 732 | n += i = c - 'a' + 10; |
| 733 | } |
| 734 | else if (c == 'l') |
| |
| 735 | { |
| 736 | ++long_p; |
| 737 | found_suffix = 1; |
| 738 | } |
| 739 | else if (c == 'u') |
| |
| 740 | { |
| 741 | unsigned_p = 1; |
| 742 | found_suffix = 1; |
| 743 | } |
| 744 | else |
| 745 | return ERROR; |
| 58 | | Returning without writing to 'putithere->typed_val_int.type' | |
|
| 746 | } |
| 747 | if (i >= base) |
| 748 | return ERROR; |
| 749 | |
| 750 | |
| 751 | |
| 752 | |
| 753 | if (c != 'l' && c != 'u' && (prevn >= n) && n != 0) |
| 754 | unsigned_p = 1; |
| 755 | |
| 756 | |
| 757 | |
| 758 | |
| 759 | if (c != 'l' && c != 'u' && n != 0) |
| 760 | { |
| 761 | if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n)) |
| 762 | error ("Numeric constant too large."); |
| 763 | } |
| 764 | prevn = n; |
| 765 | } |
| 766 | |
| 767 | |
| 768 | |
| 769 | |
| 770 | |
| 771 | |
| 772 | |
| 773 | |
| 774 | |
| 775 | |
| 776 | |
| 777 | |
| 778 | |
| 779 | un = (ULONGEST)n >> 2; |
| 780 | if (long_p == 0 |
| 781 | && (un >> (TARGET_INT_BIT - 2)) == 0) |
| 782 | { |
| 783 | high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1); |
| 784 | |
| 785 | |
| 786 | |
| 787 | |
| 788 | |
| 789 | |
| 790 | |
| 791 | unsigned_type = builtin_type_unsigned_int; |
| 792 | signed_type = builtin_type_int; |
| 793 | } |
| 794 | else if (long_p <= 1 |
| 795 | && (un >> (TARGET_LONG_BIT - 2)) == 0) |
| 796 | { |
| 797 | high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1); |
| 798 | unsigned_type = builtin_type_unsigned_long; |
| 799 | signed_type = builtin_type_long; |
| 800 | } |
| 801 | else |
| 802 | { |
| 803 | int shift; |
| 804 | if (sizeof (ULONGEST) * HOST_CHAR_BIT < TARGET_LONG_LONG_BIT) |
| 805 | |
| 806 | shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1); |
| 807 | else |
| 808 | shift = (TARGET_LONG_LONG_BIT - 1); |
| 809 | high_bit = (ULONGEST) 1 << shift; |
| 810 | unsigned_type = builtin_type_unsigned_long_long; |
| 811 | signed_type = builtin_type_long_long; |
| 812 | } |
| 813 | |
| 814 | putithere->typed_val_int.val = n; |
| 815 | |
| 816 | |
| 817 | |
| 818 | |
| 819 | if (unsigned_p || (n & high_bit)) |
| 820 | { |
| 821 | putithere->typed_val_int.type = unsigned_type; |
| 822 | } |
| 823 | else |
| 824 | { |
| 825 | putithere->typed_val_int.type = signed_type; |
| 826 | } |
| 827 | |
| 828 | return INT; |
| 829 | } |
| 830 | |
| 831 | |
| 832 | struct type_push |
| 833 | { |
| 834 | struct type *stored; |
| 835 | struct type_push *next; |
| 836 | }; |
| 837 | |
| 838 | static struct type_push *tp_top = NULL; |
| 839 | |
| 840 | static void |
| 841 | push_current_type (void) |
| 842 | { |
| 843 | struct type_push *tpnew; |
| 844 | tpnew = (struct type_push *) xmalloc (sizeof (struct type_push)); |
| 845 | tpnew->next = tp_top; |
| 846 | tpnew->stored = current_type; |
| 847 | current_type = NULL; |
| 848 | tp_top = tpnew; |
| 849 | } |
| 850 | |
| 851 | static void |
| 852 | pop_current_type (void) |
| 853 | { |
| 854 | struct type_push *tp = tp_top; |
| 855 | if (tp) |
| 856 | { |
| 857 | current_type = tp->stored; |
| 858 | tp_top = tp->next; |
| 859 | xfree (tp); |
| 860 | } |
| 861 | } |
| 862 | |
| 863 | struct token |
| 864 | { |
| 865 | char *operator; |
| 866 | int token; |
| 867 | enum exp_opcode opcode; |
| 868 | }; |
| 869 | |
| 870 | static const struct token tokentab3[] = |
| 871 | { |
| 872 | {"shr", RSH, BINOP_END}, |
| 873 | {"shl", LSH, BINOP_END}, |
| 874 | {"and", ANDAND, BINOP_END}, |
| 875 | {"div", DIV, BINOP_END}, |
| 876 | {"not", NOT, BINOP_END}, |
| 877 | {"mod", MOD, BINOP_END}, |
| 878 | {"inc", INCREMENT, BINOP_END}, |
| 879 | {"dec", DECREMENT, BINOP_END}, |
| 880 | {"xor", XOR, BINOP_END} |
| 881 | }; |
| 882 | |
| 883 | static const struct token tokentab2[] = |
| 884 | { |
| 885 | {"or", OR, BINOP_END}, |
| 886 | {"<>", NOTEQUAL, BINOP_END}, |
| 887 | {"<=", LEQ, BINOP_END}, |
| 888 | {">=", GEQ, BINOP_END}, |
| 889 | {":=", ASSIGN, BINOP_END}, |
| 890 | {"::", COLONCOLON, BINOP_END} }; |
| 891 | |
| 892 | |
| 893 | |
| 894 | static char * uptok (tokstart, namelen) |
| 895 | char *tokstart; |
| 896 | int namelen; |
| 897 | { |
| 898 | int i; |
| 899 | char *uptokstart = (char *)xmalloc(namelen+1); |
| 900 | for (i = 0;i <= namelen;i++) |
| 901 | { |
| 902 | if ((tokstart[i]>='a' && tokstart[i]<='z')) |
| 903 | uptokstart[i] = tokstart[i]-('a'-'A'); |
| 904 | else |
| 905 | uptokstart[i] = tokstart[i]; |
| 906 | } |
| 907 | uptokstart[namelen]='\0'; |
| 908 | return uptokstart; |
| 909 | } |
| 910 | |
| 911 | |
| 912 | |
| 913 | static int |
| 914 | yylex () |
| 915 | { |
| 916 | int c; |
| 917 | int namelen; |
| 918 | unsigned int i; |
| 919 | char *tokstart; |
| 920 | char *uptokstart; |
| 921 | char *tokptr; |
| 922 | char *p; |
| 923 | int explen, tempbufindex; |
| 924 | static char *tempbuf; |
| 925 | static int tempbufsize; |
| 926 | |
| 927 | retry: |
| 928 | |
| 929 | prev_lexptr = lexptr; |
| 930 | |
| 931 | tokstart = lexptr; |
| 932 | explen = strlen (lexptr); |
| 933 | |
| 934 | if (explen > 2) |
| 935 | for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++) |
| 936 | if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0 |
| 937 | && (!isalpha (tokentab3[i].operator[0]) || explen == 3 |
| 938 | || (!isalpha (tokstart[3]) && !isdigit (tokstart[3]) && tokstart[3] != '_'))) |
| 939 | { |
| 940 | lexptr += 3; |
| 941 | yylval.opcode = tokentab3[i].opcode; |
| 942 | return tokentab3[i].token; |
| 943 | } |
| 944 | |
| 945 | |
| 946 | if (explen > 1) |
| 947 | for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++) |
| 948 | if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0 |
| 949 | && (!isalpha (tokentab2[i].operator[0]) || explen == 2 |
| 950 | || (!isalpha (tokstart[2]) && !isdigit (tokstart[2]) && tokstart[2] != '_'))) |
| 951 | { |
| 952 | lexptr += 2; |
| 953 | yylval.opcode = tokentab2[i].opcode; |
| 954 | return tokentab2[i].token; |
| 955 | } |
| 956 | |
| 957 | switch (c = *tokstart) |
| 958 | { |
| 959 | case 0: |
| 960 | return 0; |
| 961 | |
| 962 | case ' ': |
| 963 | case '\t': |
| 964 | case '\n': |
| 965 | lexptr++; |
| 966 | goto retry; |
| 967 | |
| 968 | case '\'': |
| 969 | |
| 970 | |
| 971 | |
| 972 | lexptr++; |
| 973 | c = *lexptr++; |
| 974 | if (c == '\\') |
| 975 | c = parse_escape (&lexptr); |
| 976 | else if (c == '\'') |
| 977 | error ("Empty character constant."); |
| 978 | |
| 979 | yylval.typed_val_int.val = c; |
| 980 | yylval.typed_val_int.type = builtin_type_char; |
| 981 | |
| 982 | c = *lexptr++; |
| 983 | if (c != '\'') |
| 984 | { |
| 985 | namelen = skip_quoted (tokstart) - tokstart; |
| 986 | if (namelen > 2) |
| 987 | { |
| 988 | lexptr = tokstart + namelen; |
| 989 | if (lexptr[-1] != '\'') |
| 990 | error ("Unmatched single quote."); |
| 991 | namelen -= 2; |
| 992 | tokstart++; |
| 993 | uptokstart = uptok(tokstart,namelen); |
| 994 | goto tryname; |
| 995 | } |
| 996 | error ("Invalid character constant."); |
| 997 | } |
| 998 | return INT; |
| 999 | |
| 1000 | case '(': |
| 1001 | paren_depth++; |
| 1002 | lexptr++; |
| 1003 | return c; |
| 1004 | |
| 1005 | case ')': |
| 1006 | if (paren_depth == 0) |
| 1007 | return 0; |
| 1008 | paren_depth--; |
| 1009 | lexptr++; |
| 1010 | return c; |
| 1011 | |
| 1012 | case ',': |
| 1013 | if (comma_terminates && paren_depth == 0) |
| 1014 | return 0; |
| 1015 | lexptr++; |
| 1016 | return c; |
| 1017 | |
| 1018 | case '.': |
| 1019 | |
| 1020 | if (lexptr[1] < '0' || lexptr[1] > '9') |
| 1021 | goto symbol; |
| 1022 | |
| 1023 | |
| 1024 | case '0': |
| 1025 | case '1': |
| 1026 | case '2': |
| 1027 | case '3': |
| 1028 | case '4': |
| 1029 | case '5': |
| 1030 | case '6': |
| 1031 | case '7': |
| 1032 | case '8': |
| 1033 | case '9': |
| 1034 | { |
| 1035 | |
| 1036 | int got_dot = 0, got_e = 0, toktype; |
| 1037 | char *p = tokstart; |
| 1038 | int hex = input_radix > 10; |
| 1039 | |
| 1040 | if (c == '0' && (p[1] == 'x' || p[1] == 'X')) |
| 1041 | { |
| 1042 | p += 2; |
| 1043 | hex = 1; |
| 1044 | } |
| 1045 | else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D')) |
| 1046 | { |
| 1047 | p += 2; |
| 1048 | hex = 0; |
| 1049 | } |
| 1050 | |
| 1051 | for (;; ++p) |
| 1052 | { |
| 1053 | |
| 1054 | |
| 1055 | |
| 1056 | if (!hex && !got_e && (*p == 'e' || *p == 'E')) |
| 1057 | got_dot = got_e = 1; |
| 1058 | |
| 1059 | |
| 1060 | else if (!got_dot && *p == '.') |
| 1061 | got_dot = 1; |
| 1062 | else if (got_e && (p[-1] == 'e' || p[-1] == 'E') |
| 1063 | && (*p == '-' || *p == '+')) |
| 1064 | |
| 1065 | |
| 1066 | continue; |
| 1067 | |
| 1068 | |
| 1069 | else if ((*p < '0' || *p > '9') |
| 1070 | && ((*p < 'a' || *p > 'z') |
| 1071 | && (*p < 'A' || *p > 'Z'))) |
| 1072 | break; |
| 1073 | } |
| 1074 | toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval); |
| 1075 | if (toktype == ERROR) |
| 1076 | { |
| 1077 | char *err_copy = (char *) alloca (p - tokstart + 1); |
| 1078 | |
| 1079 | memcpy (err_copy, tokstart, p - tokstart); |
| 1080 | err_copy[p - tokstart] = 0; |
| 1081 | error ("Invalid number \"%s\".", err_copy); |
| 1082 | } |
| 1083 | lexptr = p; |
| 1084 | return toktype; |
| 1085 | } |
| 1086 | |
| 1087 | case '+': |
| 1088 | case '-': |
| 1089 | case '*': |
| 1090 | case '/': |
| 1091 | case '|': |
| 1092 | case '&': |
| 1093 | case '^': |
| 1094 | case '~': |
| 1095 | case '!': |
| 1096 | case '@': |
| 1097 | case '<': |
| 1098 | case '>': |
| 1099 | case '[': |
| 1100 | case ']': |
| 1101 | case '?': |
| 1102 | case ':': |
| 1103 | case '=': |
| 1104 | case '{': |
| 1105 | case '}': |
| 1106 | symbol: |
| 1107 | lexptr++; |
| 1108 | return c; |
| 1109 | |
| 1110 | case '"': |
| 1111 | |
| 1112 | |
| 1113 | |
| 1114 | |
| 1115 | |
| 1116 | |
| 1117 | |
| 1118 | |
| 1119 | |
| 1120 | |
| 1121 | tokptr = ++tokstart; |
| 1122 | tempbufindex = 0; |
| 1123 | |
| 1124 | do { |
| 1125 | |
| 1126 | |
| 1127 | if (tempbufindex + 1 >= tempbufsize) |
| 1128 | { |
| 1129 | tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64); |
| 1130 | } |
| 1131 | |
| 1132 | switch (*tokptr) |
| 1133 | { |
| 1134 | case '\0': |
| 1135 | case '"': |
| 1136 | |
| 1137 | break; |
| 1138 | case '\\': |
| 1139 | tokptr++; |
| 1140 | c = parse_escape (&tokptr); |
| 1141 | if (c == -1) |
| 1142 | { |
| 1143 | continue; |
| 1144 | } |
| 1145 | tempbuf[tempbufindex++] = c; |
| 1146 | break; |
| 1147 | default: |
| 1148 | tempbuf[tempbufindex++] = *tokptr++; |
| 1149 | break; |
| 1150 | } |
| 1151 | } while ((*tokptr != '"') && (*tokptr != '\0')); |
| 1152 | if (*tokptr++ != '"') |
| 1153 | { |
| 1154 | error ("Unterminated string in expression."); |
| 1155 | } |
| 1156 | tempbuf[tempbufindex] = '\0'; |
| 1157 | yylval.sval.ptr = tempbuf; |
| 1158 | yylval.sval.length = tempbufindex; |
| 1159 | lexptr = tokptr; |
| 1160 | return (STRING); |
| 1161 | } |
| 1162 | |
| 1163 | if (!(c == '_' || c == '$' |
| 1164 | || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) |
| 1165 | |
| 1166 | error ("Invalid character '%c' in expression.", c); |
| 1167 | |
| 1168 | |
| 1169 | namelen = 0; |
| 1170 | for (c = tokstart[namelen]; |
| 1171 | (c == '_' || c == '$' || (c >= '0' && c <= '9') |
| 1172 | || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');) |
| 1173 | { |
| 1174 | |
| 1175 | |
| 1176 | if (c == '<') |
| 1177 | { |
| 1178 | int i = namelen; |
| 1179 | int nesting_level = 1; |
| 1180 | while (tokstart[++i]) |
| 1181 | { |
| 1182 | if (tokstart[i] == '<') |
| 1183 | nesting_level++; |
| 1184 | else if (tokstart[i] == '>') |
| 1185 | { |
| 1186 | if (--nesting_level == 0) |
| 1187 | break; |
| 1188 | } |
| 1189 | } |
| 1190 | if (tokstart[i] == '>') |
| 1191 | namelen = i; |
| 1192 | else |
| 1193 | break; |
| 1194 | } |
| 1195 | |
| 1196 | |
| 1197 | c = tokstart[++namelen]; |
| 1198 | } |
| 1199 | |
| 1200 | uptokstart = uptok(tokstart,namelen); |
| 1201 | |
| 1202 | |
| 1203 | |
| 1204 | if (namelen == 2 && uptokstart[0] == 'I' && uptokstart[1] == 'F') |
| 1205 | { |
| 1206 | return 0; |
| 1207 | } |
| 1208 | |
| 1209 | lexptr += namelen; |
| 1210 | |
| 1211 | tryname: |
| 1212 | |
| 1213 | |
| 1214 | switch (namelen) |
| 1215 | { |
| 1216 | case 6: |
| 1217 | if (DEPRECATED_STREQ (uptokstart, "OBJECT")) |
| 1218 | return CLASS; |
| 1219 | if (DEPRECATED_STREQ (uptokstart, "RECORD")) |
| 1220 | return STRUCT; |
| 1221 | if (DEPRECATED_STREQ (uptokstart, "SIZEOF")) |
| 1222 | return SIZEOF; |
| 1223 | break; |
| 1224 | case 5: |
| 1225 | if (DEPRECATED_STREQ (uptokstart, "CLASS")) |
| 1226 | return CLASS; |
| 1227 | if (DEPRECATED_STREQ (uptokstart, "FALSE")) |
| 1228 | { |
| 1229 | yylval.lval = 0; |
| 1230 | return FALSEKEYWORD; |
| 1231 | } |
| 1232 | break; |
| 1233 | case 4: |
| 1234 | if (DEPRECATED_STREQ (uptokstart, "TRUE")) |
| 1235 | { |
| 1236 | yylval.lval = 1; |
| 1237 | return TRUEKEYWORD; |
| 1238 | } |
| 1239 | if (DEPRECATED_STREQ (uptokstart, "SELF")) |
| 1240 | { |
| 1241 | |
| 1242 | |
| 1243 | static const char this_name[] = "this"; |
| 1244 | |
| 1245 | if (lookup_symbol (this_name, expression_context_block, |
| 1246 | VAR_DOMAIN, (int *) NULL, |
| 1247 | (struct symtab **) NULL)) |
| 1248 | return THIS; |
| 1249 | } |
| 1250 | break; |
| 1251 | default: |
| 1252 | break; |
| 1253 | } |
| 1254 | |
| 1255 | yylval.sval.ptr = tokstart; |
| 1256 | yylval.sval.length = namelen; |
| 1257 | |
| 1258 | if (*tokstart == '$') |
| 1259 | { |
| 1260 | |
| 1261 | |
| 1262 | |
| 1263 | |
| 1264 | write_dollar_variable (yylval.sval); |
| 1265 | return VARIABLE; |
| 1266 | } |
| 1267 | |
| 1268 | |
| 1269 | |
| 1270 | |
| 1271 | |
| 1272 | |
| 1273 | { |
| 1274 | char *tmp = copy_name (yylval.sval); |
| 1275 | struct symbol *sym; |
| 1276 | int is_a_field_of_this = 0; |
| 1277 | int is_a_field = 0; |
| 1278 | int hextype; |
| 1279 | |
| 1280 | |
| 1281 | if (search_field && current_type) |
| 1282 | is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); |
| 1283 | if (is_a_field) |
| 1284 | sym = NULL; |
| 1285 | else |
| 1286 | sym = lookup_symbol (tmp, expression_context_block, |
| 1287 | VAR_DOMAIN, |
| 1288 | &is_a_field_of_this, |
| 1289 | (struct symtab **) NULL); |
| 1290 | |
| 1291 | if (!sym && !is_a_field_of_this && !is_a_field) |
| 1292 | { |
| 1293 | for (i = 0; i <= namelen; i++) |
| 1294 | { |
| 1295 | if ((tmp[i] >= 'a' && tmp[i] <= 'z')) |
| 1296 | tmp[i] -= ('a'-'A'); |
| 1297 | } |
| 1298 | if (search_field && current_type) |
| 1299 | is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); |
| 1300 | if (is_a_field) |
| 1301 | sym = NULL; |
| 1302 | else |
| 1303 | sym = lookup_symbol (tmp, expression_context_block, |
| 1304 | VAR_DOMAIN, |
| 1305 | &is_a_field_of_this, |
| 1306 | (struct symtab **) NULL); |
| 1307 | if (sym || is_a_field_of_this || is_a_field) |
| 1308 | for (i = 0; i <= namelen; i++) |
| 1309 | { |
| 1310 | if ((tokstart[i] >= 'a' && tokstart[i] <= 'z')) |
| 1311 | tokstart[i] -= ('a'-'A'); |
| 1312 | } |
| 1313 | } |
| 1314 | |
| 1315 | if (!sym && !is_a_field_of_this && !is_a_field) |
| 1316 | { |
| 1317 | for (i = 0; i <= namelen; i++) |
| 1318 | { |
| 1319 | if (i == 0) |
| 1320 | { |
| 1321 | if ((tmp[i] >= 'a' && tmp[i] <= 'z')) |
| 1322 | tmp[i] -= ('a'-'A'); |
| 1323 | } |
| 1324 | else |
| 1325 | if ((tmp[i] >= 'A' && tmp[i] <= 'Z')) |
| 1326 | tmp[i] -= ('A'-'a'); |
| 1327 | } |
| 1328 | if (search_field && current_type) |
| 1329 | is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); |
| 1330 | if (is_a_field) |
| 1331 | sym = NULL; |
| 1332 | else |
| 1333 | sym = lookup_symbol (tmp, expression_context_block, |
| 1334 | VAR_DOMAIN, |
| 1335 | &is_a_field_of_this, |
| 1336 | (struct symtab **) NULL); |
| 1337 | if (sym || is_a_field_of_this || is_a_field) |
| 1338 | for (i = 0; i <= namelen; i++) |
| 1339 | { |
| 1340 | if (i == 0) |
| 1341 | { |
| 1342 | if ((tokstart[i] >= 'a' && tokstart[i] <= 'z')) |
| 1343 | tokstart[i] -= ('a'-'A'); |
| 1344 | } |
| 1345 | else |
| 1346 | if ((tokstart[i] >= 'A' && tokstart[i] <= 'Z')) |
| 1347 | tokstart[i] -= ('A'-'a'); |
| 1348 | } |
| 1349 | } |
| 1350 | |
| 1351 | if (is_a_field) |
| 1352 | { |
| 1353 | tempbuf = (char *) xrealloc (tempbuf, namelen + 1); |
| 1354 | strncpy (tempbuf, tokstart, namelen); tempbuf [namelen] = 0; |
| 1355 | yylval.sval.ptr = tempbuf; |
| 1356 | yylval.sval.length = namelen; |
| 1357 | return FIELDNAME; |
| 1358 | } |
| 1359 | |
| 1360 | |
| 1361 | |
| 1362 | if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) || |
| 1363 | lookup_symtab (tmp)) |
| 1364 | { |
| 1365 | yylval.ssym.sym = sym; |
| 1366 | yylval.ssym.is_a_field_of_this = is_a_field_of_this; |
| 1367 | return BLOCKNAME; |
| 1368 | } |
| 1369 | if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) |
| 1370 | { |
| 1371 | #if 1 |
| 1372 | |
| 1373 | |
| 1374 | |
| 1375 | |
| 1376 | |
| 1377 | |
| 1378 | |
| 1379 | |
| 1380 | |
| 1381 | char *p; |
| 1382 | char *namestart; |
| 1383 | struct symbol *best_sym; |
| 1384 | |
| 1385 | |
| 1386 | |
| 1387 | |
| 1388 | |
| 1389 | |
| 1390 | |
| 1391 | |
| 1392 | |
| 1393 | |
| 1394 | |
| 1395 | |
| 1396 | p = lexptr; |
| 1397 | best_sym = sym; |
| 1398 | while (1) |
| 1399 | { |
| 1400 | |
| 1401 | while (*p == ' ' || *p == '\t' || *p == '\n') |
| 1402 | ++p; |
| 1403 | if (*p == ':' && p[1] == ':') |
| 1404 | { |
| 1405 | |
| 1406 | p += 2; |
| 1407 | |
| 1408 | while (*p == ' ' || *p == '\t' || *p == '\n') |
| 1409 | ++p; |
| 1410 | namestart = p; |
| 1411 | while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9') |
| 1412 | || (*p >= 'a' && *p <= 'z') |
| 1413 | || (*p >= 'A' && *p <= 'Z')) |
| 1414 | ++p; |
| 1415 | if (p != namestart) |
| 1416 | { |
| 1417 | struct symbol *cur_sym; |
| 1418 | |
| 1419 | |
| 1420 | char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3); |
| 1421 | char *tmp1; |
| 1422 | |
| 1423 | tmp1 = ncopy; |
| 1424 | memcpy (tmp1, tmp, strlen (tmp)); |
| 1425 | tmp1 += strlen (tmp); |
| 1426 | memcpy (tmp1, "::", 2); |
| 1427 | tmp1 += 2; |
| 1428 | memcpy (tmp1, namestart, p - namestart); |
| 1429 | tmp1[p - namestart] = '\0'; |
| 1430 | cur_sym = lookup_symbol (ncopy, expression_context_block, |
| 1431 | VAR_DOMAIN, (int *) NULL, |
| 1432 | (struct symtab **) NULL); |
| 1433 | if (cur_sym) |
| 1434 | { |
| 1435 | if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF) |
| 1436 | { |
| 1437 | best_sym = cur_sym; |
| 1438 | lexptr = p; |
| 1439 | } |
| 1440 | else |
| 1441 | break; |
| 1442 | } |
| 1443 | else |
| 1444 | break; |
| 1445 | } |
| 1446 | else |
| 1447 | break; |
| 1448 | } |
| 1449 | else |
| 1450 | break; |
| 1451 | } |
| 1452 | |
| 1453 | yylval.tsym.type = SYMBOL_TYPE (best_sym); |
| 1454 | #else /* not 0 */ |
| 1455 | yylval.tsym.type = SYMBOL_TYPE (sym); |
| 1456 | #endif /* not 0 */ |
| 1457 | return TYPENAME; |
| 1458 | } |
| 1459 | yylval.tsym.type |
| 1460 | = language_lookup_primitive_type_by_name (current_language, |
| 1461 | current_gdbarch, tmp); |
| 1462 | if (yylval.tsym.type != NULL) |
| 1463 | return TYPENAME; |
| 1464 | |
| 1465 | |
| 1466 | |
| 1467 | |
| 1468 | if (!sym && |
| 1469 | ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) || |
| 1470 | (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10))) |
| 1471 | { |
| 1472 | YYSTYPE newlval; |
| 1473 | hextype = parse_number (tokstart, namelen, 0, &newlval); |
| 1474 | if (hextype == INT) |
| 1475 | { |
| 1476 | yylval.ssym.sym = sym; |
| 1477 | yylval.ssym.is_a_field_of_this = is_a_field_of_this; |
| 1478 | return NAME_OR_INT; |
| 1479 | } |
| 1480 | } |
| 1481 | |
| 1482 | free(uptokstart); |
| 1483 | |
| 1484 | yylval.ssym.sym = sym; |
| 1485 | yylval.ssym.is_a_field_of_this = is_a_field_of_this; |
| 1486 | return NAME; |
| 1487 | } |
| 1488 | } |
| 1489 | |
| 1490 | void |
| 1491 | yyerror (msg) |
| 1492 | char *msg; |
| 1493 | { |
| 1494 | if (prev_lexptr) |
| 1495 | lexptr = prev_lexptr; |
| 1496 | |
| 1497 | error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr); |
| 1498 | } |
| 1499 | |
| 1500 | static int yygrowstack(void) |
| 1501 | { |
| 1502 | unsigned int newsize; |
| 1503 | long sslen; |
| 1504 | short *newss; |
| 1505 | YYSTYPE *newvs; |
| 1506 | |
| 1507 | if ((newsize = yystacksize) == 0) |
| 1508 | newsize = YYINITSTACKSIZE; |
| 1509 | else if (newsize >= YYMAXDEPTH) |
| 1510 | return -1; |
| 1511 | else if ((newsize *= 2) > YYMAXDEPTH) |
| 1512 | newsize = YYMAXDEPTH; |
| 1513 | sslen = yyssp - yyss; |
| 1514 | #ifdef SIZE_MAX |
| 1515 | #define YY_SIZE_MAX SIZE_MAX |
| 1516 | #else |
| 1517 | #define YY_SIZE_MAX 0xffffffffU |
| 1518 | #endif |
| 1519 | if (newsize && YY_SIZE_MAX / newsize < sizeof *newss) |
| 1520 | goto bail; |
| 1521 | newss = (short *)xrealloc(yyss, newsize * sizeof *newss); |
| 1522 | if (newss == NULL) |
| 1523 | goto bail; |
| 1524 | yyss = newss; |
| 1525 | yyssp = newss + sslen; |
| 1526 | if (newsize && YY_SIZE_MAX / newsize < sizeof *newvs) |
| 1527 | goto bail; |
| 1528 | newvs = (YYSTYPE *)xrealloc(yyvs, newsize * sizeof *newvs); |
| 1529 | if (newvs == NULL) |
| 1530 | goto bail; |
| 1531 | yyvs = newvs; |
| 1532 | yyvsp = newvs + sslen; |
| 1533 | yystacksize = newsize; |
| 1534 | yysslim = yyss + newsize - 1; |
| 1535 | return 0; |
| 1536 | bail: |
| 1537 | if (yyss) |
| 1538 | free(yyss); |
| 1539 | if (yyvs) |
| 1540 | free(yyvs); |
| 1541 | yyss = yyssp = NULL; |
| 1542 | yyvs = yyvsp = NULL; |
| 1543 | yystacksize = 0; |
| 1544 | return -1; |
| 1545 | } |
| 1546 | |
| 1547 | #define YYABORT goto yyabort |
| 1548 | #define YYREJECT goto yyabort |
| 1549 | #define YYACCEPT goto yyaccept |
| 1550 | #define YYERROR goto yyerrlab |
| 1551 | int |
| 1552 | yyparse(void) |
| 1553 | { |
| 1554 | int yym, yyn, yystate; |
| 1555 | #if YYDEBUG |
| 1556 | const char *yys; |
| 1557 | |
| 1558 | if ((yys = getenv("YYDEBUG"))) |
| 1 | Assuming 'pascal_s' is null | |
|
| |
| 1559 | { |
| 1560 | yyn = *yys; |
| 1561 | if (yyn >= '0' && yyn <= '9') |
| 1562 | yydebug = yyn - '0'; |
| 1563 | } |
| 1564 | #endif /* YYDEBUG */ |
| 1565 | |
| 1566 | yynerrs = 0; |
| 1567 | yyerrflag = 0; |
| 1568 | yychar = (-1); |
| 1569 | |
| 1570 | if (yyss == NULL && yygrowstack()) goto yyoverflow; |
| 3 | | Assuming 'yyss' is not equal to NULL | |
|
| 1571 | yyssp = yyss; |
| 1572 | yyvsp = yyvs; |
| 1573 | *yyssp = yystate = 0; |
| 1574 | |
| 1575 | yyloop: |
| 1576 | if ((yyn = yydefred[yystate]) != 0) goto yyreduce; |
| |
| 5 | | Control jumps to line 1679 | |
|
| |
| 39 | | Assuming the condition is true | |
|
| |
| 41 | | Control jumps to line 1679 | |
|
| 1577 | if (yychar < 0) |
| |
| 1578 | { |
| 1579 | if ((yychar = yylex()) < 0) yychar = 0; |
| 18 | | Assuming the condition is false | |
|
| |
| 1580 | #if YYDEBUG |
| 1581 | if (yydebug) |
| 20 | | Assuming 'pascal_debug' is 0 | |
|
| |
| 1582 | { |
| 1583 | yys = 0; |
| 1584 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
| 1585 | if (!yys) yys = "illegal-symbol"; |
| 1586 | printf("%sdebug: state %d, reading %d (%s)\n", |
| 1587 | YYPREFIX, yystate, yychar, yys); |
| 1588 | } |
| 1589 | #endif |
| 1590 | } |
| 1591 | if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && |
| 22 | | Assuming 'yyn' is not equal to 0 | |
|
| 23 | | Assuming the condition is false | |
|
| 1592 | yyn <= YYTABLESIZE && yycheck[yyn] == yychar) |
| 1593 | { |
| 1594 | #if YYDEBUG |
| 1595 | if (yydebug) |
| 1596 | printf("%sdebug: state %d, shifting to state %d\n", |
| 1597 | YYPREFIX, yystate, yytable[yyn]); |
| 1598 | #endif |
| 1599 | if (yyssp >= yysslim && yygrowstack()) |
| 1600 | { |
| 1601 | goto yyoverflow; |
| 1602 | } |
| 1603 | *++yyssp = yystate = yytable[yyn]; |
| 1604 | *++yyvsp = yylval; |
| 1605 | yychar = (-1); |
| 1606 | if (yyerrflag > 0) --yyerrflag; |
| 1607 | goto yyloop; |
| 1608 | } |
| 1609 | if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && |
| |
| 1610 | yyn <= YYTABLESIZE && yycheck[yyn] == yychar) |
| 1611 | { |
| 1612 | yyn = yytable[yyn]; |
| 1613 | goto yyreduce; |
| 1614 | } |
| 1615 | if (yyerrflag) goto yyinrecovery; |
| 25 | | Assuming 'pascal_errflag' is not equal to 0 | |
|
| |
| 27 | | Control jumps to line 1627 | |
|
| 1616 | #if defined(__GNUC__) |
| 1617 | goto yynewerror; |
| 1618 | #endif |
| 1619 | yynewerror: |
| 1620 | yyerror("syntax error"); |
| 1621 | #if defined(__GNUC__) |
| 1622 | goto yyerrlab; |
| 1623 | #endif |
| 1624 | yyerrlab: |
| 1625 | ++yynerrs; |
| 1626 | yyinrecovery: |
| 1627 | if (yyerrflag < 3) |
| 28 | | Assuming 'pascal_errflag' is < 3 | |
|
| |
| 1628 | { |
| 1629 | yyerrflag = 3; |
| 1630 | for (;;) |
| 30 | | Loop condition is true. Entering loop body | |
|
| 1631 | { |
| 1632 | if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && |
| 31 | | Assuming 'yyn' is not equal to 0 | |
|
| 32 | | Assuming the condition is true | |
|
| |
| 1633 | yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) |
| 33 | | Assuming 'yyn' is <= YYTABLESIZE | |
|
| 34 | | Assuming the condition is true | |
|
| 1634 | { |
| 1635 | #if YYDEBUG |
| 1636 | if (yydebug) |
| |
| 1637 | printf("%sdebug: state %d, error recovery shifting\ |
| 1638 | to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); |
| 1639 | #endif |
| 1640 | if (yyssp >= yysslim && yygrowstack()) |
| 37 | | Assuming 'yyssp' is < 'yysslim' | |
|
| 1641 | { |
| 1642 | goto yyoverflow; |
| 1643 | } |
| 1644 | *++yyssp = yystate = yytable[yyn]; |
| 1645 | *++yyvsp = yylval; |
| 1646 | goto yyloop; |
| 38 | | Control jumps to line 1576 | |
|
| 1647 | } |
| 1648 | else |
| 1649 | { |
| 1650 | #if YYDEBUG |
| 1651 | if (yydebug) |
| 1652 | printf("%sdebug: error recovery discarding state %d\n", |
| 1653 | YYPREFIX, *yyssp); |
| 1654 | #endif |
| 1655 | if (yyssp <= yyss) goto yyabort; |
| 1656 | --yyssp; |
| 1657 | --yyvsp; |
| 1658 | } |
| 1659 | } |
| 1660 | } |
| 1661 | else |
| 1662 | { |
| 1663 | if (yychar == 0) goto yyabort; |
| 1664 | #if YYDEBUG |
| 1665 | if (yydebug) |
| 1666 | { |
| 1667 | yys = 0; |
| 1668 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
| 1669 | if (!yys) yys = "illegal-symbol"; |
| 1670 | printf("%sdebug: state %d, error recovery discards token %d (%s)\n", |
| 1671 | YYPREFIX, yystate, yychar, yys); |
| 1672 | } |
| 1673 | #endif |
| 1674 | yychar = (-1); |
| 1675 | goto yyloop; |
| 1676 | } |
| 1677 | yyreduce: |
| 1678 | #if YYDEBUG |
| 1679 | if (yydebug) |
| 6 | | Assuming 'pascal_debug' is 0 | |
|
| |
| |
| 1680 | printf("%sdebug: state %d, reducing by rule %d (%s)\n", |
| 1681 | YYPREFIX, yystate, yyn, yyrule[yyn]); |
| 1682 | #endif |
| 1683 | yym = yylen[yyn]; |
| 1684 | if (yym) |
| |
| |
| |
| 1685 | yyval = yyvsp[1-yym]; |
| 1686 | else |
| 1687 | memset(&yyval, 0, sizeof yyval); |
| 1688 | switch (yyn) |
| 9 | | Control jumps to 'case 1:' at line 1690 | |
|
| 45 | | Control jumps to 'case 46:' at line 1914 | |
|
| 1689 | { |
| 1690 | case 1: |
| 1691 | #line 234 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1692 | { current_type = NULL; |
| 1693 | search_field = 0; |
| 1694 | } |
| 1695 | break; |
| 10 | | Execution continues on line 2191 | |
|
| 1696 | case 2: |
| 1697 | #line 237 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1698 | {} |
| 1699 | break; |
| 1700 | case 5: |
| 1701 | #line 246 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1702 | { write_exp_elt_opcode(OP_TYPE); |
| 1703 | write_exp_elt_type(yyvsp[0].tval); |
| 1704 | write_exp_elt_opcode(OP_TYPE); |
| 1705 | current_type = yyvsp[0].tval; } |
| 1706 | break; |
| 1707 | case 7: |
| 1708 | #line 254 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1709 | { write_exp_elt_opcode (BINOP_COMMA); } |
| 1710 | break; |
| 1711 | case 8: |
| 1712 | #line 259 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1713 | { write_exp_elt_opcode (UNOP_IND); |
| 1714 | if (current_type) |
| 1715 | current_type = TYPE_TARGET_TYPE (current_type); } |
| 1716 | break; |
| 1717 | case 9: |
| 1718 | #line 265 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1719 | { write_exp_elt_opcode (UNOP_ADDR); |
| 1720 | if (current_type) |
| 1721 | current_type = TYPE_POINTER_TYPE (current_type); } |
| 1722 | break; |
| 1723 | case 10: |
| 1724 | #line 271 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1725 | { write_exp_elt_opcode (UNOP_NEG); } |
| 1726 | break; |
| 1727 | case 11: |
| 1728 | #line 275 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1729 | { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } |
| 1730 | break; |
| 1731 | case 12: |
| 1732 | #line 279 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1733 | { write_exp_elt_opcode (UNOP_PREINCREMENT); } |
| 1734 | break; |
| 1735 | case 13: |
| 1736 | #line 283 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1737 | { write_exp_elt_opcode (UNOP_PREDECREMENT); } |
| 1738 | break; |
| 1739 | case 14: |
| 1740 | #line 286 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1741 | { search_field = 1; } |
| 1742 | break; |
| 1743 | case 15: |
| 1744 | #line 289 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1745 | { write_exp_elt_opcode (STRUCTOP_STRUCT); |
| 1746 | write_exp_string (yyvsp[0].sval); |
| 1747 | write_exp_elt_opcode (STRUCTOP_STRUCT); |
| 1748 | search_field = 0; |
| 1749 | if (current_type) |
| 1750 | { while (TYPE_CODE (current_type) == TYPE_CODE_PTR) |
| 1751 | current_type = TYPE_TARGET_TYPE (current_type); |
| 1752 | current_type = lookup_struct_elt_type ( |
| 1753 | current_type, yyvsp[0].sval.ptr, 0); }; |
| 1754 | } |
| 1755 | break; |
| 1756 | case 16: |
| 1757 | #line 301 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1758 | { char *arrayname; |
| 1759 | int arrayfieldindex; |
| 1760 | arrayfieldindex = is_pascal_string_type ( |
| 1761 | current_type, NULL, NULL, |
| 1762 | NULL, NULL, &arrayname); |
| 1763 | if (arrayfieldindex) |
| 1764 | { |
| 1765 | struct stoken stringsval; |
| 1766 | stringsval.ptr = alloca (strlen (arrayname) + 1); |
| 1767 | stringsval.length = strlen (arrayname); |
| 1768 | strcpy (stringsval.ptr, arrayname); |
| 1769 | current_type = TYPE_FIELD_TYPE (current_type, |
| 1770 | arrayfieldindex - 1); |
| 1771 | write_exp_elt_opcode (STRUCTOP_STRUCT); |
| 1772 | write_exp_string (stringsval); |
| 1773 | write_exp_elt_opcode (STRUCTOP_STRUCT); |
| 1774 | } |
| 1775 | push_current_type (); } |
| 1776 | break; |
| 1777 | case 17: |
| 1778 | #line 320 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1779 | { pop_current_type (); |
| 1780 | write_exp_elt_opcode (BINOP_SUBSCRIPT); |
| 1781 | if (current_type) |
| 1782 | current_type = TYPE_TARGET_TYPE (current_type); } |
| 1783 | break; |
| 1784 | case 18: |
| 1785 | #line 329 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1786 | { push_current_type (); |
| 1787 | start_arglist (); } |
| 1788 | break; |
| 1789 | case 19: |
| 1790 | #line 332 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1791 | { write_exp_elt_opcode (OP_FUNCALL); |
| 1792 | write_exp_elt_longcst ((LONGEST) end_arglist ()); |
| 1793 | write_exp_elt_opcode (OP_FUNCALL); |
| 1794 | pop_current_type (); } |
| 1795 | break; |
| 1796 | case 21: |
| 1797 | #line 340 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1798 | { arglist_len = 1; } |
| 1799 | break; |
| 1800 | case 22: |
| 1801 | #line 342 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1802 | { arglist_len++; } |
| 1803 | break; |
| 1804 | case 23: |
| 1805 | #line 346 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1806 | { if (current_type) |
| 1807 | { |
| 1808 | |
| 1809 | if ((TYPE_CODE (current_type) == TYPE_CODE_PTR) |
| 1810 | && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_CLASS) |
| 1811 | && (TYPE_CODE (yyvsp[-3].tval) == TYPE_CODE_CLASS)) |
| 1812 | write_exp_elt_opcode (UNOP_IND); |
| 1813 | } |
| 1814 | write_exp_elt_opcode (UNOP_CAST); |
| 1815 | write_exp_elt_type (yyvsp[-3].tval); |
| 1816 | write_exp_elt_opcode (UNOP_CAST); |
| 1817 | current_type = yyvsp[-3].tval; } |
| 1818 | break; |
| 1819 | case 24: |
| 1820 | #line 361 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1821 | { } |
| 1822 | break; |
| 1823 | case 25: |
| 1824 | #line 367 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1825 | { write_exp_elt_opcode (BINOP_MUL); } |
| 1826 | break; |
| 1827 | case 26: |
| 1828 | #line 371 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1829 | { write_exp_elt_opcode (BINOP_DIV); } |
| 1830 | break; |
| 1831 | case 27: |
| 1832 | #line 375 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1833 | { write_exp_elt_opcode (BINOP_INTDIV); } |
| 1834 | break; |
| 1835 | case 28: |
| 1836 | #line 379 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1837 | { write_exp_elt_opcode (BINOP_REM); } |
| 1838 | break; |
| 1839 | case 29: |
| 1840 | #line 383 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1841 | { write_exp_elt_opcode (BINOP_ADD); } |
| 1842 | break; |
| 1843 | case 30: |
| 1844 | #line 387 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1845 | { write_exp_elt_opcode (BINOP_SUB); } |
| 1846 | break; |
| 1847 | case 31: |
| 1848 | #line 391 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1849 | { write_exp_elt_opcode (BINOP_LSH); } |
| 1850 | break; |
| 1851 | case 32: |
| 1852 | #line 395 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1853 | { write_exp_elt_opcode (BINOP_RSH); } |
| 1854 | break; |
| 1855 | case 33: |
| 1856 | #line 399 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1857 | { write_exp_elt_opcode (BINOP_EQUAL); } |
| 1858 | break; |
| 1859 | case 34: |
| 1860 | #line 403 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1861 | { write_exp_elt_opcode (BINOP_NOTEQUAL); } |
| 1862 | break; |
| 1863 | case 35: |
| 1864 | #line 407 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1865 | { write_exp_elt_opcode (BINOP_LEQ); } |
| 1866 | break; |
| 1867 | case 36: |
| 1868 | #line 411 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1869 | { write_exp_elt_opcode (BINOP_GEQ); } |
| 1870 | break; |
| 1871 | case 37: |
| 1872 | #line 415 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1873 | { write_exp_elt_opcode (BINOP_LESS); } |
| 1874 | break; |
| 1875 | case 38: |
| 1876 | #line 419 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1877 | { write_exp_elt_opcode (BINOP_GTR); } |
| 1878 | break; |
| 1879 | case 39: |
| 1880 | #line 423 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1881 | { write_exp_elt_opcode (BINOP_BITWISE_AND); } |
| 1882 | break; |
| 1883 | case 40: |
| 1884 | #line 427 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1885 | { write_exp_elt_opcode (BINOP_BITWISE_XOR); } |
| 1886 | break; |
| 1887 | case 41: |
| 1888 | #line 431 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1889 | { write_exp_elt_opcode (BINOP_BITWISE_IOR); } |
| 1890 | break; |
| 1891 | case 42: |
| 1892 | #line 435 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1893 | { write_exp_elt_opcode (BINOP_ASSIGN); } |
| 1894 | break; |
| 1895 | case 43: |
| 1896 | #line 439 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1897 | { write_exp_elt_opcode (OP_BOOL); |
| 1898 | write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); |
| 1899 | write_exp_elt_opcode (OP_BOOL); } |
| 1900 | break; |
| 1901 | case 44: |
| 1902 | #line 445 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1903 | { write_exp_elt_opcode (OP_BOOL); |
| 1904 | write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); |
| 1905 | write_exp_elt_opcode (OP_BOOL); } |
| 1906 | break; |
| 1907 | case 45: |
| 1908 | #line 451 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1909 | { write_exp_elt_opcode (OP_LONG); |
| 1910 | write_exp_elt_type (yyvsp[0].typed_val_int.type); |
| 1911 | write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val)); |
| 1912 | write_exp_elt_opcode (OP_LONG); } |
| 1913 | break; |
| 1914 | case 46: |
| 1915 | #line 458 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1916 | { YYSTYPE val; |
| 1917 | parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val); |
| |
| 59 | | Returning from 'parse_number' | |
|
| 1918 | write_exp_elt_opcode (OP_LONG); |
| 1919 | write_exp_elt_type (val.typed_val_int.type); |
| 60 | | 1st function call argument is an uninitialized value |
|
| 1920 | write_exp_elt_longcst ((LONGEST)val.typed_val_int.val); |
| 1921 | write_exp_elt_opcode (OP_LONG); |
| 1922 | } |
| 1923 | break; |
| 1924 | case 47: |
| 1925 | #line 469 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1926 | { write_exp_elt_opcode (OP_DOUBLE); |
| 1927 | write_exp_elt_type (yyvsp[0].typed_val_float.type); |
| 1928 | write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval); |
| 1929 | write_exp_elt_opcode (OP_DOUBLE); } |
| 1930 | break; |
| 1931 | case 50: |
| 1932 | #line 483 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1933 | { write_exp_elt_opcode (OP_LONG); |
| 1934 | write_exp_elt_type (builtin_type_int); |
| 1935 | CHECK_TYPEDEF (yyvsp[-1].tval); |
| 1936 | write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval)); |
| 1937 | write_exp_elt_opcode (OP_LONG); } |
| 1938 | break; |
| 1939 | case 51: |
| 1940 | #line 491 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1941 | { |
| 1942 | |
| 1943 | |
| 1944 | |
| 1945 | |
| 1946 | char *sp = yyvsp[0].sval.ptr; int count = yyvsp[0].sval.length; |
| 1947 | while (count-- > 0) |
| 1948 | { |
| 1949 | write_exp_elt_opcode (OP_LONG); |
| 1950 | write_exp_elt_type (builtin_type_char); |
| 1951 | write_exp_elt_longcst ((LONGEST)(*sp++)); |
| 1952 | write_exp_elt_opcode (OP_LONG); |
| 1953 | } |
| 1954 | write_exp_elt_opcode (OP_LONG); |
| 1955 | write_exp_elt_type (builtin_type_char); |
| 1956 | write_exp_elt_longcst ((LONGEST)'\0'); |
| 1957 | write_exp_elt_opcode (OP_LONG); |
| 1958 | write_exp_elt_opcode (OP_ARRAY); |
| 1959 | write_exp_elt_longcst ((LONGEST) 0); |
| 1960 | write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length)); |
| 1961 | write_exp_elt_opcode (OP_ARRAY); } |
| 1962 | break; |
| 1963 | case 52: |
| 1964 | #line 516 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1965 | { |
| 1966 | struct value * this_val; |
| 1967 | struct type * this_type; |
| 1968 | write_exp_elt_opcode (OP_THIS); |
| 1969 | write_exp_elt_opcode (OP_THIS); |
| 1970 | |
| 1971 | this_val = value_of_this (0); |
| 1972 | if (this_val) |
| 1973 | this_type = this_val->type; |
| 1974 | else |
| 1975 | this_type = NULL; |
| 1976 | if (this_type) |
| 1977 | { |
| 1978 | if (TYPE_CODE (this_type) == TYPE_CODE_PTR) |
| 1979 | { |
| 1980 | this_type = TYPE_TARGET_TYPE (this_type); |
| 1981 | write_exp_elt_opcode (UNOP_IND); |
| 1982 | } |
| 1983 | } |
| 1984 | |
| 1985 | current_type = this_type; |
| 1986 | } |
| 1987 | break; |
| 1988 | case 53: |
| 1989 | #line 543 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 1990 | { |
| 1991 | if (yyvsp[0].ssym.sym != 0) |
| 1992 | yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym); |
| 1993 | else |
| 1994 | { |
| 1995 | struct symtab *tem = |
| 1996 | lookup_symtab (copy_name (yyvsp[0].ssym.stoken)); |
| 1997 | if (tem) |
| 1998 | yyval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK); |
| 1999 | else |
| 2000 | error ("No file or function \"%s\".", |
| 2001 | copy_name (yyvsp[0].ssym.stoken)); |
| 2002 | } |
| 2003 | } |
| 2004 | break; |
| 2005 | case 54: |
| 2006 | #line 560 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2007 | { struct symbol *tem |
| 2008 | = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval, |
| 2009 | VAR_DOMAIN, (int *) NULL, |
| 2010 | (struct symtab **) NULL); |
| 2011 | if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) |
| 2012 | error ("No function \"%s\" in specified context.", |
| 2013 | copy_name (yyvsp[0].sval)); |
| 2014 | yyval.bval = SYMBOL_BLOCK_VALUE (tem); } |
| 2015 | break; |
| 2016 | case 55: |
| 2017 | #line 571 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2018 | { struct symbol *sym; |
| 2019 | sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval, |
| 2020 | VAR_DOMAIN, (int *) NULL, |
| 2021 | (struct symtab **) NULL); |
| 2022 | if (sym == 0) |
| 2023 | error ("No symbol \"%s\" in specified context.", |
| 2024 | copy_name (yyvsp[0].sval)); |
| 2025 | |
| 2026 | write_exp_elt_opcode (OP_VAR_VALUE); |
| 2027 | |
| 2028 | write_exp_elt_block (block_found); |
| 2029 | write_exp_elt_sym (sym); |
| 2030 | write_exp_elt_opcode (OP_VAR_VALUE); } |
| 2031 | break; |
| 2032 | case 56: |
| 2033 | #line 587 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2034 | { |
| 2035 | struct type *type = yyvsp[-2].tval; |
| 2036 | if (TYPE_CODE (type) != TYPE_CODE_STRUCT |
| 2037 | && TYPE_CODE (type) != TYPE_CODE_UNION) |
| 2038 | error ("`%s' is not defined as an aggregate type.", |
| 2039 | TYPE_NAME (type)); |
| 2040 | |
| 2041 | write_exp_elt_opcode (OP_SCOPE); |
| 2042 | write_exp_elt_type (type); |
| 2043 | write_exp_string (yyvsp[0].sval); |
| 2044 | write_exp_elt_opcode (OP_SCOPE); |
| 2045 | } |
| 2046 | break; |
| 2047 | case 58: |
| 2048 | #line 603 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2049 | { |
| 2050 | char *name = copy_name (yyvsp[0].sval); |
| 2051 | struct symbol *sym; |
| 2052 | struct minimal_symbol *msymbol; |
| 2053 | |
| 2054 | sym = |
| 2055 | lookup_symbol (name, (const struct block *) NULL, |
| 2056 | VAR_DOMAIN, (int *) NULL, |
| 2057 | (struct symtab **) NULL); |
| 2058 | if (sym) |
| 2059 | { |
| 2060 | write_exp_elt_opcode (OP_VAR_VALUE); |
| 2061 | write_exp_elt_block (NULL); |
| 2062 | write_exp_elt_sym (sym); |
| 2063 | write_exp_elt_opcode (OP_VAR_VALUE); |
| 2064 | break; |
| 2065 | } |
| 2066 | |
| 2067 | msymbol = lookup_minimal_symbol (name, NULL, NULL); |
| 2068 | if (msymbol != NULL) |
| 2069 | { |
| 2070 | write_exp_msymbol (msymbol, |
| 2071 | lookup_function_type (builtin_type_int), |
| 2072 | builtin_type_int); |
| 2073 | } |
| 2074 | else |
| 2075 | if (!have_full_symbols () && !have_partial_symbols ()) |
| 2076 | error ("No symbol table is loaded. Use the \"file\" command."); |
| 2077 | else |
| 2078 | error ("No symbol \"%s\" in current context.", name); |
| 2079 | } |
| 2080 | break; |
| 2081 | case 59: |
| 2082 | #line 637 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2083 | { struct symbol *sym = yyvsp[0].ssym.sym; |
| 2084 | |
| 2085 | if (sym) |
| 2086 | { |
| 2087 | if (symbol_read_needs_frame (sym)) |
| 2088 | { |
| 2089 | if (innermost_block == 0 || |
| 2090 | contained_in (block_found, |
| 2091 | innermost_block)) |
| 2092 | innermost_block = block_found; |
| 2093 | } |
| 2094 | |
| 2095 | write_exp_elt_opcode (OP_VAR_VALUE); |
| 2096 | |
| 2097 | |
| 2098 | |
| 2099 | write_exp_elt_block (NULL); |
| 2100 | write_exp_elt_sym (sym); |
| 2101 | write_exp_elt_opcode (OP_VAR_VALUE); |
| 2102 | current_type = sym->type; } |
| 2103 | else if (yyvsp[0].ssym.is_a_field_of_this) |
| 2104 | { |
| 2105 | struct value * this_val; |
| 2106 | struct type * this_type; |
| 2107 | |
| 2108 | |
| 2109 | |
| 2110 | if (innermost_block == 0 || |
| 2111 | contained_in (block_found, innermost_block)) |
| 2112 | innermost_block = block_found; |
| 2113 | write_exp_elt_opcode (OP_THIS); |
| 2114 | write_exp_elt_opcode (OP_THIS); |
| 2115 | write_exp_elt_opcode (STRUCTOP_PTR); |
| 2116 | write_exp_string (yyvsp[0].ssym.stoken); |
| 2117 | write_exp_elt_opcode (STRUCTOP_PTR); |
| 2118 | |
| 2119 | this_val = value_of_this (0); |
| 2120 | if (this_val) |
| 2121 | this_type = this_val->type; |
| 2122 | else |
| 2123 | this_type = NULL; |
| 2124 | if (this_type) |
| 2125 | current_type = lookup_struct_elt_type ( |
| 2126 | this_type, |
| 2127 | copy_name (yyvsp[0].ssym.stoken), 0); |
| 2128 | else |
| 2129 | current_type = NULL; |
| 2130 | } |
| 2131 | else |
| 2132 | { |
| 2133 | struct minimal_symbol *msymbol; |
| 2134 | char *arg = copy_name (yyvsp[0].ssym.stoken); |
| 2135 | |
| 2136 | msymbol = |
| 2137 | lookup_minimal_symbol (arg, NULL, NULL); |
| 2138 | if (msymbol != NULL) |
| 2139 | { |
| 2140 | write_exp_msymbol (msymbol, |
| 2141 | lookup_function_type (builtin_type_int), |
| 2142 | builtin_type_int); |
| 2143 | } |
| 2144 | else if (!have_full_symbols () && !have_partial_symbols ()) |
| 2145 | error ("No symbol table is loaded. Use the \"file\" command."); |
| 2146 | else |
| 2147 | error ("No symbol \"%s\" in current context.", |
| 2148 | copy_name (yyvsp[0].ssym.stoken)); |
| 2149 | } |
| 2150 | } |
| 2151 | break; |
| 2152 | case 62: |
| 2153 | #line 721 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2154 | { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); } |
| 2155 | break; |
| 2156 | case 63: |
| 2157 | #line 726 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2158 | { yyval.tval = lookup_pointer_type (yyvsp[0].tval); } |
| 2159 | break; |
| 2160 | case 64: |
| 2161 | #line 728 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2162 | { yyval.tval = yyvsp[0].tsym.type; } |
| 2163 | break; |
| 2164 | case 65: |
| 2165 | #line 730 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2166 | { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval), |
| 2167 | expression_context_block); } |
| 2168 | break; |
| 2169 | case 66: |
| 2170 | #line 733 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2171 | { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval), |
| 2172 | expression_context_block); } |
| 2173 | break; |
| 2174 | case 67: |
| 2175 | #line 740 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2176 | { yyval.sval = yyvsp[0].ssym.stoken; } |
| 2177 | break; |
| 2178 | case 68: |
| 2179 | #line 741 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2180 | { yyval.sval = yyvsp[0].ssym.stoken; } |
| 2181 | break; |
| 2182 | case 69: |
| 2183 | #line 742 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2184 | { yyval.sval = yyvsp[0].tsym.stoken; } |
| 2185 | break; |
| 2186 | case 70: |
| 2187 | #line 743 "/usr/src/gnu/usr.bin/binutils/gdb/p-exp.y" |
| 2188 | { yyval.sval = yyvsp[0].ssym.stoken; } |
| 2189 | break; |
| 2190 | } |
| 2191 | yyssp -= yym; |
| 2192 | yystate = *yyssp; |
| 2193 | yyvsp -= yym; |
| 2194 | yym = yylhs[yyn]; |
| 2195 | if (yystate == 0 && yym == 0) |
| |
| 2196 | { |
| 2197 | #if YYDEBUG |
| 2198 | if (yydebug) |
| 2199 | printf("%sdebug: after reduction, shifting from state 0 to\ |
| 2200 | state %d\n", YYPREFIX, YYFINAL); |
| 2201 | #endif |
| 2202 | yystate = YYFINAL; |
| 2203 | *++yyssp = YYFINAL; |
| 2204 | *++yyvsp = yyval; |
| 2205 | if (yychar < 0) |
| 2206 | { |
| 2207 | if ((yychar = yylex()) < 0) yychar = 0; |
| 2208 | #if YYDEBUG |
| 2209 | if (yydebug) |
| 2210 | { |
| 2211 | yys = 0; |
| 2212 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
| 2213 | if (!yys) yys = "illegal-symbol"; |
| 2214 | printf("%sdebug: state %d, reading %d (%s)\n", |
| 2215 | YYPREFIX, YYFINAL, yychar, yys); |
| 2216 | } |
| 2217 | #endif |
| 2218 | } |
| 2219 | if (yychar == 0) goto yyaccept; |
| 2220 | goto yyloop; |
| 2221 | } |
| 2222 | if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && |
| |
| 2223 | yyn <= YYTABLESIZE && yycheck[yyn] == yystate) |
| 2224 | yystate = yytable[yyn]; |
| 2225 | else |
| 2226 | yystate = yydgoto[yym]; |
| 2227 | #if YYDEBUG |
| 2228 | if (yydebug) |
| |
| 2229 | printf("%sdebug: after reduction, shifting from state %d \ |
| 2230 | to state %d\n", YYPREFIX, *yyssp, yystate); |
| 2231 | #endif |
| 2232 | if (yyssp >= yysslim && yygrowstack()) |
| 14 | | Assuming 'yyssp' is < 'yysslim' | |
|
| 2233 | { |
| 2234 | goto yyoverflow; |
| 2235 | } |
| 2236 | *++yyssp = yystate; |
| 2237 | *++yyvsp = yyval; |
| 2238 | goto yyloop; |
| 15 | | Control jumps to line 1576 | |
|
| 2239 | yyoverflow: |
| 2240 | yyerror("yacc stack overflow"); |
| 2241 | yyabort: |
| 2242 | if (yyss) |
| 2243 | free(yyss); |
| 2244 | if (yyvs) |
| 2245 | free(yyvs); |
| 2246 | yyss = yyssp = NULL; |
| 2247 | yyvs = yyvsp = NULL; |
| 2248 | yystacksize = 0; |
| 2249 | return (1); |
| 2250 | yyaccept: |
| 2251 | if (yyss) |
| 2252 | free(yyss); |
| 2253 | if (yyvs) |
| 2254 | free(yyvs); |
| 2255 | yyss = yyssp = NULL; |
| 2256 | yyvs = yyvsp = NULL; |
| 2257 | yystacksize = 0; |
| 2258 | return (0); |
| 2259 | } |