Skip to content

Commit

Permalink
Bug 1571631 - Remove MOZ_MUST_USE definition. r=sg
Browse files Browse the repository at this point in the history
Depends on D108345

Differential Revision: https://phabricator.services.mozilla.com/D108346
  • Loading branch information
cpeterso committed Mar 17, 2021
1 parent 7bc752e commit 7cba58e
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions mfbt/Attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,43 +360,6 @@
# define MOZ_INFALLIBLE_ALLOCATOR
#endif

/**
* MOZ_MUST_USE tells the compiler to emit a warning if a function's
* return value is not used by the caller.
*
* Place this attribute at the very beginning of a function declaration. For
* example, write
*
* MOZ_MUST_USE int foo();
* or
* MOZ_MUST_USE int foo() { return 42; }
*
* MOZ_MUST_USE is most appropriate for functions where the return value is
* some kind of success/failure indicator -- often |nsresult|, |bool| or |int|
* -- because these functions are most commonly the ones that have missing
* checks. There are three cases of note.
*
* - Fallible functions whose return values should always be checked. For
* example, a function that opens a file should always be checked because any
* subsequent operations on the file will fail if opening it fails. Such
* functions should be given a MOZ_MUST_USE annotation.
*
* - Fallible functions whose return value need not always be checked. For
* example, a function that closes a file might not be checked because it's
* common that no further operations would be performed on the file. Such
* functions do not need a MOZ_MUST_USE annotation.
*
* - Infallible functions, i.e. ones that always return a value indicating
* success. These do not need a MOZ_MUST_USE annotation. Ideally, they would
* be converted to not return a success/failure indicator, though sometimes
* interface constraints prevent this.
*/
#if defined(__GNUC__) || defined(__clang__)
# define MOZ_MUST_USE __attribute__((warn_unused_result))
#else
# define MOZ_MUST_USE
#endif

/**
* MOZ_MAYBE_UNUSED suppresses compiler warnings about functions that are
* never called (in this build configuration, at least).
Expand Down

0 comments on commit 7cba58e

Please sign in to comment.