From 99da11ec51b58e81b5dbbfb976aff11a31874efc Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Sun, 17 Dec 2017 23:23:28 +0000 Subject: [PATCH] c-attribs.c (common_handle_aligned_attribute): Avoid issuing an error for attribute warn_if_not_aligned. gcc/c-family/ChangeLog: * c-attribs.c (common_handle_aligned_attribute): Avoid issuing an error for attribute warn_if_not_aligned. From-SVN: r255767 --- gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c-attribs.c | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 0f0a370d8de..dd71fd01fe0 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2017-12-17 Martin Sebor + + * c-attribs.c (common_handle_aligned_attribute): Avoid issuing + an error for attribute warn_if_not_aligned. + 2017-12-16 Martin Sebor PR tree-optimization/78918 diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index 2625f87d19d..0ff02996ade 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -1879,14 +1879,17 @@ common_handle_aligned_attribute (tree *node, tree name, tree args, int flags, curalign /= BITS_PER_UNIT; bitalign /= BITS_PER_UNIT; + bool diagd = true; if (DECL_USER_ALIGN (decl) || DECL_USER_ALIGN (last_decl)) - warning (OPT_Wattributes, - "ignoring attribute %<%E (%u)%> because it conflicts with " - "attribute %<%E (%u)%>", name, bitalign, name, curalign); - else + diagd = warning (OPT_Wattributes, + "ignoring attribute %<%E (%u)%> because it conflicts " + "with attribute %<%E (%u)%>", + name, bitalign, name, curalign); + else if (!warn_if_not_aligned_p) + /* Do not error out for attribute warn_if_not_aligned. */ error ("alignment for %q+D must be at least %d", decl, curalign); - if (note) + if (diagd && note) inform (DECL_SOURCE_LOCATION (last_decl), "previous declaration here"); *no_add_attrs = true; -- 2.30.2