[PATCH] Fix up g++.dg/cpp*/feat-cxx*.C tests (was: [PATCH] Avoid unnecessary inclusion of <stdexcept> header)

Jakub Jelinek jakub@redhat.com
Thu Jun 6 20:20:00 GMT 2019


Hi!

On Thu, Jun 06, 2019 at 04:38:36PM +0100, Jonathan Wakely wrote:
> This can greatly reduce the amount of preprocessed code that is included
> by other headers, because <stdexcept> depends on <string> which is huge.
> 
> 	* include/std/array: Do not include <stdexcept>.
> 	* include/std/optional: Include <exception> and
> 	<bits/exception_defines.h> instead of <stdexcept>.
> 
> Preprocessed line counts for C++17 mode:
> 
>       <tuple> <memory> <map>
> Before   25774    32453 31616
> After     9925    23194 19062
> 
> Tested x86_64-linux, committed to trunk.
> 
> Once we have a gcc-10/porting_to.html page I'll note this change
> there, because code relying on std::string and std::allocator being
> defined by transitive includes will need to include the right headers.

Not only those, but apparently also ::size_t or std::plus; this broke
FAIL: g++.dg/cpp1y/feat-cxx14.C   (test for excess errors)
FAIL: g++.dg/cpp1z/feat-cxx1z.C  -std=gnu++17 (test for excess errors)
FAIL: g++.dg/cpp1z/pr85569.C  -std=c++17 (test for excess errors)
FAIL: g++.dg/cpp2a/feat-cxx2a.C   (test for excess errors)

Fixed thusly, tested on x86_64-linux with check-c++-all, ok for trunk?

2019-06-06  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/90772
	* g++.dg/cpp1y/feat-cxx14.C: Use std::size_t instead of size_t.
	* g++.dg/cpp1z/feat-cxx1z.C: Likewise.
	* g++.dg/cpp2a/feat-cxx2a.C: Likewise.
	* g++.dg/cpp1z/pr85569.C: Include <functional>.

--- gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C.jj	2017-09-12 09:35:46.955698280 +0200
+++ gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C	2019-06-06 22:08:59.853528085 +0200
@@ -303,11 +303,11 @@
 #if __has_include(<array>)
 #  define STD_ARRAY 1
 #  include <array>
-  template<typename _Tp, size_t _Num>
+  template<typename _Tp, std::size_t _Num>
     using array = std::array<_Tp, _Num>;
 #elif __has_include(<tr1/array>)
 #  define TR1_ARRAY 1
 #  include <tr1/array>
-  template<typename _Tp, size_t _Num>
+  template<typename _Tp, std::size_t _Num>
     typedef std::tr1::array<_Tp, _Num> array;
 #endif
--- gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C.jj	2019-01-16 09:35:07.360276820 +0100
+++ gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C	2019-06-06 22:09:21.571184644 +0200
@@ -292,12 +292,12 @@
 #if __has_include(<array>)
 #  define STD_ARRAY 1
 #  include <array>
-  template<typename _Tp, size_t _Num>
+  template<typename _Tp, std::size_t _Num>
     using array = std::array<_Tp, _Num>;
 #elif __has_include(<tr1/array>)
 #  define TR1_ARRAY 1
 #  include <tr1/array>
-  template<typename _Tp, size_t _Num>
+  template<typename _Tp, std::size_t _Num>
     typedef std::tr1::array<_Tp, _Num> array;
 #endif
 
--- gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C.jj	2019-01-16 09:35:07.800269539 +0100
+++ gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C	2019-06-06 22:09:37.432934738 +0200
@@ -291,12 +291,12 @@
 #if __has_include(<array>)
 #  define STD_ARRAY 1
 #  include <array>
-  template<typename _Tp, size_t _Num>
+  template<typename _Tp, std::size_t _Num>
     using array = std::array<_Tp, _Num>;
 #elif __has_include(<tr1/array>)
 #  define TR1_ARRAY 1
 #  include <tr1/array>
-  template<typename _Tp, size_t _Num>
+  template<typename _Tp, std::size_t _Num>
     typedef std::tr1::array<_Tp, _Num> array;
 #endif
 
--- gcc/testsuite/g++.dg/cpp1z/pr85569.C.jj	2018-12-05 09:16:42.870128432 +0100
+++ gcc/testsuite/g++.dg/cpp1z/pr85569.C	2019-06-06 22:15:46.462120520 +0200
@@ -2,6 +2,7 @@
 
 #include <utility>
 #include <tuple>
+#include <functional>
 
 #define LIFT_FWD(x) std::forward<decltype(x)>(x)
 

	Jakub



More information about the Gcc-patches mailing list