Constants, decls, types and misc nodes cannot be.
We define 5 non-variadic functions, from 0 to 4 arguments. This is
- enough for all extant tree codes. These functions can be called
- directly (preferably!), but can also be obtained via GCC preprocessor
- magic within the build macro. */
+ enough for all extant tree codes. */
tree
build0_stat (enum tree_code code, tree tt MEM_STAT_DECL)
return t;
}
-/* Backup definition for non-gcc build compilers. */
-
-tree
-(build) (enum tree_code code, tree tt, ...)
-{
- tree t, arg0, arg1, arg2, arg3, arg4, arg5, arg6;
- int length = TREE_CODE_LENGTH (code);
- va_list p;
-
- va_start (p, tt);
- switch (length)
- {
- case 0:
- t = build0 (code, tt);
- break;
- case 1:
- arg0 = va_arg (p, tree);
- t = build1 (code, tt, arg0);
- break;
- case 2:
- arg0 = va_arg (p, tree);
- arg1 = va_arg (p, tree);
- t = build2 (code, tt, arg0, arg1);
- break;
- case 3:
- arg0 = va_arg (p, tree);
- arg1 = va_arg (p, tree);
- arg2 = va_arg (p, tree);
- t = build3 (code, tt, arg0, arg1, arg2);
- break;
- case 4:
- arg0 = va_arg (p, tree);
- arg1 = va_arg (p, tree);
- arg2 = va_arg (p, tree);
- arg3 = va_arg (p, tree);
- t = build4 (code, tt, arg0, arg1, arg2, arg3);
- break;
- case 7:
- arg0 = va_arg (p, tree);
- arg1 = va_arg (p, tree);
- arg2 = va_arg (p, tree);
- arg3 = va_arg (p, tree);
- arg4 = va_arg (p, tree);
- arg5 = va_arg (p, tree);
- arg6 = va_arg (p, tree);
- t = build7 (code, tt, arg0, arg1, arg2, arg3, arg4, arg5, arg6);
- break;
- default:
- gcc_unreachable ();
- }
- va_end (p);
-
- return t;
-}
-
/* Similar except don't specify the TREE_TYPE
and leave the TREE_SIDE_EFFECTS as 0.
It is permissible for arguments to be null,
any damage. */
if (is_attribute_p ("dllimport", name))
{
- /* Honor any target-specific overides. */
+ /* Honor any target-specific overrides. */
if (!targetm.valid_dllimport_attribute_p (node))
*no_add_attrs = true;
{
t = build_variant_type_copy (type);
set_type_quals (t, type_quals);
+
+ /* If it's a pointer type, the new variant points to the same type. */
+ if (TREE_CODE (type) == POINTER_TYPE)
+ {
+ TYPE_NEXT_PTR_TO (t) = TYPE_NEXT_PTR_TO (type);
+ TYPE_NEXT_PTR_TO (type) = t;
+ }
+
+ /* Same for a reference type. */
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
+ {
+ TYPE_NEXT_REF_TO (t) = TYPE_NEXT_REF_TO (type);
+ TYPE_NEXT_REF_TO (type) = t;
+ }
}
return t;
/* Return an indication of the sign of the integer constant T.
The return value is -1 if T < 0, 0 if T == 0, and 1 if T > 0.
- Note that -1 will never be returned it T's type is unsigned. */
+ Note that -1 will never be returned if T's type is unsigned. */
int
tree_int_cst_sgn (tree t)
&& TREE_CODE (TYPE_POINTER_TO (to_type)) != POINTER_TYPE)
return TYPE_POINTER_TO (to_type);
- /* First, if we already have a type for pointers to TO_TYPE and it's
- the proper mode, use it. */
+ /* First, if we already have an unqualified type for pointers to TO_TYPE
+ and it's the proper mode, use it. */
for (t = TYPE_POINTER_TO (to_type); t; t = TYPE_NEXT_PTR_TO (t))
- if (TYPE_MODE (t) == mode && TYPE_REF_CAN_ALIAS_ALL (t) == can_alias_all)
+ if (TYPE_MODE (t) == mode
+ && !TYPE_QUALS (t)
+ && TYPE_REF_CAN_ALIAS_ALL (t) == can_alias_all)
return t;
t = make_node (POINTER_TYPE);
&& TREE_CODE (TYPE_REFERENCE_TO (to_type)) != REFERENCE_TYPE)
return TYPE_REFERENCE_TO (to_type);
- /* First, if we already have a type for pointers to TO_TYPE and it's
- the proper mode, use it. */
+ /* First, if we already have an unqualified type for references to TO_TYPE
+ and it's the proper mode, use it. */
for (t = TYPE_REFERENCE_TO (to_type); t; t = TYPE_NEXT_REF_TO (t))
- if (TYPE_MODE (t) == mode && TYPE_REF_CAN_ALIAS_ALL (t) == can_alias_all)
+ if (TYPE_MODE (t) == mode
+ && !TYPE_QUALS (t)
+ && TYPE_REF_CAN_ALIAS_ALL (t) == can_alias_all)
return t;
t = make_node (REFERENCE_TYPE);
return 0;
/* If we haven't been able to decide at this point, there nothing more we
- can check ourselves here. Look at the base type if we have one. */
- if (TREE_CODE (type) == INTEGER_TYPE && TREE_TYPE (type) != 0)
+ can check ourselves here. Look at the base type if we have one and it
+ has the same precision. */
+ if (TREE_CODE (type) == INTEGER_TYPE
+ && TREE_TYPE (type) != 0
+ && TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (type)))
return int_fits_type_p (c, TREE_TYPE (type));
/* Or to force_fit_type, if nothing else. */