diff mbox series

libstdc++-v3 expected: Don't test ABI-variant properties in requirements.cc

Message ID 20220405164329.99C9F20426@pchp3.se.axis.com
State New
Headers show
Series libstdc++-v3 expected: Don't test ABI-variant properties in requirements.cc | expand

Commit Message

Hans-Peter Nilsson April 5, 2022, 4:43 p.m. UTC
Ok to commit?
-------------- 8< --------------

Without this, for a target where alignment and structure-sizes are by
default byte-aligned, such as cris-elf, you'll see, in libstdc++.log:

/X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed
/X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: note: the comparison reduces to '(5 == 2)'
compiler exited with status 1
FAIL: 20_util/expected/requirements.cc (test for excess errors)
Excess errors:
/X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed

It seems the intent is a smoke-test and that conditionals for ABI
properties are out of scope, so best to just delete this particular
line.

libstdc++-v3/:
	* testsuite/20_util/expected/requirements.cc: Don't test
	ABI-variant properties of expected<>.
---
 libstdc++-v3/testsuite/20_util/expected/requirements.cc | 1 -
 1 file changed, 1 deletion(-)

Comments

Jonathan Wakely April 5, 2022, 6:47 p.m. UTC | #1
On Tue, 5 Apr 2022, 17:44 Hans-Peter Nilsson via Libstdc++, <
libstdc++@gcc.gnu.org> wrote:

> Ok to commit?
> -------------- 8< --------------
>
> Without this, for a target where alignment and structure-sizes are by
> default byte-aligned, such as cris-elf, you'll see, in libstdc++.log:
>
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error:
> static assertion failed
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: note:
> the comparison reduces to '(5 == 2)'
> compiler exited with status 1
> FAIL: 20_util/expected/requirements.cc (test for excess errors)
> Excess errors:
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error:
> static assertion failed
>
> It seems the intent is a smoke-test and that conditionals for ABI
> properties are out of scope, so best to just delete this particular
> line.
>

The idea is to ensure the object is no larger than necessary.

I think we could use == sizeof(void*)+alignof(void*) which would be correct
everywhere. Does that work for cris-elf?



> libstdc++-v3/:
>         * testsuite/20_util/expected/requirements.cc: Don't test
>         ABI-variant properties of expected<>.
> ---
>  libstdc++-v3/testsuite/20_util/expected/requirements.cc | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> b/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> index 485aa338679c..a51a007a4fc3 100644
> --- a/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> +++ b/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> @@ -124,6 +124,5 @@ static_assert( move_assignable< void, G > );
>  // QoI properties
>  static_assert( sizeof(std::expected<char, unsigned char>) == 2 );
>  static_assert( sizeof(std::expected<void, char>) == 2 );
> -static_assert( sizeof(std::expected<void*, char>) == 2 * __alignof(void*)
> );
>  static_assert( alignof(std::expected<void, char>) == 1 );
>  static_assert( alignof(std::expected<void*, char>) == alignof(void*) );
> --
> 2.30.2
>
>
Hans-Peter Nilsson April 6, 2022, 2:42 p.m. UTC | #2
> From: Jonathan Wakely <jwakely.gcc@gmail.com>
> Date: Tue, 5 Apr 2022 20:47:58 +0200

> On Tue, 5 Apr 2022, 17:44 Hans-Peter Nilsson via
> Libstdc++,
> <libstdc++@gcc.gnu.org<mailto:libstdc%2B%2B@gcc.gnu.org>>
> wrote:
> Ok to commit?
> -------------- 8< --------------
> 
> Without this, for a target where alignment and structure-sizes are by
> default byte-aligned, such as cris-elf, you'll see, in libstdc++.log:
> 
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: note: the comparison reduces to '(5 == 2)'
> compiler exited with status 1
> FAIL: 20_util/expected/requirements.cc (test for excess errors)
> Excess errors:
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed
> 
> It seems the intent is a smoke-test and that conditionals for ABI
> properties are out of scope, so best to just delete this particular
> line.
> 
> The idea is to ensure the object is no larger than necessary.
> 
> I think we could use == sizeof(void*)+alignof(void*) which
> would be correct everywhere. Does that work for cris-elf?

Oh right, yes it does.  Ok then, I'll commit this:

-------------- 8< --------------

[PATCH v2] libstdc++-v3 expected: Correct minimal-size test in requirements.cc

Without this, for a target where alignment and structure-sizes are by
default byte-aligned, such as cris-elf, you'll see, in libstdc++.log:

/X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed
/X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: note: the comparison reduces to '(5 == 2)'
compiler exited with status 1
FAIL: 20_util/expected/requirements.cc (test for excess errors)
Excess errors:
/X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed

The intent of that line is to check that the object is not larger than
necessary.

libstdc++-v3/:
	* testsuite/20_util/expected/requirements.cc: Correct minimal-size
	test.

