Skip to content

Commit

Permalink
[base] Minor C++17 Fixes
Browse files Browse the repository at this point in the history
This change performs minor fixes for compilation errors with -std=c++17.
They include fully specifying as_const within base::circular_deque, as
well as consistent application of the noexcept keyword across declaration
and definition of functions.

TBR=dcheng

Bug: 752720
Change-Id: I3f42d53eefea265c7b16579a12bd4cf29dad6e51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2199111
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#768405}
  • Loading branch information
jdoerrie authored and Commit Bot committed May 13, 2020
1 parent 98f0880 commit cd69f2e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions base/containers/circular_deque.h
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,11 @@ class circular_deque {
return buffer_[i - right_size];
}
value_type& at(size_type i) {
return const_cast<value_type&>(as_const(*this).at(i));
return const_cast<value_type&>(base::as_const(*this).at(i));
}

value_type& operator[](size_type i) {
return const_cast<value_type&>(as_const(*this)[i]);
return const_cast<value_type&>(base::as_const(*this)[i]);
}

const value_type& operator[](size_type i) const { return at(i); }
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/web_applications/web_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ WebApp::WebAppShortcutMenuItemInfo::WebAppShortcutMenuItemInfo(
const WebAppShortcutMenuItemInfo& other) = default;

WebApp::WebAppShortcutMenuItemInfo::WebAppShortcutMenuItemInfo(
WebAppShortcutMenuItemInfo&&) = default;
WebAppShortcutMenuItemInfo&&) noexcept = default;

WebApp::WebAppShortcutMenuItemInfo::~WebAppShortcutMenuItemInfo() = default;

Expand All @@ -203,8 +203,8 @@ WebApp::WebAppShortcutMenuItemInfo::operator=(
const WebAppShortcutMenuItemInfo&) = default;

WebApp::WebAppShortcutMenuItemInfo&
WebApp::WebAppShortcutMenuItemInfo::operator=(WebAppShortcutMenuItemInfo&&) =
default;
WebApp::WebAppShortcutMenuItemInfo::operator=(
WebAppShortcutMenuItemInfo&&) noexcept = default;

void WebApp::SetSyncData(SyncData sync_data) {
sync_data_ = std::move(sync_data);
Expand Down
4 changes: 2 additions & 2 deletions chrome/common/web_application_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ WebApplicationShortcutInfo::WebApplicationShortcutInfo(
const WebApplicationShortcutInfo& other) = default;

WebApplicationShortcutInfo::WebApplicationShortcutInfo(
WebApplicationShortcutInfo&&) = default;
WebApplicationShortcutInfo&&) noexcept = default;

WebApplicationShortcutInfo::~WebApplicationShortcutInfo() = default;

WebApplicationShortcutInfo& WebApplicationShortcutInfo::operator=(
const WebApplicationShortcutInfo&) = default;

WebApplicationShortcutInfo& WebApplicationShortcutInfo::operator=(
WebApplicationShortcutInfo&&) = default;
WebApplicationShortcutInfo&&) noexcept = default;

WebApplicationInfo::WebApplicationInfo()
: mobile_capable(MOBILE_CAPABLE_UNSPECIFIED),
Expand Down
4 changes: 2 additions & 2 deletions components/paint_preview/browser/paint_preview_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ PaintPreviewClient::PaintPreviewData::PaintPreviewData() = default;
PaintPreviewClient::PaintPreviewData::~PaintPreviewData() = default;

PaintPreviewClient::PaintPreviewData&
PaintPreviewClient::PaintPreviewData::operator=(PaintPreviewData&& rhs) =
default;
PaintPreviewClient::PaintPreviewData::operator=(
PaintPreviewData&& rhs) noexcept = default;

PaintPreviewClient::PaintPreviewData::PaintPreviewData(
PaintPreviewData&& other) noexcept = default;
Expand Down
4 changes: 2 additions & 2 deletions components/query_tiles/tile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Tile::Tile(const Tile& other) {

Tile::Tile() = default;

Tile::Tile(Tile&& other) = default;
Tile::Tile(Tile&& other) noexcept = default;

Tile::~Tile() = default;

Expand All @@ -66,6 +66,6 @@ Tile& Tile::operator=(const Tile& other) {
return *this;
}

Tile& Tile::operator=(Tile&& other) = default;
Tile& Tile::operator=(Tile&& other) noexcept = default;

} // namespace upboarding
7 changes: 4 additions & 3 deletions pdf/pdfium/pdfium_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,11 @@ PDFiumPage* PDFiumTestBase::GetPDFiumPageForTest(PDFiumEngine* engine,
PDFiumTestBase::InitializeEngineResult::InitializeEngineResult() = default;

PDFiumTestBase::InitializeEngineResult::InitializeEngineResult(
InitializeEngineResult&& other) = default;
InitializeEngineResult&& other) noexcept = default;

PDFiumTestBase::InitializeEngineResult& PDFiumTestBase::InitializeEngineResult::
operator=(InitializeEngineResult&& other) = default;
PDFiumTestBase::InitializeEngineResult&
PDFiumTestBase::InitializeEngineResult::operator=(
InitializeEngineResult&& other) noexcept = default;

PDFiumTestBase::InitializeEngineResult::~InitializeEngineResult() = default;

Expand Down
3 changes: 1 addition & 2 deletions services/network/network_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1624,8 +1624,7 @@ void NetworkContext::LookupServerBasicAuthCredentials(
std::move(callback).Run(base::nullopt);
}

const net::HttpAuthPreferences* NetworkContext::GetHttpAuthPreferences() const
noexcept {
const net::HttpAuthPreferences* NetworkContext::GetHttpAuthPreferences() const {
return &http_auth_merged_preferences_;
}

Expand Down

0 comments on commit cd69f2e

Please sign in to comment.