aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2017-09-12 16:35:39 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2017-09-12 09:35:39 -0700
commit12263f13ac02720a2e67f4837533b93752fb154b (patch)
tree6bb3cf38f22ec1b20c8542ddc388dff7706a6d42 /gcc
parent917a804c6117a8b6aed2594b6695caf4dbcca217 (diff)
downloadgcc-12263f13ac02720a2e67f4837533b93752fb154b.zip
gcc-12263f13ac02720a2e67f4837533b93752fb154b.tar.gz
gcc-12263f13ac02720a2e67f4837533b93752fb154b.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-attribs.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 29037e5..6391ced 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+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>
* c-common.c (field_decl_cmp, resort_data, resort_field_decl_cmp,
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index 4f6638f..0337537 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -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
doing it for the GNU attribute syntax as well. */
*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)
{
+ /* Don't warn function alignment here if warn_if_not_aligned_p is
+ true. It will be warned later. */
if (DECL_USER_ALIGN (decl))
error ("alignment for %q+D was previously specified as %d "
"and may not be decreased", decl,