CBMC
nodiscard.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Util
4 
5 Author: Diffblue Ltd.
6 
7 \*******************************************************************/
8 
9 #ifndef CPROVER_UTIL_NODISCARD_H
10 #define CPROVER_UTIL_NODISCARD_H
11 
12 #if __has_cpp_attribute(nodiscard)
13 # ifdef __clang__
14 # pragma GCC diagnostic ignored "-Wc++1z-extensions"
15 # endif
16 // NOLINTNEXTLINE(whitespace/braces)
17 # define NODISCARD [[nodiscard]]
18 #elif __has_cpp_attribute(gnu::warn_unused_result)
19 // NOLINTNEXTLINE(whitespace/braces)
20 # define NODISCARD [[gnu::warn_unused_result]]
21 #else
22 # define NODISCARD
23 #endif
24 
25 #endif // CPROVER_UTIL_NODISCARD_H