Handle alignof and _Alignof
authorTom Tromey <tom@tromey.com>
Fri, 20 Apr 2018 19:40:29 +0000 (13:40 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 30 Apr 2018 17:25:31 +0000 (11:25 -0600)
commit007e1530347330d4dbba387c4e35aae05bc06498
tree7d25c515868a29c6867661128c2ce6ead1d7d890
parent2b4424c35b9ebabaab8588b2ba6c38935a48efec
Handle alignof and _Alignof

This adds alignof and _Alignof to the C/C++ expression parser, and
adds new tests to test the features.  The tests are written to try to
ensure that gdb's knowledge of alignment rules stays in sync with the
compiler's.

2018-04-30  Tom Tromey  <tom@tromey.com>

PR exp/17095:
* NEWS: Update.
* std-operator.def (UNOP_ALIGNOF): New operator.
* expprint.c (dump_subexp_body_standard) <case UNOP_ALIGNOF>:
New.
* eval.c (evaluate_subexp_standard) <case UNOP_ALIGNOF>: New.
* c-lang.c (c_op_print_tab): Add alignof.
* c-exp.y (ALIGNOF): New token.
(exp): Add "ALIGNOF" production.
(ident_tokens): Add _Alignof and alignof.

2018-04-30  Tom Tromey  <tom@tromey.com>

PR exp/17095:
* gdb.dwarf2/dw2-align.exp: New file.
* gdb.cp/align.exp: New file.
* gdb.base/align.exp: New file.
* lib/gdb.exp (gdb_int128_helper): New proc.
(has_int128_c, has_int128_cxx): New caching procs.
12 files changed:
gdb/ChangeLog
gdb/NEWS
gdb/c-exp.y
gdb/c-lang.c
gdb/eval.c
gdb/expprint.c
gdb/std-operator.def
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/align.exp [new file with mode: 0644]
gdb/testsuite/gdb.cp/align.exp [new file with mode: 0644]
gdb/testsuite/gdb.dwarf2/dw2-align.exp [new file with mode: 0644]
gdb/testsuite/lib/gdb.exp