mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Migrate ignore_result to std::ignore (see issue #3234)
See https://crbug.com/1285085 for background.
This commit is contained in:
@ -156,7 +156,7 @@
|
||||
// Annotate a function indicating the caller must examine the return value.
|
||||
// Use like:
|
||||
// int foo() WARN_UNUSED_RESULT;
|
||||
// To explicitly ignore a result, see |ignore_result()| in base/macros.h.
|
||||
// To explicitly ignore a result, use std::ignore from <tuple>.
|
||||
#undef WARN_UNUSED_RESULT
|
||||
#if defined(COMPILER_GCC) || defined(__clang__)
|
||||
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
|
@ -32,11 +32,7 @@
|
||||
#define CEF_INCLUDE_BASE_CEF_MACROS_H_
|
||||
#pragma once
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
// When building CEF include the Chromium header directly.
|
||||
#include "base/ignore_result.h"
|
||||
|
||||
#else // !USING_CHROMIUM_INCLUDES
|
||||
#if !defined(USING_CHROMIUM_INCLUDES)
|
||||
// The following is substantially similar to the Chromium implementation.
|
||||
// If the Chromium implementation diverges the below implementation should be
|
||||
// updated to match.
|
||||
@ -62,17 +58,6 @@
|
||||
TypeName() = delete; \
|
||||
DISALLOW_COPY_AND_ASSIGN(TypeName)
|
||||
|
||||
// Used to explicitly mark the return value of a function as unused. If you are
|
||||
// really sure you don't want to do anything with the return value of a function
|
||||
// that has been marked WARN_UNUSED_RESULT, wrap it with this. Example:
|
||||
//
|
||||
// std::unique_ptr<MyType> my_var = ...;
|
||||
// if (TakeOwnership(my_var.get()) == SUCCESS)
|
||||
// ignore_result(my_var.release());
|
||||
//
|
||||
template <typename T>
|
||||
inline void ignore_result(const T&) {}
|
||||
|
||||
#endif // !USING_CHROMIUM_INCLUDES
|
||||
|
||||
#endif // CEF_INCLUDE_BASE_CEF_MACROS_H_
|
||||
|
Reference in New Issue
Block a user