---
 libstdc++-v3/testsuite/20_util/expected/requirements.cc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/20_util/expected/requirements.cc b/libstdc++-v3/testsuite/20_util/expected/requirements.cc
index 485aa338679c..a51a007a4fc3 100644
--- a/libstdc++-v3/testsuite/20_util/expected/requirements.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/requirements.cc
@@ -124,6 +124,6 @@ static_assert( move_assignable< void, G > );
 // QoI properties
 static_assert( sizeof(std::expected<char, unsigned char>) == 2 );
 static_assert( sizeof(std::expected<void, char>) == 2 );
-static_assert( sizeof(std::expected<void*, char>) == 2 * __alignof(void*) );
+static_assert( sizeof(std::expected<void*, char>) == sizeof(void*) + __alignof(void*) );
 static_assert( alignof(std::expected<void, char>) == 1 );
 static_assert( alignof(std::expected<void*, char>) == alignof(void*) );
Jonathan Wakely April 6, 2022, 3:57 p.m. UTC | #3
Thanks!

On Wed, 6 Apr 2022, 15:42 Hans-Peter Nilsson, <hp@axis.com> wrote:

> > From: Jonathan Wakely <jwakely.gcc@gmail.com>
> > Date: Tue, 5 Apr 2022 20:47:58 +0200
>
> > On Tue, 5 Apr 2022, 17:44 Hans-Peter Nilsson via
> > Libstdc++,
> > <libstdc++@gcc.gnu.org<mailto:libstdc%2B%2B@gcc.gnu.org>>
> > wrote:
> > Ok to commit?
> > -------------- 8< --------------
> >
> > Without this, for a target where alignment and structure-sizes are by
> > default byte-aligned, such as cris-elf, you'll see, in libstdc++.log:
> >
> > /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127:
> error: static assertion failed
> > /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127:
> note: the comparison reduces to '(5 == 2)'
> > compiler exited with status 1
> > FAIL: 20_util/expected/requirements.cc (test for excess errors)
> > Excess errors:
> > /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127:
> error: static assertion failed
> >
> > It seems the intent is a smoke-test and that conditionals for ABI
> > properties are out of scope, so best to just delete this particular
> > line.
> >
> > The idea is to ensure the object is no larger than necessary.
> >
> > I think we could use == sizeof(void*)+alignof(void*) which
> > would be correct everywhere. Does that work for cris-elf?
>
> Oh right, yes it does.  Ok then, I'll commit this:
>
> -------------- 8< --------------
>
> [PATCH v2] libstdc++-v3 expected: Correct minimal-size test in
> requirements.cc
>
> Without this, for a target where alignment and structure-sizes are by
> default byte-aligned, such as cris-elf, you'll see, in libstdc++.log:
>
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error:
> static assertion failed
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: note:
> the comparison reduces to '(5 == 2)'
> compiler exited with status 1
> FAIL: 20_util/expected/requirements.cc (test for excess errors)
> Excess errors:
> /X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error:
> static assertion failed
>
> The intent of that line is to check that the object is not larger than
> necessary.
>
> libstdc++-v3/:
>         * testsuite/20_util/expected/requirements.cc: Correct minimal-size
>         test.
>
> ---
>  libstdc++-v3/testsuite/20_util/expected/requirements.cc | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> b/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> index 485aa338679c..a51a007a4fc3 100644
> --- a/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> +++ b/libstdc++-v3/testsuite/20_util/expected/requirements.cc
> @@ -124,6 +124,6 @@ static_assert( move_assignable< void, G > );
>  // QoI properties
>  static_assert( sizeof(std::expected<char, unsigned char>) == 2 );
>  static_assert( sizeof(std::expected<void, char>) == 2 );
> -static_assert( sizeof(std::expected<void*, char>) == 2 * __alignof(void*)
> );
> +static_assert( sizeof(std::expected<void*, char>) == sizeof(void*) +
> __alignof(void*) );
>  static_assert( alignof(std::expected<void, char>) == 1 );
>  static_assert( alignof(std::expected<void*, char>) == alignof(void*) );
> --
> 2.30.2
>
>
diff mbox series

Patch

diff --git a/libstdc++-v3/testsuite/20_util/expected/requirements.cc b/libstdc++-v3/testsuite/20_util/expected/requirements.cc
index 485aa338679c..a51a007a4fc3 100644
--- a/libstdc++-v3/testsuite/20_util/expected/requirements.cc
+++ b/libstdc++-v3/testsuite/20_util/expected/requirements.cc
@@ -124,6 +124,5 @@  static_assert( move_assignable< void, G > );
 // QoI properties
 static_assert( sizeof(std::expected<char, unsigned char>) == 2 );
 static_assert( sizeof(std::expected<void, char>) == 2 );
-static_assert( sizeof(std::expected<void*, char>) == 2 * __alignof(void*) );
 static_assert( alignof(std::expected<void, char>) == 1 );
 static_assert( alignof(std::expected<void*, char>) == alignof(void*) );