return res;
}
-/* If in c++-11, check if the c++-11 alignment constraint with respect
- to fundamental alignment (in [dcl.align]) are satisfied. If not in
- c++-11 mode, does nothing.
-
- [dcl.align]2/ says:
-
- [* if the constant expression evaluates to a fundamental alignment,
- the alignment requirement of the declared entity shall be the
- specified fundamental alignment.
-
- * if the constant expression evaluates to an extended alignment
- and the implementation supports that alignment in the context
- of the declaration, the alignment of the declared entity shall
- be that alignment
-
- * if the constant expression evaluates to an extended alignment
- and the implementation does not support that alignment in the
- context of the declaration, the program is ill-formed]. */
-
-static bool
-check_cxx_fundamental_alignment_constraints (tree node,
- unsigned align_log,
- int flags)
-{
- bool alignment_too_large_p = false;
- unsigned requested_alignment = (1U << align_log) * BITS_PER_UNIT;
- unsigned max_align = 0;
-
- if ((!(flags & ATTR_FLAG_CXX11) && !warn_cxx_compat)
- || (node == NULL_TREE || node == error_mark_node))
- return true;
-
- if (cxx_fundamental_alignment_p (requested_alignment))
- return true;
-
- if (VAR_P (node))
- {
- if (TREE_STATIC (node) || DECL_EXTERNAL (node))
- /* For file scope variables and static members, the target supports
- alignments that are at most MAX_OFILE_ALIGNMENT. */
- max_align = MAX_OFILE_ALIGNMENT;
- else
- /* For stack variables, the target supports at most
- MAX_STACK_ALIGNMENT. */
- max_align = MAX_STACK_ALIGNMENT;
- if (requested_alignment > max_align)
- alignment_too_large_p = true;
- }
- /* Let's be liberal for types and fields; don't limit their alignment any
- more than check_user_alignment already did. */
-
- if (alignment_too_large_p)
- pedwarn (input_location, OPT_Wattributes,
- "requested alignment %d is larger than %d",
- requested_alignment / BITS_PER_UNIT, max_align / BITS_PER_UNIT);
-
- return !alignment_too_large_p;
-}
-
/* Common codes shared by handle_warn_if_not_aligned_attribute and
handle_aligned_attribute. */
/* Log2 of specified alignment. */
int pow2align = check_user_alignment (align_expr, objfile,
/* warn_zero = */ true);
- if (pow2align == -1
- || !check_cxx_fundamental_alignment_constraints (*node, pow2align, flags))
+ if (pow2align == -1)
{
*no_add_attrs = true;
return NULL_TREE;