diff mbox

[trivial] Fix PR71214 (__cpp_rvalue_references vs. __cpp_rvalue_reference)

Message ID 20160705100741.GB316@x4
State New
Headers show

Commit Message

Markus Trippelsdorf July 5, 2016, 10:07 a.m. UTC
Hi, 

as PR71214 points out gcc uses a wrong feature test macro for C++11
rvalue references: __cpp_rvalue_reference instead of the correct 
__cpp_rvalue_references.

The fix is trivial. Ok for trunk and active branches?

Thanks.

c-family/ChangeLog

	* c-cppbuiltin.c (c_cpp_builtins): Use __cpp_rvalue_references
	instead of __cpp_rvalue_reference.

Comments

Richard Biener July 5, 2016, 10:44 a.m. UTC | #1
On Tue, Jul 5, 2016 at 12:07 PM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
> Hi,
>
> as PR71214 points out gcc uses a wrong feature test macro for C++11
> rvalue references: __cpp_rvalue_reference instead of the correct
> __cpp_rvalue_references.
>
> The fix is trivial. Ok for trunk and active branches?

I wonder if we should to retain the (bogus) old defines for backward
compatibility.

Does anyone use those?

Richard.

> Thanks.
>
> c-family/ChangeLog
>
>         * c-cppbuiltin.c (c_cpp_builtins): Use __cpp_rvalue_references
>         instead of __cpp_rvalue_reference.
>
> diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
> index 408ad4747a33..f19375a73730 100644
> --- a/gcc/c-family/c-cppbuiltin.c
> +++ b/gcc/c-family/c-cppbuiltin.c
> @@ -847,7 +847,7 @@ c_cpp_builtins (cpp_reader *pfile)
>             cpp_define (pfile, "__cpp_static_assert=200410");
>           cpp_define (pfile, "__cpp_decltype=200707");
>           cpp_define (pfile, "__cpp_attributes=200809");
> -         cpp_define (pfile, "__cpp_rvalue_reference=200610");
> +         cpp_define (pfile, "__cpp_rvalue_references=200610");
>           cpp_define (pfile, "__cpp_variadic_templates=200704");
>           cpp_define (pfile, "__cpp_initializer_lists=200806");
>           cpp_define (pfile, "__cpp_delegating_constructors=200604");
> diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
> index 397b9a899573..6928d6bcbd87 100644
> --- a/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
> +++ b/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
> @@ -77,10 +77,10 @@
>  #  error "__cpp_attributes != 200809"
>  #endif
>
> -#ifndef __cpp_rvalue_reference
> -#  error "__cpp_rvalue_reference"
> -#elif __cpp_rvalue_reference != 200610
> -#  error "__cpp_rvalue_reference != 200610"
> +#ifndef __cpp_rvalue_references
> +#  error "__cpp_rvalue_references"
> +#elif __cpp_rvalue_references != 200610
> +#  error "__cpp_rvalue_references != 200610"
>  #endif
>
>  #ifndef __cpp_variadic_templates
> diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
> index fa59f90fa892..dc30a9b3cf84 100644
> --- a/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
> +++ b/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
> @@ -70,10 +70,10 @@
>  #  error "__cpp_attributes != 200809"
>  #endif
>
> -#ifndef __cpp_rvalue_reference
> -#  error "__cpp_rvalue_reference"
> -#elif __cpp_rvalue_reference != 200610
> -#  error "__cpp_rvalue_reference != 200610"
> +#ifndef __cpp_rvalue_references
> +#  error "__cpp_rvalue_references"
> +#elif __cpp_rvalue_references != 200610
> +#  error "__cpp_rvalue_references != 200610"
>  #endif
>
>  #ifndef __cpp_variadic_templates
> diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C
> index 886b3d3df10e..5fbffabd1396 100644
> --- a/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C
> +++ b/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C
> @@ -42,8 +42,8 @@
>  #  error "__cpp_attributes" // { dg-error "error" }
>  #endif
>
> -#ifndef __cpp_rvalue_reference
> -#  error "__cpp_rvalue_reference" // { dg-error "error" }
> +#ifndef __cpp_rvalue_references
> +#  error "__cpp_rvalue_references" // { dg-error "error" }
>  #endif
>
>  #ifndef __cpp_variadic_templates
> diff --git a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
> index f8a87a8ddc37..c7becc1cbb47 100644
> --- a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
> +++ b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
> @@ -58,10 +58,10 @@
>  #  error "__cpp_attributes != 200809"
>  #endif
>
> -#ifndef __cpp_rvalue_reference
> -#  error "__cpp_rvalue_reference"
> -#elif __cpp_rvalue_reference != 200610
> -#  error "__cpp_rvalue_reference != 200610"
> +#ifndef __cpp_rvalue_references
> +#  error "__cpp_rvalue_references"
> +#elif __cpp_rvalue_references != 200610
> +#  error "__cpp_rvalue_references != 200610"
>  #endif
>
>  #ifndef __cpp_variadic_templates
> --
> Markus
Jason Merrill July 5, 2016, 4:21 p.m. UTC | #2
On Tue, Jul 5, 2016 at 6:44 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Tue, Jul 5, 2016 at 12:07 PM, Markus Trippelsdorf
> <markus@trippelsdorf.de> wrote:
>> Hi,
>>
>> as PR71214 points out gcc uses a wrong feature test macro for C++11
>> rvalue references: __cpp_rvalue_reference instead of the correct
>> __cpp_rvalue_references.
>>
>> The fix is trivial. Ok for trunk and active branches?
>
> I wonder if we should to retain the (bogus) old defines for backward
> compatibility.

