public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Robin Dapp <rdapp@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-1445] testsuite: Fix Wattributes test cases for s390 and add new tests. Date: Tue, 15 Jun 2021 08:04:01 +0000 (GMT) [thread overview] Message-ID: <20210615080401.6CC9B398901E@sourceware.org> (raw) https://gcc.gnu.org/g:3fe54645374b1d7992555e97d906a5ba281d3c54 commit r12-1445-g3fe54645374b1d7992555e97d906a5ba281d3c54 Author: Robin Dapp <rdapp@linux.ibm.com> Date: Tue Jun 15 09:06:15 2021 +0200 testsuite: Fix Wattributes test cases for s390 and add new tests. There are several FAILs because we have an s390-specific check for a warning which is not necessary anymore. Remove it. Add a new test case that expects a warning about conflicting function alignment. This would fail on s390 before but most likely on other targets as well so it can be a target-independent test. Also, add a test to verify that we do not emit a note when specifying conflicting alignment for the same declaration. Need to explicitly handle every dg-note because handling one disables dg-note pruning. gcc/testsuite/ChangeLog: * c-c++-common/Wattributes.c: Remove s390-specific check and add new tests. * gcc.dg/Wattributes-6.c: Likewise. Diff: --- gcc/testsuite/c-c++-common/Wattributes.c | 36 +++++++++++++++++++++++++++----- gcc/testsuite/gcc.dg/Wattributes-6.c | 36 +++++++++++++++++++++++++++----- 2 files changed, 62 insertions(+), 10 deletions(-) diff --git a/gcc/testsuite/c-c++-common/Wattributes.c b/gcc/testsuite/c-c++-common/Wattributes.c index 4ad90441b4d..978f3f938e9 100644 --- a/gcc/testsuite/c-c++-common/Wattributes.c +++ b/gcc/testsuite/c-c++-common/Wattributes.c @@ -97,6 +97,8 @@ fnoinline1 (void); /* { dg-message "previous declaration here" } */ /* Verify a warning for always_inline conflict. */ void ATTR ((always_inline)) fnoinline1 (void) { } /* { dg-warning "ignoring attribute .always_inline. because it conflicts with attribute .noinline." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ + /* { dg-note "previous definition" "" { target *-*-* } .-2 } */ /* Verify a warning for gnu_inline conflict. */ inline void ATTR ((gnu_inline)) @@ -364,13 +366,15 @@ inline int ATTR ((cold)) finline_cold_noreturn (int); inline int ATTR ((noreturn)) -finline_cold_noreturn (int); +finline_cold_noreturn (int); /* { dg-note "previous declaration here" } */ inline int ATTR ((noinline)) finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ inline int ATTR ((hot)) finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .hot. because it conflicts with attribute .cold." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ inline int ATTR ((warn_unused_result)) finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */ @@ -389,23 +393,25 @@ finline_cold_noreturn (int i) { (void)&i; __builtin_abort (); } and some on distinct declarations. */ inline int ATTR ((always_inline, hot)) -finline_hot_noret_align (int); +finline_hot_noret_align (int); /* { dg-note "previous declaration here" } */ inline int ATTR ((noreturn, noinline)) finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ inline int ATTR ((cold, aligned (8))) finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .cold. because it conflicts with attribute .hot." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ inline int ATTR ((warn_unused_result)) finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ inline int ATTR ((aligned (4))) - finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(8\\)." "" { target { ! { hppa*64*-*-* s390*-*-* } } } } */ -/* { dg-error "alignment for '.*finline_hot_noret_align.*' must be at least 8" "" { target s390*-*-* } .-1 } */ + finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(8\\)." "" { target { ! { hppa*64*-*-* } } } } */ inline int ATTR ((aligned (8))) -finline_hot_noret_align (int); +finline_hot_noret_align (int); /* { dg-note "previous declaration here" } */ inline int ATTR ((const)) finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .const. because it conflicts with attribute .noreturn." } */ @@ -416,6 +422,26 @@ inline int ATTR ((noreturn)) finline_hot_noret_align (int i) { (void)&i; __builtin_abort (); } +/* Expect a warning about conflicting alignment but without + other declarations inbetween. */ +inline int ATTR ((aligned (32))) +finline_align (int); /* { dg-note "previous declaration here" } */ + +inline int ATTR ((aligned (4))) +finline_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(32\\)." "" } */ + +inline int ATTR ((noreturn)) +finline_align (int i) { (void)&i; __builtin_abort (); } + + +/* Expect no note that would refer to the same declaration. */ +inline int ATTR ((aligned (32), aligned (4))) +finline_double_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(32\\)." } */ + +inline int ATTR ((noreturn)) +finline_double_align (int i) { (void)&i; __builtin_abort (); } + + /* Exercise variable attributes. */ extern int ATTR ((common)) diff --git a/gcc/testsuite/gcc.dg/Wattributes-6.c b/gcc/testsuite/gcc.dg/Wattributes-6.c index 4ba59bf2806..978f3f938e9 100644 --- a/gcc/testsuite/gcc.dg/Wattributes-6.c +++ b/gcc/testsuite/gcc.dg/Wattributes-6.c @@ -97,6 +97,8 @@ fnoinline1 (void); /* { dg-message "previous declaration here" } */ /* Verify a warning for always_inline conflict. */ void ATTR ((always_inline)) fnoinline1 (void) { } /* { dg-warning "ignoring attribute .always_inline. because it conflicts with attribute .noinline." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ + /* { dg-note "previous definition" "" { target *-*-* } .-2 } */ /* Verify a warning for gnu_inline conflict. */ inline void ATTR ((gnu_inline)) @@ -364,13 +366,15 @@ inline int ATTR ((cold)) finline_cold_noreturn (int); inline int ATTR ((noreturn)) -finline_cold_noreturn (int); +finline_cold_noreturn (int); /* { dg-note "previous declaration here" } */ inline int ATTR ((noinline)) finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ inline int ATTR ((hot)) finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .hot. because it conflicts with attribute .cold." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ inline int ATTR ((warn_unused_result)) finline_cold_noreturn (int); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */ @@ -389,23 +393,25 @@ finline_cold_noreturn (int i) { (void)&i; __builtin_abort (); } and some on distinct declarations. */ inline int ATTR ((always_inline, hot)) -finline_hot_noret_align (int); +finline_hot_noret_align (int); /* { dg-note "previous declaration here" } */ inline int ATTR ((noreturn, noinline)) finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .noinline. because it conflicts with attribute .always_inline." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ inline int ATTR ((cold, aligned (8))) finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .cold. because it conflicts with attribute .hot." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ inline int ATTR ((warn_unused_result)) finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .warn_unused_result. because it conflicts with attribute .noreturn." } */ + /* { dg-note "previous declaration here" "" { target *-*-* } .-1 } */ inline int ATTR ((aligned (4))) - finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(8\\)." "" { target { ! { hppa*64*-*-* s390*-*-* } } } } */ -/* { dg-error "alignment for 'finline_hot_noret_align' must be at least 8" "" { target s390*-*-* } .-1 } */ + finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(8\\)." "" { target { ! { hppa*64*-*-* } } } } */ inline int ATTR ((aligned (8))) -finline_hot_noret_align (int); +finline_hot_noret_align (int); /* { dg-note "previous declaration here" } */ inline int ATTR ((const)) finline_hot_noret_align (int); /* { dg-warning "ignoring attribute .const. because it conflicts with attribute .noreturn." } */ @@ -416,6 +422,26 @@ inline int ATTR ((noreturn)) finline_hot_noret_align (int i) { (void)&i; __builtin_abort (); } +/* Expect a warning about conflicting alignment but without + other declarations inbetween. */ +inline int ATTR ((aligned (32))) +finline_align (int); /* { dg-note "previous declaration here" } */ + +inline int ATTR ((aligned (4))) +finline_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(32\\)." "" } */ + +inline int ATTR ((noreturn)) +finline_align (int i) { (void)&i; __builtin_abort (); } + + +/* Expect no note that would refer to the same declaration. */ +inline int ATTR ((aligned (32), aligned (4))) +finline_double_align (int); /* { dg-warning "ignoring attribute .aligned \\(4\\). because it conflicts with attribute .aligned \\(32\\)." } */ + +inline int ATTR ((noreturn)) +finline_double_align (int i) { (void)&i; __builtin_abort (); } + + /* Exercise variable attributes. */ extern int ATTR ((common))
reply other threads:[~2021-06-15 8:04 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210615080401.6CC9B398901E@sourceware.org \ --to=rdapp@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).