Skip to content

Commit

Permalink
Convert remaining WARN_UNUSED_RESULT to [[nodiscard] in //chrome.
Browse files Browse the repository at this point in the history
Bug: 1287045
Change-Id: Idec667fafec3ab721311c101c8f1e0b72e5621cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3401761
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#961630}
  • Loading branch information
zetafunction authored and Chromium LUCI CQ committed Jan 20, 2022
1 parent 41914d0 commit 5a28972
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ class FindInPageInteractiveTest : public InProcessBrowserTest {

} // namespace

// Specifying a prototype so that we can add the WARN_UNUSED_RESULT attribute.
[[nodiscard]] bool FocusedOnPage(WebContents* web_contents,
std::string* result);

bool FocusedOnPage(WebContents* web_contents, std::string* result) {
std::string* result) {
return content::ExecuteScriptAndExtractString(
web_contents,
"window.domAutomationController.send(getFocusedElement());",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class WebAppControllerBrowserTest : public InProcessBrowserTest {

// Simulates a page navigating itself to an URL and waits for the
// navigation.
WARN_UNUSED_RESULT bool NavigateInRenderer(content::WebContents* contents,
const GURL& url);
[[nodiscard]] bool NavigateInRenderer(content::WebContents* contents,
const GURL& url);

// Returns whether the installable check passed.
static bool NavigateAndAwaitInstallabilityCheck(Browser* browser,
Expand Down
11 changes: 1 addition & 10 deletions chrome/utility/importer/ie_importer_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,11 @@ struct IEOrderBookmarkComparator {
// };
// where each item_id should correspond to a favorites link file (*.url) in
// the current folder.
// gcc, in its infinite wisdom, only allows WARN_UNUSED_RESULT for prototypes.
// Clang, to be compatible with gcc, warns if WARN_UNUSED_RESULT is used in a
// non-gcc compatible manner (-Wgcc-compat). So even though gcc isn't used to
// build on Windows, declare some prototypes anyway to satisfy Clang's gcc
// compatibility warnings.
[[nodiscard]] bool ParseFavoritesOrderBlob(
const Importer* importer,
const std::vector<uint8_t>& blob,
const base::FilePath& path,
std::map<base::FilePath, uint32_t>* sort_index);
bool ParseFavoritesOrderBlob(const Importer* importer,
const std::vector<uint8_t>& blob,
const base::FilePath& path,
std::map<base::FilePath, uint32_t>* sort_index) {
std::map<base::FilePath, uint32_t>* sort_index) {
static const int kItemCountOffset = 16;
static const int kItemListStartOffset = 20;

Expand Down

0 comments on commit 5a28972

Please sign in to comment.