Add missing tests to test-combination.c

gcc/testsuite/
	* jit.dg/test-combination.c: Add test-arrays.c and test-volatile.c.
	Add comment about test-error-*.c.  Remove comment about
	test-failure.c, which was removed in
	96b218c9a1d5f39fb649e02c0e77586b180e8516.
	(create_code): Call into test-arrays.c and test-volatile.c.
	(verify_code): Likewise.
Tighten up the distinction between pointers and arrays

https://github.com/davidmalcolm/pygccjit/pull/3#issuecomment-37883129
showed a problem where a parameter expecting a (char *) was passed
a char[1024] cast to a (char *) as its argument, leading to an ICE:

libgccjit.so: internal compiler error: in convert_move, at expr.c:320
0x7fffebea98ad convert_move(rtx_def*, rtx_def*, int)
	../../src/gcc/expr.c:320
0x7fffebec31cb expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
	../../src/gcc/expr.c:8105
0x7fffec88d768 expand_gimple_stmt_1
	../../src/gcc/cfgexpand.c:2321
0x7fffec88d9cc expand_gimple_stmt
	../../src/gcc/cfgexpand.c:2381

The issue was that the recording::type::dereference method is used for
both pointers and for arrays, leading to sloppiness about where lvalues
and rvalues can be pointers vs arrays.

This commit introduces is_pointer and is_array methods, using them to
tighten up type-checking, converting the above ICE into an type-check
error when the cast is attempted:
  libgccjit.so: error: gcc_jit_context_new_cast: cannot cast buffer from type: char[1024] to type: char *

The correct way to use an array as a pointer in the JIT API is to use
   gcc_jit_lvalue_get_address
on the array, which gives you an rvalue representing the address of the
initial element, and then to cast that rvalue as necessary.

gcc/jit
	* internal-api.c (gcc::jit::recording::memento_of_get_pointer::
	accepts_writes_from): Accept writes from pointers, but not arrays.

	* internal-api.h (gcc::jit::recording::type::is_pointer): New.
	(gcc::jit::recording::type::is_array): New.
	(gcc::jit::recording::memento_of_get_type::accepts_writes_from):
	Allow (void *) to accept writes of pointers, but not arrays.
	(gcc::jit::recording::memento_of_get_type::is_pointer): New.
	(gcc::jit::recording::memento_of_get_type::is_array): New.
	(gcc::jit::recording::memento_of_get_pointer::is_pointer): New.
	(gcc::jit::recording::memento_of_get_pointer::is_array): New.
	(gcc::jit::recording::memento_of_get_const::is_pointer): New.
	(gcc::jit::recording::memento_of_get_const::is_array): New.
	(gcc::jit::recording::memento_of_get_volatile::is_pointer): New.
	(gcc::jit::recording::memento_of_get_volatile::is_array): New.
	(gcc::jit::recording::array_type::is_pointer): New.
	(gcc::jit::recording::array_type::is_array): New.
	(gcc::jit::recording::function_type::is_pointer): New.
	(gcc::jit::recording::function_type::is_array): New.
	(gcc::jit::recording::struct_::is_pointer): New.
	(gcc::jit::recording::struct_::is_array): New.

	* libgccjit.c (gcc_jit_context_new_rvalue_from_ptr): Require the
	pointer_type to be a pointer, not an array.
	(gcc_jit_context_null): Likewise.
	(is_valid_cast): Require pointer casts to be between pointer types,
	not arrays.
	(gcc_jit_context_new_array_access): Update error message from "not
	a pointer" to "not a pointer or array".
	(gcc_jit_rvalue_dereference_field): Require the pointer arg to be
	of pointer type, not an array.
	(gcc_jit_rvalue_dereference): Likewise.

gcc/testsuite/
	* jit.dg/test-array-as-pointer.c: New test case, verifying that
	there's a way to treat arrays as pointers.
	* jit.dg/test-combination.c: Add test-array-as-pointer.c...
	(create_code): ...here and...
	(verify_code): ...here.

	* jit.dg/test-error-array-as-pointer.c: New test case, verifying
	that bogus casts from array to pointer are caught by the type
	system, rather than leading to ICEs seen in:
	https://github.com/davidmalcolm/pygccjit/pull/3#issuecomment-37883129
Avoid shadowing progname global

gcc/jit/
	* internal-api.c (gcc::jit::recording::context::add_error_va):
	Rename local "progname" to "ctxt_progname" to avoid shadowing
	the related global, for clarity.
	(gcc::jit::playback::context::compile): Likewise.
introduce class toplev

This patch introduces a new "class toplev" and changes toplev_main and
toplev_finalize to be methods of this class.  Additionally, now the
timevars are automatically stopped when the object is destroyed.  This
cleans up "compile" a bit and makes it simpler to reuse the toplev
logic in other code.
introduce auto_timevar

This introduces a new auto_timevar class.  It pushes a given timevar
in its constructor, and pops it in the destructor, giving a much
simpler way to use timevars in the typical case where they can be
scoped.
Merge remote-tracking branch 'origin/dmalcolm/jit' into gdbjit

Conflicts:
	gcc/ChangeLog.jit
	gcc/jit/ChangeLog.jit
	gcc/jit/internal-api.c
	gcc/timevar.h
	gcc/toplev.c
	gcc/toplev.h