Switch the language standard to C++14 and use std::make_unique [crashpad/crashpad : master]

15 views
Skip to first unread message

Mark Mentovai (Gerrit)

unread,
Oct 12, 2017, 12:05:55 PM10/12/17
to Leonard Mosescu, Commit Bot, crashp...@chromium.org

This change is ready for review.

View Change

2 comments:

  • File build/force_include.gypi:

    • Patch Set #5, Line 20:

      I guess the compiler on macos doesn't support the c++14 option?

      Oh, this is just a test. I’m not going to land it this way (I’d do this in mini_chromium if I had to). I filed https://crbug.com/773941 last night to upgrade the Macs, and it looks like it’s just been done, so I can drop this part.

  • File snapshot/win/process_snapshot_win_test.cc:

    • Patch Set #5, Line 20:

      just curious, how did you find all the extraneous #includes?

      The sed that I used was

      sed -E -e 's%base::WrapUnique\(new ([^(]+)\((.*)\)\);%std::make_unique<\1>(\2);%g' -e 's%base::WrapUnique\(new ([^(]+)\);%std::make_unique<\1>();%g' -e 's%^#include "base/memory/ptr_util.h"$%#include <memory>%'

      It worked surprisingly well, there were only a few WrapUniques that took up more than one line that I needed to address manually. But the #includes were a different story. At the very least, I had to move <memory> from the "local_files" to the <system_files> section. Since I was doing that, I also wanted to make sure that I wasn’t duplicating <memory> in a .cc file when the corresponding .h already had it. And as long as I was doing that, I did a quick manual cleanup of other similar cases.

      It was painful manual work, but only about ten minutes’ worth.

      We could have a tool that did this, but we don’t…

To view, visit change 714658. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: crashpad/crashpad
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id4e0baad8b3652646bede4c3f30f41fcabfdbd4f
Gerrit-Change-Number: 714658
Gerrit-PatchSet: 7
Gerrit-Owner: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Leonard Mosescu <mos...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-CC: Commit Bot <commi...@chromium.org>
Gerrit-Comment-Date: Thu, 12 Oct 2017 16:05:52 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No

Mark Mentovai (Gerrit)

unread,
Oct 12, 2017, 3:07:00 PM10/12/17
to Leonard Mosescu, Commit Bot, crashp...@chromium.org

Patch set 11:Commit-Queue +2

View Change

    To view, visit change 714658. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: master
    Gerrit-MessageType: comment
    Gerrit-Change-Id: Id4e0baad8b3652646bede4c3f30f41fcabfdbd4f
    Gerrit-Change-Number: 714658
    Gerrit-PatchSet: 11
    Gerrit-Owner: Mark Mentovai <ma...@chromium.org>
    Gerrit-Reviewer: Leonard Mosescu <mos...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-CC: Commit Bot <commi...@chromium.org>
    Gerrit-Comment-Date: Thu, 12 Oct 2017 19:06:57 +0000
    Gerrit-HasComments: No
    Gerrit-HasLabels: Yes

    Commit Bot (Gerrit)

    unread,
    Oct 12, 2017, 3:07:16 PM10/12/17
    to Mark Mentovai, Leonard Mosescu, crashp...@chromium.org

    Commit Bot merged this change.

    View Change

    Approvals: Leonard Mosescu: Looks good to me Mark Mentovai: Commit
    Switch the language standard to C++14 and use std::make_unique

    Update mini_chromium to 7d6697ceb5cb5ca02fde3813496f48b9b1d76d0c

    47ff9691450e Switch the language standard to C++14
    7d6697ceb5cb Remove base/memory/ptr_util.h and base::WrapUnique

    base::WrapUnique and std::make_unique are similar, but the latter is
    standardized and preferred.

    Most of the mechanical changes were made with this sed:

    for f in $(git grep -l base::WrapUnique | uniq); do

    sed -E \
    -e 's%base::WrapUnique\(new ([^(]+)\((.*)\)\);%std::make_unique<\1>(\2);%g' \
    -e 's%base::WrapUnique\(new ([^(]+)\);%std::make_unique<\1>();%g' \
          -e 's%^#include "base/memory/ptr_util.h"$%#include <memory>%' \
    -i '' "${f}"
    done

    Several uses of base::WrapUnique that did not fit on a single line and
    were not matched by this sed were adjusted manually. All #include
    changes were audited manually, to at least move <memory> into the
    correct section. Where <memory> was already #included by a file (or its
    corresponding header), the extra #include was removed. Where <memory>
    should have been #included by a header, it was added. Other similar
    adjustments to other #includes were also made.

    Change-Id: Id4e0baad8b3652646bede4c3f30f41fcabfdbd4f
    Reviewed-on: https://chromium-review.googlesource.com/714658
    Commit-Queue: Mark Mentovai <ma...@chromium.org>
    Reviewed-by: Leonard Mosescu <mos...@chromium.org>
    ---
    M DEPS
    M build/gyp_crashpad.py
    M client/crashpad_client_win_test.cc
    M client/prune_crash_reports.cc
    M handler/crashpad_handler_test_extended_handler.cc
    M minidump/minidump_crashpad_info_writer.cc
    M minidump/minidump_crashpad_info_writer_test.cc
    M minidump/minidump_exception_writer_test.cc
    M minidump/minidump_file_writer.cc
    M minidump/minidump_file_writer_test.cc
    M minidump/minidump_handle_writer_test.cc
    M minidump/minidump_memory_info_writer_test.cc
    M minidump/minidump_memory_writer.cc
    M minidump/minidump_memory_writer_test.cc
    M minidump/minidump_misc_info_writer_test.cc
    M minidump/minidump_module_crashpad_info_writer.cc
    M minidump/minidump_module_crashpad_info_writer_test.cc
    M minidump/minidump_module_writer.cc
    M minidump/minidump_module_writer_test.cc
    M minidump/minidump_rva_list_writer_test.cc
    M minidump/minidump_simple_string_dictionary_writer.cc
    M minidump/minidump_simple_string_dictionary_writer_test.cc
    M minidump/minidump_string_writer.cc
    M minidump/minidump_string_writer_test.cc
    M minidump/minidump_system_info_writer_test.cc
    M minidump/minidump_thread_writer.cc
    M minidump/minidump_thread_writer_test.cc
    M minidump/minidump_unloaded_module_writer.cc
    M minidump/minidump_unloaded_module_writer_test.cc
    M minidump/minidump_user_stream_writer.cc
    M minidump/minidump_user_stream_writer.h
    M minidump/minidump_user_stream_writer_test.cc
    M snapshot/mac/process_snapshot_mac.cc
    M snapshot/minidump/process_snapshot_minidump.cc
    M snapshot/win/process_snapshot_win.cc
    M snapshot/win/process_snapshot_win_test.cc
    M test/win/win_multiprocess_with_temp_dir.cc
    M test/win/win_multiprocess_with_temp_dir.h
    38 files changed, 232 insertions(+), 290 deletions(-)


    To view, visit change 714658. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: master
    Gerrit-MessageType: merged
    Gerrit-Change-Id: Id4e0baad8b3652646bede4c3f30f41fcabfdbd4f
    Gerrit-Change-Number: 714658
    Gerrit-PatchSet: 12
    Gerrit-Owner: Mark Mentovai <ma...@chromium.org>
    Gerrit-Reviewer: Commit Bot <commi...@chromium.org>
    Reply all
    Reply to author
    Forward
    0 new messages