Since we have C++14 sized deallocation we should enable the SD-6 feature test macro.

For this feature test I'm not using language version but testing flag_sized_deallocation in case C++14 turns the feature off or C++11 turns the feature on (as my reading and testing indicate that it can).

Built and tested on x86_64-linux.

OK?

Ed

Index: c-family/c-cppbuiltin.c
===================================================================
--- c-family/c-cppbuiltin.c     (revision 218951)
+++ c-family/c-cppbuiltin.c     (working copy)
@@ -866,8 +866,9 @@
          cpp_define (pfile, "__cpp_aggregate_nsdmi=201304");
          cpp_define (pfile, "__cpp_variable_templates=201304");
          cpp_define (pfile, "__cpp_digit_separators=201309");
-         //cpp_define (pfile, "__cpp_sized_deallocation=201309");
        }
+      if (flag_sized_deallocation)
+       cpp_define (pfile, "__cpp_sized_deallocation=201309");
     }
   /* Note that we define this for C as well, so that we know if
      __attribute__((cleanup)) will interface with EH.  */
Index: testsuite/g++.dg/cpp1y/feat-cxx98-neg.C
===================================================================
--- testsuite/g++.dg/cpp1y/feat-cxx98-neg.C     (revision 218951)
+++ testsuite/g++.dg/cpp1y/feat-cxx98-neg.C     (working copy)
@@ -109,10 +109,9 @@
 #  error "__cpp_digit_separators" // { dg-error "error" }
 #endif
 
-//  Sized deallocation not in yet.
-//#ifdef __cpp_sized_deallocation
-//#  error "__cpp_sized_deallocation"
-//#endif
+#ifndef __cpp_sized_deallocation
+#  error "__cpp_sized_deallocation" // { dg-error "error" }
+#endif
 
 //  C++11 attributes:
 
Index: testsuite/g++.dg/cpp1y/feat-cxx14.C
===================================================================
--- testsuite/g++.dg/cpp1y/feat-cxx14.C (revision 218951)
+++ testsuite/g++.dg/cpp1y/feat-cxx14.C (working copy)
@@ -175,9 +175,10 @@
 #  error "__cpp_digit_separators != 201309"
 #endif
 
-//  Sized deallocation not in yet.
-#ifdef __cpp_sized_deallocation
+#ifndef __cpp_sized_deallocation
 #  error "__cpp_sized_deallocation"
+#elif __cpp_sized_deallocation != 201309
+#  error "__cpp_sized_deallocation != 201309"
 #endif
 
 //  GNU VLA support:
Index: testsuite/g++.dg/cpp1y/feat-cxx11-neg.C
===================================================================
--- testsuite/g++.dg/cpp1y/feat-cxx11-neg.C     (revision 218951)
+++ testsuite/g++.dg/cpp1y/feat-cxx11-neg.C     (working copy)
@@ -22,6 +22,10 @@
 #  error "__cpp_return_type_deduction" // { dg-error "error" }
 #endif
 
+#ifndef __cpp_aggregate_nsdmi
+#  error "__cpp_aggregate_nsdmi" // { dg-error "error" }
+#endif
+
 #ifndef __cpp_variable_templates
 #  error "__cpp_variable_templates" // { dg-error "error" }
 #endif
@@ -30,8 +34,8 @@
 #  error "__cpp_digit_separators" // { dg-error "error" }
 #endif
 
-#ifndef __cpp_aggregate_nsdmi
-#  error "__cpp_aggregate_nsdmi" // { dg-error "error" }
+#ifndef __cpp_sized_deallocation
+#  error "__cpp_sized_deallocation" // { dg-error "error" }
 #endif
 
 //  Array TS features:
Index: testsuite/g++.dg/cpp1y/feat-sized-dealloc-neg.C
===================================================================
--- testsuite/g++.dg/cpp1y/feat-sized-dealloc-neg.C     (revision 0)
+++ testsuite/g++.dg/cpp1y/feat-sized-dealloc-neg.C     (working copy)
@@ -0,0 +1,6 @@
+// { dg-do compile { target c++14 } }
+// { dg-options "-fno-sized-deallocation" }
+
+#ifndef __cpp_sized_deallocation
+#  error "__cpp_sized_deallocation" // { dg-error "error" }
+#endif
Index: testsuite/g++.dg/cpp1y/feat-sized-dealloc.C
===================================================================
--- testsuite/g++.dg/cpp1y/feat-sized-dealloc.C (revision 0)
+++ testsuite/g++.dg/cpp1y/feat-sized-dealloc.C (working copy)
@@ -0,0 +1,10 @@
+// { dg-do compile { target c++11_only } }
+// { dg-options "-fsized-deallocation" }
+
+// C++14 features:
+
+#ifndef __cpp_sized_deallocation
+#  error "__cpp_sized_deallocation"
+#elif __cpp_sized_deallocation != 201309
+#  error "__cpp_sized_deallocation != 201309"
+#endif
c-family/

2014-12-19  Edward Smith-Rowland  <3dw...@verizon.net>

        * c-cppbuiltin.c (__cpp_sized_deallocation): Uncomment and move macro.
        Control macro with flag_sized_deallocation.


testsuite/

2014-12-19  Edward Smith-Rowland  <3dw...@verizon.net>

        * g++.dg/cpp1y/feat-cxx98-neg.C: Enable __cpp_sized_deallocation test.
        * g++.dg/cpp1y/feat-cxx14.C: Ditto.
        * g++.dg/cpp1y/feat-cxx11-neg.C: Ditto and move tests for consistent
        order.
        * g++.dg/cpp1y/feat-sized-dealloc-neg.C: New.
        * g++.dg/cpp1y/feat-sized-dealloc.C: New.

Reply via email to