diff mbox

: Restore bootstrap with gcc < 4.3

Message ID CAFULd4Y-E_NnpsENb+bhD-pG7_NaGp-XJmSqCr9r-05ie3Qx+g@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak June 13, 2016, 9:23 a.m. UTC
Hello!

The new test finalization self tests fail wigh gcc < 4.3 due to the
way need_finalization_p is defined:

template<typename T>
static inline bool
need_finalization_p ()
{
#if GCC_VERSION >= 4003
  return !__has_trivial_destructor (T);
#else
  return true;
#endif
}

It is obvious that checking for

   ASSERT_FALSE (need_finalization_p <test_struct> ());

will always fail. Checking need_finalization_p is meaningless with gcc < 4.3.

2016-06-13  Uros Bizjak  <ubizjak@gmail.com>

    * ggc-tests.c (test_finalization): Only test need_finalization_p
    for GCC_VERSION >= 4003.

Bootstrapped on x86_64-linux-gnu, CentOS 5.11.

OK for mainline?

Uros.

Comments

Richard Biener June 13, 2016, 9:55 a.m. UTC | #1
On Mon, Jun 13, 2016 at 11:23 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
> The new test finalization self tests fail wigh gcc < 4.3 due to the
> way need_finalization_p is defined:
>
> template<typename T>
> static inline bool
> need_finalization_p ()
> {
> #if GCC_VERSION >= 4003
>   return !__has_trivial_destructor (T);
> #else
>   return true;
> #endif
> }
>
> It is obvious that checking for
>
>    ASSERT_FALSE (need_finalization_p <test_struct> ());
>
> will always fail. Checking need_finalization_p is meaningless with gcc < 4.3.
>
> 2016-06-13  Uros Bizjak  <ubizjak@gmail.com>
>
>     * ggc-tests.c (test_finalization): Only test need_finalization_p
>     for GCC_VERSION >= 4003.
>
> Bootstrapped on x86_64-linux-gnu, CentOS 5.11.
>
> OK for mainline?

Ok.

Richard.

> Uros.
>
> diff --git a/gcc/ggc-tests.c b/gcc/ggc-tests.c
> index 48eac03..7f97231 100644
> --- a/gcc/ggc-tests.c
> +++ b/gcc/ggc-tests.c
> @@ -190,8 +190,10 @@ int test_struct_with_dtor::dtor_call_count;
>  static void
>  test_finalization ()
>  {
> +#if GCC_VERSION >= 4003
>    ASSERT_FALSE (need_finalization_p <test_struct> ());
>    ASSERT_TRUE (need_finalization_p <test_struct_with_dtor> ());
> +#endif
>
>    /* Create some garbage.  */
>    const int count = 10;
diff mbox

Patch

diff --git a/gcc/ggc-tests.c b/gcc/ggc-tests.c
index 48eac03..7f97231 100644
--- a/gcc/ggc-tests.c
+++ b/gcc/ggc-tests.c
@@ -190,8 +190,10 @@  int test_struct_with_dtor::dtor_call_count;
 static void
 test_finalization ()
 {
+#if GCC_VERSION >= 4003
   ASSERT_FALSE (need_finalization_p <test_struct> ());
   ASSERT_TRUE (need_finalization_p <test_struct_with_dtor> ());
+#endif

   /* Create some garbage.  */
   const int count = 10;