public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc_jit_context_new_union_type()
@ 2015-01-01  0:00 Dibyendu Majumdar
  2015-01-01  0:00 ` gcc_jit_context_new_union_type() David Malcolm
  0 siblings, 1 reply; 3+ messages in thread
From: Dibyendu Majumdar @ 2015-01-01  0:00 UTC (permalink / raw)
  To: jit

Should gcc_jit_context_new_union_type() return gcc_jit_struct* instead
of gcc_jit_type*?

Regards
Dibyendu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gcc_jit_context_new_union_type()
  2015-01-01  0:00 gcc_jit_context_new_union_type() Dibyendu Majumdar
@ 2015-01-01  0:00 ` David Malcolm
  2015-01-01  0:00   ` gcc_jit_context_new_union_type() Dibyendu Majumdar
  0 siblings, 1 reply; 3+ messages in thread
From: David Malcolm @ 2015-01-01  0:00 UTC (permalink / raw)
  To: Dibyendu Majumdar; +Cc: jit

On Fri, 2015-06-12 at 21:45 +0100, Dibyendu Majumdar wrote:
> Should gcc_jit_context_new_union_type() return gcc_jit_struct* instead
> of gcc_jit_type*?

No, because you can't call
  gcc_jit_struct_set_fields
on a union type, only on the result of gcc_jit_context_new_opaque_struct
(once).  Having new_union_type return a gcc_jit_type gives the compiler
a way to warn about such a call.

Is this something that you need to do?

Dave


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gcc_jit_context_new_union_type()
  2015-01-01  0:00 ` gcc_jit_context_new_union_type() David Malcolm
@ 2015-01-01  0:00   ` Dibyendu Majumdar
  0 siblings, 0 replies; 3+ messages in thread
From: Dibyendu Majumdar @ 2015-01-01  0:00 UTC (permalink / raw)
  To: David Malcolm; +Cc: jit

On 12 June 2015 at 21:47, David Malcolm <dmalcolm@redhat.com> wrote:
>> Should gcc_jit_context_new_union_type() return gcc_jit_struct* instead
>> of gcc_jit_type*?
>
> No, because you can't call
>   gcc_jit_struct_set_fields
> on a union type, only on the result of gcc_jit_context_new_opaque_struct
> (once).  Having new_union_type return a gcc_jit_type gives the compiler
> a way to warn about such a call.
>
> Is this something that you need to do?
>

Just trying to understand why there is a difference between:

extern gcc_jit_struct *
gcc_jit_context_new_struct_type (gcc_jit_context *ctxt,
gcc_jit_location *loc,
const char *name,
int num_fields,
gcc_jit_field **fields);

/* Unions work similarly to structs.  */
extern 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);

Regards

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-12 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-01  0:00 gcc_jit_context_new_union_type() Dibyendu Majumdar
2015-01-01  0:00 ` gcc_jit_context_new_union_type() David Malcolm
2015-01-01  0:00   ` gcc_jit_context_new_union_type() Dibyendu Majumdar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).