mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1664100 - Replace MOZ_MUST_USE with [[nodiscard]] in caps. r=ckerschb
The MOZ_MUST_USE macro is defined as clang's and gcc's nonstandard __attribute__((warn_unused_result)). Now that we compile as C++17 by default (bug 1560664), we can replace MOZ_MUST_USE with C++17's standard [[nodiscard]] attribute. The [[nodiscard]] attribute must precede a function declaration's declaration specifiers (like static, extern, inline, or virtual). The __attribute__((warn_unused_result)) attribute does not have this order restriction. Differential Revision: https://phabricator.services.mozilla.com/D89697
This commit is contained in:
parent
598ffecbd5
commit
118723ea09
@ -75,7 +75,7 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
|
||||
return !(*this == aOther);
|
||||
}
|
||||
|
||||
MOZ_MUST_USE bool EqualsIgnoringFPD(const OriginAttributes& aOther) const {
|
||||
[[nodiscard]] bool EqualsIgnoringFPD(const OriginAttributes& aOther) const {
|
||||
return mInIsolatedMozBrowser == aOther.mInIsolatedMozBrowser &&
|
||||
mUserContextId == aOther.mUserContextId &&
|
||||
mPrivateBrowsingId == aOther.mPrivateBrowsingId &&
|
||||
@ -90,12 +90,12 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
|
||||
// Don't use this method for anything else than debugging!
|
||||
void CreateAnonymizedSuffix(nsACString& aStr) const;
|
||||
|
||||
MOZ_MUST_USE bool PopulateFromSuffix(const nsACString& aStr);
|
||||
[[nodiscard]] bool PopulateFromSuffix(const nsACString& aStr);
|
||||
|
||||
// Populates the attributes from a string like
|
||||
// |uri!key1=value1&key2=value2| and returns the uri without the suffix.
|
||||
MOZ_MUST_USE bool PopulateFromOrigin(const nsACString& aOrigin,
|
||||
nsACString& aOriginNoSuffix);
|
||||
[[nodiscard]] bool PopulateFromOrigin(const nsACString& aOrigin,
|
||||
nsACString& aOriginNoSuffix);
|
||||
|
||||
// Helper function to match mIsPrivateBrowsing to existing private browsing
|
||||
// flags. Once all other flags are removed, this can be removed too.
|
||||
@ -125,7 +125,7 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
|
||||
|
||||
// Check whether we block the postMessage across different FPDs when the
|
||||
// targetOrigin is '*'.
|
||||
static inline MOZ_MUST_USE bool IsBlockPostMessageForFPI() {
|
||||
[[nodiscard]] static inline bool IsBlockPostMessageForFPI() {
|
||||
return StaticPrefs::privacy_firstparty_isolate() &&
|
||||
StaticPrefs::privacy_firstparty_isolate_block_post_message();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user