Fix typo in _initialize_alpha_linux_nat prototype

	* alpha-linux-nat.c (_initialize_alpha_linux_nat): Fix prototype.
Add return value for non-void function return statements to fix error in clang build.

Clang defaults this warning to an error, breaking the build & causing
these tests not to run.

gdb/testsuite/

	* gdb.mi/non-stop.c: Add return value for non-void function return
	statement.
	* gdb.threads/staticthreads.c: Ditto.
type: add c99 variable length array support

The dwarf standard allow certain attributes to be expressed as dwarf
expressions rather than constants. For instance upper-/lowerbound attributes.
In case of a c99 variable length array the upperbound is a dynamic attribute.

With this change c99 vla behave the same as with static arrays.

1| void foo (size_t n) {
2|   int ary[n];
3|   memset(ary, 0, sizeof(ary));
4| }

(gdb) print ary
$1 = {0 <repeats 42 times>}

gdb/ChangeLog:

	* dwarf2loc.c (dwarf2_locexpr_baton_eval): New function.
	(dwarf2_evaluate_property): New function.
	* dwarf2loc.h (dwarf2_evaluate_property): New function prototype.
	* dwarf2read.c (attr_to_dynamic_prop): New function.
	(read_subrange_type): Use attr_to_dynamic_prop to read high bound
	attribute.
	* gdbtypes.c: Include dwarf2loc.h.
	(is_dynamic_type): New function.
	(resolve_dynamic_type): New function.
	(resolve_dynamic_bounds): New function.
	(get_type_length): New function.
	(check_typedef): Use get_type_length to compute type length.
	* gdbtypes.h (TYPE_HIGH_BOUND_KIND): New macro.
	(TYPE_LOW_BOUND_KIND): New macro.
	(is_dynamic_type): New function prototype.
	* value.c (value_from_contents_and_address): Call resolve_dynamic_type
	to resolve dynamic properties of the type. Update comment.
	* valops.c (get_value_at, value_at, value_at_lazy): Update comment.
vla: enable sizeof operator to work with variable length arrays

In C99 the sizeof operator computes the size of a variable length array
at runtime (6.5.3.4 The sizeof operator). This patch reflects the semantic
change in the debugger.

We now are able to get the size of a vla:

1| void foo (size_t n) {
2|   int vla[n];
3| }

(gdb) p sizeof(vla)

yields N * sizeof(int).

gdb/ChangeLog:

	* eval.c (evaluate_subexp_for_sizeof) <OP_VAR_VALUE>: If the type
	passed to sizeof is dynamic evaluate the argument to compute the length.
vla: enable sizeof operator for indirection

This patch enables the sizeof operator for indirections:

1| void foo (size_t n) {
2|   int vla[n];
3|   int *vla_ptr = &vla;
4| }

(gdb) p sizeof(*vla_ptr)

yields sizeof (size_t) * n.

gdb/ChangeLog:

	* eval.c (evaluate_subexp_for_sizeof) <UNOP_IND>: Create an indirect
	value and retrieve the dynamic type size.
vla: update type from newly created value

Constructing a value based on a type and address might change the type
of the newly constructed value. Thus re-fetch type via value_type to ensure
we have the correct type at hand.

gdb/ChangeLog

	* ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value.
	(ada_template_to_fixed_record_type_1): Likewise.
	(ada_to_fixed_type_1): Likewise.
	* cp-valprint.c (cp_print_value_fields_rtti): Likewise.
	(cp_print_value): Likewise.
	* d-valprint.c (dynamic_array_type): Likewise.
	* findvar.c (address_of_variable): Likewise.
	* jv-valprint.c (java_value_print): Likewise.
	* valops.c (value_ind): Likewise.
	* value.c (coerce_ref): Likewise.
vla: print "variable length" for unresolved dynamic bounds

1| void foo (size_t n) {
2|   int vla[n];
3| }

Given the following expression

  (gdb) ptype &vla

Gdb evaluates the expression with EVAL_AVOID_SIDE_EFFECTS and thus
does not resolve the bounds information and misinterprets the high
bound as a constant. The current output is:

  type = int (*)[1289346]

this patch deals with this case and prints:

  type = int (*)[variable length]

instead.

gdb/ChangeLog:

	* c-typeprint.c (c_type_print_varspec_suffix): Added
	check for not yet resolved high bound. If unresolved, print
	"variable length" string to the console instead of random
	length.
vla: support for DW_AT_count

This patch adds support for DW_AT_count as requested in the code review:

  https://sourceware.org/ml/gdb-patches/2013-11/msg00200.html

gdb/ChangeLog:

	* dwarf2read.c (read_subrange_type): Convert DW_AT_count to a dynamic
	property and store it as the high bound and flag the range accordingly.
	* gdbtypes.c (resolve_dynamic_bounds): If range is flagged as
	RANGE_UPPER_BOUND_IS_COUNT assign low + high - 1 as the new high bound.
	* gdbtypes.h (enum range_flags): New enum.
	(struct range_bounds): Add flags member.
vla: resolve dynamic bounds if value contents is a constant byte-sequence

A variable location might be a constant value and therefore no inferior memory
access is needed to read the content. In this case try to resolve the type
bounds.

