From a2c6e7f26ec122124c91ca215a285da69d19fac9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 29 Sep 2016 22:54:56 +0200 Subject: Implement P0001R1 - C++17 removal of register storage class specifier c-family/ Implement P0001R1 - C++17 removal of register storage class specifier c-family/ * c.opt (Wregister): New warning. * c-opts.c (c_common_post_options): Enable -Wregister by default for C++17. cp/ * decl.c (cp_finish_decl): Diagnose register storage class on vars except when used in GNU global or local register variable extension. (grokdeclarator): Diagnose register storage class on parameters. * except.c (expand_start_catch_block): Set DECL_REGISTER only after cp_finish_decl call. testsuite/ * c-c++-common/Wvarargs-2.c (foo1): Except new warning for C++17. * c-c++-common/vector-subscript-2.c (vf): Expect new error for C++17. * c-c++-common/vector-subscript-5.c (foo): Don't use register keyword if not __SSE2__. * c-c++-common/Wvarargs.c (foo1, foo3): Expect new warnings for C++17. * g++.dg/compat/struct-layout-1_generate.c (iterative_hash): Remove register keywords. * g++.dg/eh/pr29166.C: Add -Wno-register option. * g++.dg/warn/register-parm-1.C (erroneous_warning, no_erroneous_warning): Expect new warnings for C++17. * g++.dg/warn/register-var-2.C (f): Likewise. * g++.dg/parse/register1.C (f): Expect new error for C++17. * g++.dg/parse/linkage2.C (foo): Likewise. * g++.dg/torture/pr36826.C (CoinMin, CoinMax): Avoid register keyword on parameters for C++17. * g++.dg/cpp1z/register1.C: New test. * g++.dg/cpp1z/register2.C: New test. * g++.dg/cpp1z/register3.C: New test. From-SVN: r240638 --- gcc/testsuite/c-c++-common/Wvarargs-2.c | 2 +- gcc/testsuite/c-c++-common/Wvarargs.c | 4 ++-- gcc/testsuite/c-c++-common/vector-subscript-2.c | 2 +- gcc/testsuite/c-c++-common/vector-subscript-5.c | 5 ++++- 4 files changed, 8 insertions(+), 5 deletions(-) (limited to 'gcc/testsuite/c-c++-common') diff --git a/gcc/testsuite/c-c++-common/Wvarargs-2.c b/gcc/testsuite/c-c++-common/Wvarargs-2.c index a2e031f..1eacde1 100644 --- a/gcc/testsuite/c-c++-common/Wvarargs-2.c +++ b/gcc/testsuite/c-c++-common/Wvarargs-2.c @@ -23,7 +23,7 @@ foo0 (int a, int b, ...) } void -foo1 (int a, register int b, ...) +foo1 (int a, register int b, ...) // { dg-warning "ISO C\\+\\+1z does not allow 'register' storage class specifier" "" { target c++1z } } { va_list vp; /* 'b' is declared with register storage, but don't warn diff --git a/gcc/testsuite/c-c++-common/Wvarargs.c b/gcc/testsuite/c-c++-common/Wvarargs.c index 0f90cb3..20d8ec7 100644 --- a/gcc/testsuite/c-c++-common/Wvarargs.c +++ b/gcc/testsuite/c-c++-common/Wvarargs.c @@ -23,7 +23,7 @@ foo0 (int a, int b, ...) } void -foo1 (int a, register int b, ...) +foo1 (int a, register int b, ...) // { dg-warning "ISO C\\+\\+1z does not allow 'register' storage class specifier" "" { target c++1z } } { va_list vp; /* 'b' is declared with register storage, but don't warn @@ -45,7 +45,7 @@ foo2 (int a, int b, ...) } void -foo3 (int a, register int b, ...) +foo3 (int a, register int b, ...) // { dg-warning "ISO C\\+\\+1z does not allow 'register' storage class specifier" "" { target c++1z } } { va_list vp; /* 'b' is declared with register storage, so warn. */ diff --git a/gcc/testsuite/c-c++-common/vector-subscript-2.c b/gcc/testsuite/c-c++-common/vector-subscript-2.c index 84d55b9..e7bd251 100644 --- a/gcc/testsuite/c-c++-common/vector-subscript-2.c +++ b/gcc/testsuite/c-c++-common/vector-subscript-2.c @@ -7,6 +7,6 @@ float vf(int i) { - register vector float a; + register vector float a; // { dg-error "ISO C++1z does not allow 'register' storage class specifier" "" { target c++1z } } return a[0]; } diff --git a/gcc/testsuite/c-c++-common/vector-subscript-5.c b/gcc/testsuite/c-c++-common/vector-subscript-5.c index 916b4a2..66ed87a 100644 --- a/gcc/testsuite/c-c++-common/vector-subscript-5.c +++ b/gcc/testsuite/c-c++-common/vector-subscript-5.c @@ -5,7 +5,10 @@ typedef int U __attribute__ ((vector_size (16))); int foo (int i) { - register U u +#if __SSE2__ + register +#endif + U u #if __SSE2__ asm ("xmm0") #endif -- cgit v1.1