libstdc++: Fix up parallel_backend_serial.h [PR97549]

Message ID 20210220093220.GX4020736@tucnak
State New
Headers show
Series
  • libstdc++: Fix up parallel_backend_serial.h [PR97549]
Related show

Commit Message

Kewen.Lin via Gcc-patches Feb. 20, 2021, 9:32 a.m.
Hi!

In GCC 10, parallel_backend.h just included parallel_backend_{serial,tbb}.h and
did nothing beyond that, and parallel_backend_tbb.h provided directly
namespace __pstl { namespace __par_backend { ... } }
and defined everything in there, while parallel_backend_serial.h did:
namespace __pstl { namespace __serial { ... } } and had this
namespace __pstl { namespace __par_backend { using namespace __pstl::__serial; } }
at the end.
In GCC 11, parallel_backend.h does:
namespace __pstl { namespace __par_backend = __serial_backend; }
after including parallel_backend_serial.h or
namespace __pstl { namespace __par_backend = __tbb_backend; }
after including parallel_backend_tbb.h.  The latter then has:
namespace __pstl { namespace __tbb_backend { ... } }
and no using etc. at the end, while parallel_backend_serial.h changed to:
namespace __pstl { namespace __serial_backend { ... } }
but has this leftover block from the GCC 10 times.  Even changing that
using namespace __pstl::__serial;
to
using namespace __pstl::__serial_backend;
doesn't work, as it clashes with
namespace __pstl { namespace __par_backend = __serial_backend; }
in parallel_backend.h.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux
both without and with tbb-devel installed.

Ok for trunk?

2021-02-20  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++-v3/97549
	* include/pstl/parallel_backend_serial.h: Remove __pstl::__par_backend.


	Jakub

Comments

Kewen.Lin via Gcc-patches Feb. 22, 2021, 7:14 p.m. | #1
----- Original Message -----
> Hi!

> 

> In GCC 10, parallel_backend.h just included parallel_backend_{serial,tbb}.h

> and

> did nothing beyond that, and parallel_backend_tbb.h provided directly

> namespace __pstl { namespace __par_backend { ... } }

> and defined everything in there, while parallel_backend_serial.h did:

> namespace __pstl { namespace __serial { ... } } and had this

> namespace __pstl { namespace __par_backend { using namespace

> __pstl::__serial; } }

> at the end.

> In GCC 11, parallel_backend.h does:

> namespace __pstl { namespace __par_backend = __serial_backend; }

> after including parallel_backend_serial.h or

> namespace __pstl { namespace __par_backend = __tbb_backend; }

> after including parallel_backend_tbb.h.  The latter then has:

> namespace __pstl { namespace __tbb_backend { ... } }

> and no using etc. at the end, while parallel_backend_serial.h changed to:

> namespace __pstl { namespace __serial_backend { ... } }

> but has this leftover block from the GCC 10 times.  Even changing that

> using namespace __pstl::__serial;

> to

> using namespace __pstl::__serial_backend;

> doesn't work, as it clashes with

> namespace __pstl { namespace __par_backend = __serial_backend; }

> in parallel_backend.h.

> 

> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux

> both without and with tbb-devel installed.

> 

> Ok for trunk?


Yes, thanks.

> 

> 2021-02-20  Jakub Jelinek  <jakub@redhat.com>

> 

> 	PR libstdc++-v3/97549

> 	* include/pstl/parallel_backend_serial.h: Remove __pstl::__par_backend.

> 

> --- libstdc++-v3/include/pstl/parallel_backend_serial.h.jj	2020-10-21

> 19:33:24.059872401 +0200

> +++ libstdc++-v3/include/pstl/parallel_backend_serial.h	2021-02-19

> 11:59:56.414645219 +0100

> @@ -127,12 +127,4 @@ __parallel_invoke(_ExecutionPolicy&&, _F

>  } // namespace __serial_backend

>  } // namespace __pstl

>  

> -namespace __pstl

> -{

> -namespace __par_backend

> -{

> -using namespace __pstl::__serial;

> -}

> -} // namespace __pstl

> -

>  #endif /* _PSTL_PARALLEL_BACKEND_SERIAL_H */

> 

> 	Jakub

>

Patch

--- libstdc++-v3/include/pstl/parallel_backend_serial.h.jj	2020-10-21 19:33:24.059872401 +0200
+++ libstdc++-v3/include/pstl/parallel_backend_serial.h	2021-02-19 11:59:56.414645219 +0100
@@ -127,12 +127,4 @@  __parallel_invoke(_ExecutionPolicy&&, _F
 } // namespace __serial_backend
 } // namespace __pstl
 
-namespace __pstl
-{
-namespace __par_backend
-{
-using namespace __pstl::__serial;
-}
-} // namespace __pstl
-
 #endif /* _PSTL_PARALLEL_BACKEND_SERIAL_H */