diff options
author | Tom Tromey <tromey@adacore.com> | 2023-03-27 14:26:53 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-04-17 10:43:06 -0600 |
commit | e49831ba4340688d7685a52099db09d12177945b (patch) | |
tree | 794a5df54bb143718f1fecc720e11302b3e37bc5 /gdb/ada-exp.y | |
parent | 8a2ced4fe401a36db6a9d4de5813951009a62a9e (diff) | |
download | binutils-e49831ba4340688d7685a52099db09d12177945b.zip binutils-e49831ba4340688d7685a52099db09d12177945b.tar.gz binutils-e49831ba4340688d7685a52099db09d12177945b.tar.bz2 |
Add 128-bit integer support to the Ada parser
This adds support for 128-bit integers to the Ada parser.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30188
Diffstat (limited to 'gdb/ada-exp.y')
-rw-r--r-- | gdb/ada-exp.y | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 4095106..3e31d27 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -68,6 +68,11 @@ static struct parser_state *pstate = NULL; /* The original expression string. */ static const char *original_expr; +/* We don't have a good way to manage non-POD data in Yacc, so store + values here. The storage here is only valid for the duration of + the parse. */ +static std::vector<std::unique_ptr<gdb_mpz>> int_storage; + int yyparse (void); static int yylex (void); @@ -416,10 +421,14 @@ make_tick_completer (struct stoken tok) { LONGEST lval; struct { - LONGEST val; + const gdb_mpz *val; struct type *type; } typed_val; struct { + LONGEST val; + struct type *type; + } typed_char; + struct { gdb_byte val[16]; struct type *type; } typed_val_float; @@ -433,7 +442,8 @@ make_tick_completer (struct stoken tok) %type <lval> aggregate_component_list %type <tval> var_or_type type_prefix opt_type_prefix -%token <typed_val> INT NULL_PTR CHARLIT +%token <typed_val> INT NULL_PTR +%token <typed_char> CHARLIT %token <typed_val_float> FLOAT %token TRUEKEYWORD FALSEKEYWORD %token COLONCOLON @@ -867,7 +877,7 @@ primary : primary TICK_ACCESS tick_arglist : %prec '(' { $$ = 1; } | '(' INT ')' - { $$ = $2.val; } + { $$ = $2.val->as_integer<LONGEST> (); } ; type_prefix : @@ -888,7 +898,10 @@ opt_type_prefix : primary : INT - { write_int (pstate, (LONGEST) $1.val, $1.type); } + { + pstate->push_new<long_const_operation> ($1.type, *$1.val); + ada_wrap<ada_wrapped_operation> (); + } ; primary : CHARLIT @@ -1144,6 +1157,7 @@ ada_parse (struct parser_state *par_state) obstack_init (&temp_parse_space); components.clear (); associations.clear (); + int_storage.clear (); int result = yyparse (); if (!result) |