Implement P0001R1 - C++17 removal of register storage class specifier

Jason Merrill jason@redhat.com
Sun Oct 2 18:38:00 GMT 2016


OK.

On Fri, Sep 30, 2016 at 7:28 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Sep 30, 2016 at 05:32:31PM -0400, Jason Merrill wrote:
>> On Fri, Sep 30, 2016 at 4:10 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> > On Thu, Sep 29, 2016 at 10:57:07PM +0000, Joseph Myers wrote:
>> >> This is missing documentation of the new -Wregister option in invoke.texi.
>> >
>> > While I had it in my head when working on the patch, I forgot to do that in the end.
>> > Fixed thusly, ok for trunk?
>>
>> OK.  But also, the patch has introduced several check-c++1z failures:
>>
>> > FAIL: g++.dg/charset/asm2.c  -std=c++1z (test for excess errors)
>> > FAIL: g++.dg/ext/asm3.C  -std=c++1z (test for excess errors)
>> > FAIL: g++.dg/tls/diag-2.C  -std=c++1z (test for excess errors)
>> > FAIL: g++.dg/tls/diag-4.C  -std=c++1z (test for excess errors)
>> > FAIL: g++.old-deja/g++.brendan/warnings4.C  -std=c++1z (test for excess errors)
>> > FAIL: g++.old-deja/g++.eh/ia64-1.C  -std=gnu++1z (test for excess errors)
>> > FAIL: g++.old-deja/g++.jason/enum3.C  -std=gnu++1z (test for excess errors)
>> > FAIL: g++.old-deja/g++.mike/net31.C  -std=c++1z (test for excess errors)
>> > FAIL: g++.old-deja/g++.mike/p700.C  -std=gnu++1z (test for excess errors)
>> > FAIL: g++.old-deja/g++.other/regstack.C  -std=gnu++1z (test for excess errors)
>
> Oops, I've been planning to do check-c++-all after the bootstrap/regtest,
> but apparently forgot to do that in the end.
>
> The following patch should fix that, ok for trunk?
>
> 2016-10-01  Jakub Jelinek  <jakub@redhat.com>
>
>         * g++.dg/ext/asm3.C (two): Only use register keyword for C++14 and
>         earlier.
>         * g++.dg/charset/asm2.c (memmove): Likewise.
>         * g++.dg/tls/diag-2.C (foo): Expect -Wregister error for C++17.
>         * g++.dg/tls/diag-4.C (foo): Likewise.
>         * c-c++-common/vector-subscript-2.c (vf): Change dg-error to
>         dg-warning, fix up regex.
>         * g++.old-deja/g++.brendan/warnings4.C: Limit to c++14_down targets.
>         * g++.old-deja/g++.mike/p700.C: Add -Wno-register.
>         * g++.old-deja/g++.mike/net31.C: Likewise.
>         * g++.old-deja/g++.other/regstack.C (foo): Expect -Wregister warning
>         for C++17.
>         * g++.old-deja/g++.jason/enum3.C: Add -Wno-register.
>         * g++.old-deja/g++.eh/ia64-1.C: Likewise.
>
> --- gcc/testsuite/g++.dg/ext/asm3.C.jj  2014-09-25 15:02:34.000000000 +0200
> +++ gcc/testsuite/g++.dg/ext/asm3.C     2016-10-01 01:00:53.107415429 +0200
> @@ -7,9 +7,12 @@
>
>  int two(int in)
>  {
> -  register int out;
> +#if __cplusplus <= 201402L
> +  register
> +#endif
> +  int out;
>    __asm__ ("" : "r" (out) : "r" (in));
>    return out;
>  }
>
> -// { dg-message "error:" "" { target *-*-* } 11 }
> +// { dg-message "error:" "" { target *-*-* } 14 }
> --- gcc/testsuite/g++.dg/charset/asm2.c.jj      2014-09-25 15:02:36.000000000 +0200
> +++ gcc/testsuite/g++.dg/charset/asm2.c 2016-10-01 00:58:59.594839475 +0200
> @@ -10,7 +10,10 @@
>  void *
>  memmove (void *__dest, __const void *__src, size_t __n)
>  {
> -  register unsigned long int __d0, __d1, __d2;
> +#if __cplusplus <= 201402L
> +  register
> +#endif
> +  unsigned long int __d0, __d1, __d2;
>    if (__dest < __src)
>      __asm__ __volatile__
>        ("cld\n\t"
> --- gcc/testsuite/g++.dg/tls/diag-2.C.jj        2014-09-25 15:02:36.000000000 +0200
> +++ gcc/testsuite/g++.dg/tls/diag-2.C   2016-10-01 01:03:03.002785384 +0200
> @@ -12,7 +12,7 @@ void foo()
>    auto __thread int l2;                /* { dg-error "multiple storage classes|data types" } */
>    __thread extern int l3;      /* { dg-error "'__thread' before 'extern'" } */
>    register __thread int l4;    /* { dg-error "multiple storage classes" } */
> -}
> +}                              /* { dg-error "ISO C\\+\\+1z does not allow 'register' storage class specifier" "" { target c++1z } .-1 } */
>
>  __thread void f1 ();           /* { dg-error "invalid for function" } */
>  extern __thread void f2 ();    /* { dg-error "invalid for function" } */
> --- gcc/testsuite/g++.dg/tls/diag-4.C.jj        2014-09-25 15:02:36.000000000 +0200
> +++ gcc/testsuite/g++.dg/tls/diag-4.C   2016-10-01 01:03:28.986458585 +0200
> @@ -7,4 +7,4 @@ void foo()
>  {
>    __thread auto int l2;                /* { dg-error "multiple storage classes|data types" } */
>    __thread register int l4;    /* { dg-error "multiple storage classes" } */
> -}
> +}                              /* { dg-error "ISO C\\+\\+1z does not allow 'register' storage class specifier" "" { target c++1z } .-1 } */
> --- gcc/testsuite/c-c++-common/vector-subscript-2.c.jj  2016-09-30 18:40:58.335979346 +0200
> +++ gcc/testsuite/c-c++-common/vector-subscript-2.c     2016-10-01 01:22:19.577245968 +0200
> @@ -7,6 +7,6 @@
>
>  float vf(int i)
>  {
> -  register vector float a;     // { dg-error "ISO C++1z does not allow 'register' storage class specifier" "" { target c++1z } }
> +  register vector float a;     // { dg-warning "ISO C\\+\\+1z does not allow 'register' storage class specifier" "" { target c++1z } }
>    return a[0];
>  }
> --- gcc/testsuite/g++.old-deja/g++.brendan/warnings4.C.jj       2014-09-25 15:02:10.000000000 +0200
> +++ gcc/testsuite/g++.old-deja/g++.brendan/warnings4.C  2016-10-01 01:05:18.605079901 +0200
> @@ -1,4 +1,4 @@
> -// { dg-do assemble  }
> +// { dg-do assemble { target c++14_down } }
>  // GROUPS passed warnings
>  int
>  main ()
> --- gcc/testsuite/g++.old-deja/g++.mike/p700.C.jj       2014-09-25 15:02:12.000000000 +0200
> +++ gcc/testsuite/g++.old-deja/g++.mike/p700.C  2016-10-01 01:07:48.797190919 +0200
> @@ -1,5 +1,5 @@
>  // { dg-do assemble  }
> -// { dg-options "-Wno-deprecated" }
> +// { dg-options "-Wno-deprecated -Wno-register" }
>  // { dg-error "limited range of data type" "16-bit target" { target xstormy16-*-* } 0 }
>  // prms-id: 700
>
> --- gcc/testsuite/g++.old-deja/g++.mike/net31.C.jj      2014-09-25 15:02:12.000000000 +0200
> +++ gcc/testsuite/g++.old-deja/g++.mike/net31.C 2016-10-01 01:07:18.519571724 +0200
> @@ -1,4 +1,5 @@
>  // { dg-do assemble  }
> +// { dg-additional-options "-Wno-register" }
>
>  class foo_a {
>    protected:
> --- gcc/testsuite/g++.old-deja/g++.other/regstack.C.jj  2014-09-25 15:02:11.000000000 +0200
> +++ gcc/testsuite/g++.old-deja/g++.other/regstack.C     2016-10-01 01:08:49.143431939 +0200
> @@ -3,7 +3,7 @@
>
>  inline double foo (double x)
>  {
> -  register double r;
> +  register double r;   // { dg-warning "ISO C\\+\\+1z does not allow 'register' storage class specifier" "" { target c++1z } }
>    asm volatile ("fsqrt" : "=t" (r) : "0" (x));
>    return r;
>  }
> --- gcc/testsuite/g++.old-deja/g++.jason/enum3.C.jj     2014-09-25 15:02:11.000000000 +0200
> +++ gcc/testsuite/g++.old-deja/g++.jason/enum3.C        2016-10-01 01:06:40.341051899 +0200
> @@ -1,5 +1,5 @@
>  // { dg-do assemble  }
> -// { dg-options "-Wall" }
> +// { dg-options "-Wall -Wno-register" }
>
>  enum tristate { no = -1, maybe, yes };
>
> --- gcc/testsuite/g++.old-deja/g++.eh/ia64-1.C.jj       2014-09-25 15:02:12.000000000 +0200
> +++ gcc/testsuite/g++.old-deja/g++.eh/ia64-1.C  2016-10-01 01:06:07.790461291 +0200
> @@ -1,5 +1,5 @@
>  // { dg-do run  }
> -// { dg-options "-O2" }
> +// { dg-options "-O2 -Wno-register" }
>
>  #include <exception>
>
>
>
>         Jakub



More information about the Gcc-patches mailing list