public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ PATCH] Add __cpp_guaranteed_copy_elision and __cpp_nontype_template_parameter_auto
@ 2019-01-12 13:37 Jakub Jelinek
  2019-01-14 20:07 ` Jason Merrill
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2019-01-12 13:37 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches

Hi!

So, from what I can understand, __cpp_guaranteed_copy_elision
is a C++17 P0135R1 feature test macro for a feature we claim to support,
and __cpp_nontype_template_parameter_auto is a new name for the
__cpp_template_auto macro (which doesn't appear anymore in the SD-6 lists,
but clang++ keeps it for backwards compatibility too).

Tested on x86_64-linux, ok for trunk?

2019-01-12  Jakub Jelinek  <jakub@redhat.com>

	* c-cppbuiltin.c (c_cpp_builtin): Define __cpp_guaranteed_copy_elision
	and __cpp_nontype_template_parameter_auto.  Add a comment that
	__cpp_template_auto is deprecated.

	* g++.dg/cpp1z/feat-cxx1z.C: Add tests for
	__cpp_guaranteed_copy_elision and __cpp_nontype_template_parameter_auto
	feature test macros.
	* g++.dg/cpp2a/feat-cxx2a.C: Likewise.

--- gcc/c-family/c-cppbuiltin.c.jj	2019-01-01 12:37:51.340414101 +0100
+++ gcc/c-family/c-cppbuiltin.c	2019-01-12 14:20:12.792148907 +0100
@@ -971,9 +971,13 @@ c_cpp_builtins (cpp_reader *pfile)
 	  cpp_define (pfile, "__cpp_aggregate_bases=201603");
 	  cpp_define (pfile, "__cpp_deduction_guides=201703");
 	  cpp_define (pfile, "__cpp_noexcept_function_type=201510");
+	  /* Old macro, superseded by
+	     __cpp_nontype_template_parameter_auto.  */
 	  cpp_define (pfile, "__cpp_template_auto=201606");
 	  cpp_define (pfile, "__cpp_structured_bindings=201606");
 	  cpp_define (pfile, "__cpp_variadic_using=201611");
+	  cpp_define (pfile, "__cpp_guaranteed_copy_elision=201606");
+	  cpp_define (pfile, "__cpp_nontype_template_parameter_auto=201606");
 	}
       if (cxx_dialect > cxx17)
 	{
--- gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C.jj	2018-10-22 09:28:06.387657035 +0200
+++ gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C	2019-01-12 14:27:15.014332003 +0100
@@ -417,6 +417,18 @@
 #  error "__cpp_variadic_using != 201611"
 #endif
 
+#ifndef __cpp_guaranteed_copy_elision
+#  error "__cpp_guaranteed_copy_elision"
+#elif __cpp_guaranteed_copy_elision != 201606
+#  error "__cpp_guaranteed_copy_elision != 201606"
+#endif
+
+#ifndef __cpp_nontype_template_parameter_auto
+#  error "__cpp_nontype_template_parameter_auto"
+#elif __cpp_nontype_template_parameter_auto != 201606
+#  error "__cpp_nontype_template_parameter_auto != 201606"
+#endif
+
 #ifdef __has_cpp_attribute
 
 #  if ! __has_cpp_attribute(maybe_unused)
--- gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C.jj	2018-11-17 00:16:41.302392263 +0100
+++ gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C	2019-01-12 14:29:03.283584283 +0100
@@ -416,6 +416,18 @@
 #  error "__cpp_variadic_using != 201611"
 #endif
 
+#ifndef __cpp_guaranteed_copy_elision
+#  error "__cpp_guaranteed_copy_elision"
+#elif __cpp_guaranteed_copy_elision != 201606
+#  error "__cpp_guaranteed_copy_elision != 201606"
+#endif
+
+#ifndef __cpp_nontype_template_parameter_auto
+#  error "__cpp_nontype_template_parameter_auto"
+#elif __cpp_nontype_template_parameter_auto != 201606
+#  error "__cpp_nontype_template_parameter_auto != 201606"
+#endif
+
 // C++20 features
 
 #if __cpp_conditional_explicit != 201806

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [C++ PATCH] Add __cpp_guaranteed_copy_elision and __cpp_nontype_template_parameter_auto
  2019-01-12 13:37 [C++ PATCH] Add __cpp_guaranteed_copy_elision and __cpp_nontype_template_parameter_auto Jakub Jelinek
@ 2019-01-14 20:07 ` Jason Merrill
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2019-01-14 20:07 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On 1/12/19 8:36 AM, Jakub Jelinek wrote:
> Hi!
> 
> So, from what I can understand, __cpp_guaranteed_copy_elision
> is a C++17 P0135R1 feature test macro for a feature we claim to support,
> and __cpp_nontype_template_parameter_auto is a new name for the
> __cpp_template_auto macro (which doesn't appear anymore in the SD-6 lists,
> but clang++ keeps it for backwards compatibility too).
> 
> Tested on x86_64-linux, ok for trunk?
> 
> 2019-01-12  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* c-cppbuiltin.c (c_cpp_builtin): Define __cpp_guaranteed_copy_elision
> 	and __cpp_nontype_template_parameter_auto.  Add a comment that
> 	__cpp_template_auto is deprecated.
> 
> 	* g++.dg/cpp1z/feat-cxx1z.C: Add tests for
> 	__cpp_guaranteed_copy_elision and __cpp_nontype_template_parameter_auto
> 	feature test macros.
> 	* g++.dg/cpp2a/feat-cxx2a.C: Likewise.

OK.

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-14 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-12 13:37 [C++ PATCH] Add __cpp_guaranteed_copy_elision and __cpp_nontype_template_parameter_auto Jakub Jelinek
2019-01-14 20:07 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).