jit: document union types

gcc/jit/ChangeLog:
	* docs/topics/types.rst (gcc_jit_context_new_union_type): Add
	documentation.
	* docs/_build/texinfo/libgccjit.texi: Regenerate.

gcc/testsuite/ChangeLog:
	* jit.dg/test-accessing-union.c: Add comments for use by
	gcc/jit/docs/topics/types.rst.

From-SVN: r225246
This commit is contained in:
David Malcolm 2015-07-01 12:41:18 +00:00 committed by David Malcolm
parent c575221ada
commit e807aeaae3
5 changed files with 520 additions and 395 deletions

View File

@ -1,3 +1,9 @@
2015-07-01 David Malcolm <dmalcolm@redhat.com>
* docs/topics/types.rst (gcc_jit_context_new_union_type): Add
documentation.
* docs/_build/texinfo/libgccjit.texi: Regenerate.
2015-07-01 David Malcolm <dmalcolm@redhat.com>
* docs/topics/contexts.rst (gcc_jit_context_set_bool_option):

File diff suppressed because it is too large Load Diff

View File

@ -230,3 +230,22 @@ You can model C `struct` types by creating :c:type:`gcc_jit_struct *` and
Populate the fields of a formerly-opaque struct type.
This can only be called once on a given struct type.
.. function:: gcc_jit_type *\
gcc_jit_context_new_union_type (gcc_jit_context *ctxt,\
gcc_jit_location *loc,\
const char *name,\
int num_fields,\
gcc_jit_field **fields)
Construct a new union type, with the given name and fields.
The parameter ``name`` must be non-NULL. It is copied, so the input
buffer does not need to outlive the call.
Example of use:
.. literalinclude:: ../../../testsuite/jit.dg/test-accessing-union.c
:start-after: /* Quote from here in docs/topics/types.rst. */
:end-before: /* Quote up to here in docs/topics/types.rst. */
:language: c

View File

@ -1,3 +1,8 @@
2015-07-01 David Malcolm <dmalcolm@redhat.com>
* jit.dg/test-accessing-union.c: Add comments for use by
gcc/jit/docs/topics/types.rst.
2015-07-01 Matthew Wahab <matthew.wahab@arm.com>
* gcc.target/arm/armv8-sync-comp-swap.c: Replace

View File

@ -5,6 +5,8 @@
#include "harness.h"
/* Quote from here in docs/topics/types.rst. */
union int_or_float
{
int as_int;
@ -77,6 +79,8 @@ create_code (gcc_jit_context *ctxt, void *user_data)
as_float));
}
/* Quote up to here in docs/topics/types.rst. */
void
verify_code (gcc_jit_context *ctxt, gcc_jit_result *result)
{