Hmm.  The original SD-6 proposal
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3694.htm)
used the singular, but it soon changed to plural; I haven't been able
to find any email discussion of the change.  I think let's keep both
defines.

Jason
Markus Trippelsdorf July 5, 2016, 4:30 p.m. UTC | #3
On 2016.07.05 at 12:21 -0400, Jason Merrill wrote:
> On Tue, Jul 5, 2016 at 6:44 AM, Richard Biener
> <richard.guenther@gmail.com> wrote:
> > On Tue, Jul 5, 2016 at 12:07 PM, Markus Trippelsdorf
> > <markus@trippelsdorf.de> wrote:
> >> Hi,
> >>
> >> as PR71214 points out gcc uses a wrong feature test macro for C++11
> >> rvalue references: __cpp_rvalue_reference instead of the correct
> >> __cpp_rvalue_references.
> >>
> >> The fix is trivial. Ok for trunk and active branches?
> >
> > I wonder if we should to retain the (bogus) old defines for backward
> > compatibility.
> 
> Hmm.  The original SD-6 proposal
> (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3694.htm)
> used the singular, but it soon changed to plural; I haven't been able
> to find any email discussion of the change.  I think let's keep both
> defines.

Ok, no problem. But what about the testsuite fallout?

1) Change to plural as in my patch.
2) Add additional tests for plural.
3) Don't change anything at all.
Jason Merrill July 5, 2016, 5:09 p.m. UTC | #4
On Tue, Jul 5, 2016 at 12:30 PM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
> On 2016.07.05 at 12:21 -0400, Jason Merrill wrote:
>> On Tue, Jul 5, 2016 at 6:44 AM, Richard Biener
>> <richard.guenther@gmail.com> wrote:
>> > On Tue, Jul 5, 2016 at 12:07 PM, Markus Trippelsdorf
>> > <markus@trippelsdorf.de> wrote:
>> >> Hi,
>> >>
>> >> as PR71214 points out gcc uses a wrong feature test macro for C++11
>> >> rvalue references: __cpp_rvalue_reference instead of the correct
>> >> __cpp_rvalue_references.
>> >>
>> >> The fix is trivial. Ok for trunk and active branches?
>> >
>> > I wonder if we should to retain the (bogus) old defines for backward
>> > compatibility.
>>
>> Hmm.  The original SD-6 proposal
>> (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3694.htm)
>> used the singular, but it soon changed to plural; I haven't been able
>> to find any email discussion of the change.  I think let's keep both
>> defines.
>
> Ok, no problem. But what about the testsuite fallout?
>
> 1) Change to plural as in my patch.
> 2) Add additional tests for plural.
> 3) Don't change anything at all.