gdb/ChangeLog:

	* findvar.c (default_read_var_value): Resolve dynamic bounds if location
	points to a constant blob.
vla: evaluate operand of sizeof if its type is a vla

The c99 standard in "6.5.3.4 The sizeof operator" states:

 If the type of the operand is a variable length array type, the operand
 is evaluated;[...]

This patch mirrors the following c99 semantic in gdb:

 1| int vla[n][m];
 2| int i = 1;
 3| sizeof(vla[i++][0]); // No sideffect
 4| assert (i == 1);
 5| sizeof(vla[i++]);    // With sideffect
 6| assert (i == 2);

Note: ptype/whatis still do not allow any sideeffects.

This patch was motivated by:

  https://sourceware.org/ml/gdb-patches/2014-01/msg00732.html

gdb/ChangeLog:

	* eval.c (evaluate_subexp_for_sizeof): Add enum noside argument.
	(evaluate_subexp_standard): Pass noside argument.
	(evaluate_subexp_for_sizeof) <BINOP_SUBSCRIPT>: Handle subscript case
	if noside equals EVAL_NORMAL. If the subscript yields a vla type
	re-evaluate subscript operation with EVAL_NORMAL to enable sideffects.
	* gdbtypes.c (resolve_dynamic_bounds): Mark bound as evaluated.
	* gdbtypes.h (enum range_flags): Add RANGE_EVALUATED case.

testsuite/ChangeLog:

	* gdb.base/vla-sideeffect.c: New file.
	* gdb.base/vla-sideeffect.exp: New file.
test: cover subranges with present DW_AT_count attribute

The dwarf attribute DW_AT_count specifies the elements of a subrange.
This test covers subranges with present count but absent upper bound
attribute, both with static and dynamic attribute values.

testsuite/ChangeLog:

	* gdb.dwarf2/count.exp: New file.
test: evaluate pointers to C99 vla correctly.

gdb/testsuite/ChangeLog:

	* gdb.base/vla-ptr.c: New file.
	* gdb.base/vla-ptr.exp: New file.
test: basic c99 vla tests for C primitives

gdb/testsuite/ChangeLog:

	* gdb.base/vla-datatypes.c: New file.
	* gdb.base/vla-datatypes.exp: New file.
test: add mi vla test

testsuite/ChangeLog:

	* gdb.mi/mi-vla-c99.exp: New file.
	* gdb.mi/vla.c: New file.
handle DW_AT_type on an enumeration

DWARF allows an enumeration type to have a DW_AT_type.  GDB doesn't
recognize this, but there is a patch to change GCC to emit it, and a
DWARF proposal to further allow an enum type with a DW_AT_type to omit
the DW_AT_byte_size.  This patch changes gdb to implement this.

Built and regtested on x86-64 Fedora 20.

2014-04-14  Tom Tromey  <tromey@redhat.com>

	* dwarf2read.c (read_enumeration_type): Handle DW_AT_type.

2014-04-14  Tom Tromey  <tromey@redhat.com>

	* gdb.dwarf2/enum-type.exp: New file.
constify value_aggregate_elt

While working on another patch I realized that value_aggregate_elt's
"name" parameter ought to be const.  This patch implements this.

2014-04-14  Tom Tromey  <tromey@redhat.com>

	* valops.c (value_aggregate_elt, value_struct_elt_for_reference)
	(value_namespace_elt, value_maybe_namespace_elt): Make "name"
	const.
	* value.h (value_aggregate_elt): Update.
implement support for "enum class"

This adds support for the C++11 "enum class" feature.  This is
PR c++/15246.

I chose to use the existing TYPE_DECLARED_CLASS rather than introduce
a new type code.  This seemed both simple and clear to me.

I made overloading support for the new enum types strict.  This is how
it works in C++; and it didn't seem like an undue burden to keep this,
particularly because enum constants are printed symbolically by gdb.

Built and regtested on x86-64 Fedora 20.

2014-04-14  Tom Tromey  <tromey@redhat.com>

	PR c++/15246:
	* c-exp.y (type_aggregate_p): New function.
	(qualified_name, classify_inner_name): Use it.
	* c-typeprint.c (c_type_print_base): Handle TYPE_DECLARED_CLASS
	and TYPE_TARGET_TYPE of an enum type.
	* dwarf2read.c (read_enumeration_type): Set TYPE_DECLARED_CLASS on
	an enum type.
	(determine_prefix) <case DW_TAG_enumeration_type>: New case;
	handle TYPE_DECLARED_CLASS.
	* gdbtypes.c (rank_one_type): Handle TYPE_DECLARED_CLASS on enum
	types.
	* gdbtypes.h (TYPE_DECLARED_CLASS): Update comment.
	* valops.c (enum_constant_from_type): New function.
	(value_aggregate_elt): Use it.
	* cp-namespace.c (cp_lookup_nested_symbol): Handle
	TYPE_CODE_ENUM.

2014-04-14  Tom Tromey  <tromey@redhat.com>

	* gdb.cp/classes.exp (test_enums): Handle underlying type.
	* gdb.dwarf2/enum-type.exp: Add test for enum with underlying
	type.
	* gdb.cp/enum-class.exp: New file.
	* gdb.cp/enum-class.cc: New file.