mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Replace macros with C++17 features (see issue #3362)
- Convert ALLOW_UNUSED_LOCAL to [[maybe_unused]] - Convert WARN_UNUSED_RESULT to [[nodiscard]]
This commit is contained in:
@ -386,26 +386,4 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) {
|
||||
#endif
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
// Annotate a function indicating the caller must examine the return value.
|
||||
// Use like:
|
||||
// int foo() WARN_UNUSED_RESULT;
|
||||
// To explicitly ignore a result, use std::ignore from <tuple>.
|
||||
// Alternately use `[[nodiscard]]` with code that supports C++17.
|
||||
#undef WARN_UNUSED_RESULT
|
||||
#if defined(COMPILER_GCC) || defined(__clang__)
|
||||
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
#define WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
||||
// Annotate a variable indicating it's ok if the variable is not used.
|
||||
// (Typically used to silence a compiler warning when the assignment
|
||||
// is important for some other reason.)
|
||||
// Use like:
|
||||
// int x = ...;
|
||||
// ALLOW_UNUSED_LOCAL(x);
|
||||
// Alternately use `[[maybe_unused]]` with code that supports C++17.
|
||||
#define ALLOW_UNUSED_LOCAL(x) (void)x
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_COMPILER_SPECIFIC_H_
|
||||
|
Reference in New Issue
Block a user