Bug 1324093 - Part 3.5: Add MOZ_MAYBE_UNUSED to mfbt/Attributes.h. r=froydnj

MozReview-Commit-ID: KXIaGGJnds3

--HG--
extra : rebase_source : 79738bfb55e562610f2c8501015a7c3fb80bdf9d
This commit is contained in:
David Major 2017-01-13 13:58:23 +13:00
parent 1b90484989
commit 62cf344c27

View File

@ -274,6 +274,27 @@
# define MOZ_MUST_USE
#endif
/**
* MOZ_MAYBE_UNUSED suppresses compiler warnings about functions that are
* never called (in this build configuration, at least).
*
* Place this attribute at the very beginning of a function declaration. For
* example, write
*
* MOZ_MAYBE_UNUSED int foo();
*
* or
*
* MOZ_MAYBE_UNUSED int foo() { return 42; }
*/
#if defined(__GNUC__) || defined(__clang__)
# define MOZ_MAYBE_UNUSED __attribute__ ((__unused__))
#elif defined(_MSC_VER)
# define MOZ_MAYBE_UNUSED __pragma(warning(suppress:4505))
#else
# define MOZ_MAYBE_UNUSED
#endif
/**
* MOZ_FALLTHROUGH is an annotation to suppress compiler warnings about switch
* cases that fall through without a break or return statement. MOZ_FALLTHROUGH