Commit 12263f13 by H.J. Lu Committed by H.J. Lu

Don't warn function alignment if warn_if_not_aligned_p is true

When warn_if_not_aligned_p is true, a warning will be issued on function
declaration later.  There is no need to warn function alignment when
warn_if_not_aligned_p is true.

	* c-attribs.c (common_handle_aligned_attribute): Don't warn
	function alignment if warn_if_not_aligned_p is true.

From-SVN: r252036
parent 917a804c
2017-09-12 H.J. Lu <hongjiu.lu@intel.com>
* c-attribs.c (common_handle_aligned_attribute): Don't warn
function alignment if warn_if_not_aligned_p is true.
2017-09-12 Nathan Sidwell <nathan@acm.org> 2017-09-12 Nathan Sidwell <nathan@acm.org>
* c-common.c (field_decl_cmp, resort_data, resort_field_decl_cmp, * c-common.c (field_decl_cmp, resort_data, resort_field_decl_cmp,
......
...@@ -1754,9 +1754,12 @@ common_handle_aligned_attribute (tree *node, tree args, int flags, ...@@ -1754,9 +1754,12 @@ common_handle_aligned_attribute (tree *node, tree args, int flags,
This formally comes from the c++11 specification but we are This formally comes from the c++11 specification but we are
doing it for the GNU attribute syntax as well. */ doing it for the GNU attribute syntax as well. */
*no_add_attrs = true; *no_add_attrs = true;
else if (TREE_CODE (decl) == FUNCTION_DECL else if (!warn_if_not_aligned_p
&& TREE_CODE (decl) == FUNCTION_DECL
&& DECL_ALIGN (decl) > (1U << i) * BITS_PER_UNIT) && DECL_ALIGN (decl) > (1U << i) * BITS_PER_UNIT)
{ {
/* Don't warn function alignment here if warn_if_not_aligned_p is
true. It will be warned later. */
if (DECL_USER_ALIGN (decl)) if (DECL_USER_ALIGN (decl))
error ("alignment for %q+D was previously specified as %d " error ("alignment for %q+D was previously specified as %d "
"and may not be decreased", decl, "and may not be decreased", decl,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment