This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386]: Use std::swap
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Marc Glisse <marc dot glisse at inria dot fr>
- Date: Tue, 11 Nov 2014 11:46:55 +0100
- Subject: Re: [PATCH, i386]: Use std::swap
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4Z1gspEpeVbAsbR6K1NaR+Bg9VfLpAA8png+=xyLoCOqw at mail dot gmail dot com> <4E8B61D5-FBFE-4BC8-A252-9B1580E1E8DE at gmail dot com> <alpine dot DEB dot 2 dot 11 dot 1411102250210 dot 8347 at laptop-mg dot saclay dot inria dot fr> <CAFULd4YMgeks5+PtpOkuacvMUftk-WvWyPD0L5-R=+g4ZtHYJw at mail dot gmail dot com> <CAFULd4baLHKGQ2KKmt7uA8zAdqN4gWV-GHbh_-Quj3kp__v6NA at mail dot gmail dot com>
On Tue, Nov 11, 2014 at 10:41 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Tue, Nov 11, 2014 at 9:09 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> On Mon, Nov 10, 2014 at 10:51 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
>>> On Mon, 10 Nov 2014, Richard Biener wrote:
>>>
>>>> No extra includes required?
>>>
>>>
>>> <utility> is already included in wide-int.h and rtl.h, should probably move
>>> those.
>>
>> Bah, we hit a problem. std::swap has been moved from <algorithm> to
>> <utility> in C++11, and the patch breaks build on CentOS 5.11
>> (gcc-4.1.2).
>>
>> Short of reverting the i386.c patch, is there a quick solution by
>> including some additional headers?
>
> Attached patch that implements both suggestions from Richi and Marc
> fixes the bootstrap.
>
> 2014-11-11 Uros Bizjak <ubizjak@gmail.com>
>
> * system.h: Include algorithm and utility.
> * rtl.h: Do not include utility here.
> * wide-int.h: Ditto.
> * tree-vect-data-refs.c (swap): Remove template.
> (vect_prune_runtime_alias_test_list): Use std::swap instead of swap.
>
> Bootstrapped on x86_64-linux-gnu (CentOS 5.11).
>
> OK for mainline?
>
> BTW: There are lots of places where std::swap can be used, a nice
> search-and-replace task for someone to start with gcc development. ;)
Agreed ;) Note that we have to be careful to avoid pulling all of libstdc++
into all files via system.h (system.h is so a bad thing... :/).
Ok.
Thanks,
Richard.
> Uros.