2014-06-30 19:39:45 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-04-27 09:43:00 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_unused_h
|
|
|
|
#define mozilla_unused_h
|
|
|
|
|
2017-06-21 12:47:11 +03:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-08-29 12:11:00 +04:00
|
|
|
#include "mozilla/Types.h"
|
2010-04-27 09:43:00 +04:00
|
|
|
|
2015-09-10 03:01:28 +03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2010-04-27 09:43:00 +04:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
//
|
|
|
|
// Suppress GCC warnings about unused return values with
|
2015-11-02 08:53:26 +03:00
|
|
|
// Unused << SomeFuncDeclaredWarnUnusedReturnValue();
|
2010-04-27 09:43:00 +04:00
|
|
|
//
|
2014-08-28 02:47:27 +04:00
|
|
|
struct unused_t {
|
2015-09-10 14:17:00 +03:00
|
|
|
template <typename T>
|
|
|
|
MOZ_ALWAYS_INLINE_EVEN_DEBUG void operator<<(const T& /*unused*/) const {}
|
2014-06-27 05:35:39 +04:00
|
|
|
};
|
2010-04-27 09:43:00 +04:00
|
|
|
|
2015-11-02 08:53:26 +03:00
|
|
|
extern MFBT_DATA const unused_t Unused;
|
2010-04-27 09:43:00 +04:00
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2010-04-27 09:43:00 +04:00
|
|
|
|
2015-09-10 03:01:28 +03:00
|
|
|
#endif // __cplusplus
|
|
|
|
|
2015-11-02 08:53:26 +03:00
|
|
|
// An alternative to mozilla::Unused for use in (a) C code and (b) code where
|
2015-09-10 03:01:28 +03:00
|
|
|
// linking with unused.o is difficult.
|
|
|
|
#define MOZ_UNUSED(expr) \
|
|
|
|
do { \
|
|
|
|
if (expr) { \
|
|
|
|
(void)0; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
2010-04-27 09:43:00 +04:00
|
|
|
#endif // mozilla_unused_h
|