[4/4] testsuite: Add default_packed filters

Message ID 20200720163106.27849-5-dimitar@dinux.eu
State New
Headers show
Series
  • testsuite: Add markers for default_packed targets
Related show

Commit Message

Dimitar Dimitrov July 20, 2020, 4:31 p.m.
Fix test cases assumptions that target has alignment constraints.

gcc/testsuite/ChangeLog:

	* gcc.dg/attr-copy-4.c: Unpacked may still have alignment of 1
	on targets with default_packed.
	* gcc.dg/c11-align-9.c: Remove AVR target filter and replace
	with default_packed filter.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>

---
 gcc/testsuite/gcc.dg/attr-copy-4.c | 1 +
 gcc/testsuite/gcc.dg/c11-align-9.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

Richard Sandiford July 20, 2020, 5:57 p.m. | #1
Dimitar Dimitrov <dimitar@dinux.eu> writes:
> Fix test cases assumptions that target has alignment constraints.

>

> gcc/testsuite/ChangeLog:

>

> 	* gcc.dg/attr-copy-4.c: Unpacked may still have alignment of 1

> 	on targets with default_packed.

> 	* gcc.dg/c11-align-9.c: Remove AVR target filter and replace

> 	with default_packed filter.


OK, thanks.

Richard

>

> Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>

> ---

>  gcc/testsuite/gcc.dg/attr-copy-4.c | 1 +

>  gcc/testsuite/gcc.dg/c11-align-9.c | 4 ++--

>  2 files changed, 3 insertions(+), 2 deletions(-)

>

> diff --git a/gcc/testsuite/gcc.dg/attr-copy-4.c b/gcc/testsuite/gcc.dg/attr-copy-4.c

> index 796724bb950..01fae3f78d4 100644

> --- a/gcc/testsuite/gcc.dg/attr-copy-4.c

> +++ b/gcc/testsuite/gcc.dg/attr-copy-4.c

> @@ -32,6 +32,7 @@ extern const struct PackedA packed;

>  

>  struct Unpacked { int i; char c; };

>  Assert (__alignof (struct Unpacked) > 1);

> +/* { dg-error "size of array .* is negative" "" { target default_packed } .-1 } */

>  

>  /* Verify that copying the packed attribute to the declaration

>     of an object is ignored with a warning.  (There should be

> diff --git a/gcc/testsuite/gcc.dg/c11-align-9.c b/gcc/testsuite/gcc.dg/c11-align-9.c

> index 3c9cf55756e..6a0d4248f1b 100644

> --- a/gcc/testsuite/gcc.dg/c11-align-9.c

> +++ b/gcc/testsuite/gcc.dg/c11-align-9.c

> @@ -2,8 +2,8 @@

>     are at least some alignment constraints), case of compound literals.  */

>  /* { dg-do compile } */

>  /* { dg-options "-std=c11 -pedantic-errors" } */

> -/* { dg-skip-if "no alignment constraints" { "avr-*-*" } } */

>  

>  #include <stddef.h>

>  

> -max_align_t *p = &(_Alignas (_Alignof (char)) max_align_t) { 1 }; /* { dg-error "reduce alignment" } */

> +max_align_t *p = &(_Alignas (_Alignof (char)) max_align_t) { 1 };

> +/* { dg-error "reduce alignment" "" { target { ! default_packed } } .-1 } */

Patch

diff --git a/gcc/testsuite/gcc.dg/attr-copy-4.c b/gcc/testsuite/gcc.dg/attr-copy-4.c
index 796724bb950..01fae3f78d4 100644
--- a/gcc/testsuite/gcc.dg/attr-copy-4.c
+++ b/gcc/testsuite/gcc.dg/attr-copy-4.c
@@ -32,6 +32,7 @@  extern const struct PackedA packed;
 
 struct Unpacked { int i; char c; };
 Assert (__alignof (struct Unpacked) > 1);
+/* { dg-error "size of array .* is negative" "" { target default_packed } .-1 } */
 
 /* Verify that copying the packed attribute to the declaration
    of an object is ignored with a warning.  (There should be
diff --git a/gcc/testsuite/gcc.dg/c11-align-9.c b/gcc/testsuite/gcc.dg/c11-align-9.c
index 3c9cf55756e..6a0d4248f1b 100644
--- a/gcc/testsuite/gcc.dg/c11-align-9.c
+++ b/gcc/testsuite/gcc.dg/c11-align-9.c
@@ -2,8 +2,8 @@ 
    are at least some alignment constraints), case of compound literals.  */
 /* { dg-do compile } */
 /* { dg-options "-std=c11 -pedantic-errors" } */
-/* { dg-skip-if "no alignment constraints" { "avr-*-*" } } */
 
 #include <stddef.h>
 
-max_align_t *p = &(_Alignas (_Alignof (char)) max_align_t) { 1 }; /* { dg-error "reduce alignment" } */
+max_align_t *p = &(_Alignas (_Alignof (char)) max_align_t) { 1 };
+/* { dg-error "reduce alignment" "" { target { ! default_packed } } .-1 } */