Changing the test to plural seems appropriate.

Jason
diff mbox

Patch

diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 408ad4747a33..f19375a73730 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -847,7 +847,7 @@  c_cpp_builtins (cpp_reader *pfile)
 	    cpp_define (pfile, "__cpp_static_assert=200410");
 	  cpp_define (pfile, "__cpp_decltype=200707");
 	  cpp_define (pfile, "__cpp_attributes=200809");
-	  cpp_define (pfile, "__cpp_rvalue_reference=200610");
+	  cpp_define (pfile, "__cpp_rvalue_references=200610");
 	  cpp_define (pfile, "__cpp_variadic_templates=200704");
 	  cpp_define (pfile, "__cpp_initializer_lists=200806");
 	  cpp_define (pfile, "__cpp_delegating_constructors=200604");
diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
index 397b9a899573..6928d6bcbd87 100644
--- a/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
+++ b/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C
@@ -77,10 +77,10 @@ 
 #  error "__cpp_attributes != 200809"
 #endif
 
-#ifndef __cpp_rvalue_reference
-#  error "__cpp_rvalue_reference"
-#elif __cpp_rvalue_reference != 200610
-#  error "__cpp_rvalue_reference != 200610"
+#ifndef __cpp_rvalue_references
+#  error "__cpp_rvalue_references"
+#elif __cpp_rvalue_references != 200610
+#  error "__cpp_rvalue_references != 200610"
 #endif
 
 #ifndef __cpp_variadic_templates
diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
index fa59f90fa892..dc30a9b3cf84 100644
--- a/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
+++ b/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C
@@ -70,10 +70,10 @@ 
 #  error "__cpp_attributes != 200809"
 #endif
 
-#ifndef __cpp_rvalue_reference
-#  error "__cpp_rvalue_reference"
-#elif __cpp_rvalue_reference != 200610
-#  error "__cpp_rvalue_reference != 200610"
+#ifndef __cpp_rvalue_references
+#  error "__cpp_rvalue_references"
+#elif __cpp_rvalue_references != 200610
+#  error "__cpp_rvalue_references != 200610"
 #endif
 
 #ifndef __cpp_variadic_templates
diff --git a/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C b/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C
index 886b3d3df10e..5fbffabd1396 100644
--- a/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C
+++ b/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C
@@ -42,8 +42,8 @@ 
 #  error "__cpp_attributes" // { dg-error "error" }
 #endif
 
-#ifndef __cpp_rvalue_reference
-#  error "__cpp_rvalue_reference" // { dg-error "error" }
+#ifndef __cpp_rvalue_references
+#  error "__cpp_rvalue_references" // { dg-error "error" }
 #endif
 
 #ifndef __cpp_variadic_templates
diff --git a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
index f8a87a8ddc37..c7becc1cbb47 100644
--- a/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
+++ b/gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
@@ -58,10 +58,10 @@ 
 #  error "__cpp_attributes != 200809"
 #endif
 
-#ifndef __cpp_rvalue_reference
-#  error "__cpp_rvalue_reference"
-#elif __cpp_rvalue_reference != 200610
-#  error "__cpp_rvalue_reference != 200610"
+#ifndef __cpp_rvalue_references
+#  error "__cpp_rvalue_references"
+#elif __cpp_rvalue_references != 200610
+#  error "__cpp_rvalue_references != 200610"
 #endif
 
 #ifndef __cpp_variadic_templates