Skip to content

Commit 04c83f1

Browse files
author
hjl
committed
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252036 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent c5c6342 commit 04c83f1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

gcc/c-family/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2017-09-12 H.J. Lu <[email protected]>
2+
3+
* c-attribs.c (common_handle_aligned_attribute): Don't warn
4+
function alignment if warn_if_not_aligned_p is true.
5+
16
2017-09-12 Nathan Sidwell <[email protected]>
27

38
* c-common.c (field_decl_cmp, resort_data, resort_field_decl_cmp,

gcc/c-family/c-attribs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1754,9 +1754,12 @@ common_handle_aligned_attribute (tree *node, tree args, int flags,
17541754
This formally comes from the c++11 specification but we are
17551755
doing it for the GNU attribute syntax as well. */
17561756
*no_add_attrs = true;
1757-
else if (TREE_CODE (decl) == FUNCTION_DECL
1757+
else if (!warn_if_not_aligned_p
1758+
&& TREE_CODE (decl) == FUNCTION_DECL
17581759
&& DECL_ALIGN (decl) > (1U << i) * BITS_PER_UNIT)
17591760
{
1761+
/* Don't warn function alignment here if warn_if_not_aligned_p is
1762+
true. It will be warned later. */
17601763
if (DECL_USER_ALIGN (decl))
17611764
error ("alignment for %q+D was previously specified as %d "
17621765
"and may not be decreased", decl,

0 commit comments

Comments
 (0)