This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][C++] Make __java_boolean a true bool (PR 33887)
On Wed, 30 Jan 2008, Andrew Haley wrote:
> Richard Guenther wrote:
>
> > With the patch reverted all is back to before for jboolean, just that
> > we no longer generate 'wrong' code but enforce its 1-bit integer
> > semantics correctly ;) (which might be indeed confusing to users - at
> > least I expected that jboolean behaves like bool as far as semantics
> > are concerned)
>
> Sounds good to me.
>
> Thank you for the detailed explanation.
I'm giving the following a try before reverting the patch. Andreas, does
this one fix the darwin problems?
(Yeah well, with that patch we say the types are the same, but hopefully
struct layout will not listen to us ;))
Richard.
Index: cp/decl.c
===================================================================
*** cp/decl.c (revision 131958)
--- cp/decl.c (working copy)
*************** record_builtin_java_type (const char* na
*** 3161,3167 ****
type = make_signed_type (size);
else if (size == -1)
{ /* "__java_boolean". */
! type = build_variant_type_copy (boolean_type_node);
}
else if (size > -32)
{ /* "__java_char". */
--- 3161,3171 ----
type = make_signed_type (size);
else if (size == -1)
{ /* "__java_boolean". */
! /* Do not use build_variant_type_copy here, as jboolean and
! bool may not agree in size as the C++ and Java ABIs may differ. */
! type = make_unsigned_type (1);
! TREE_SET_CODE (type, BOOLEAN_TYPE);
! TYPE_CANONICAL (type) = TYPE_CANONICAL (boolean_type_node);
}
else if (size > -32)
{ /* "__java_char". */