Ruby: include/ruby/internal/attr/nodiscard.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

nodiscard.h
Go to the documentation of this file.
1#ifndef RBIMPL_ATTR_NODISCARD_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_ATTR_NODISCARD_H
23#include "ruby/internal/has/attribute.h"
24#include "ruby/internal/has/c_attribute.h"
25#include "ruby/internal/has/cpp_attribute.h"
26
32#if RBIMPL_HAS_CPP_ATTRIBUTE(nodiscard)
33# define RBIMPL_ATTR_NODISCARD() [[nodiscard]]
34#elif RBIMPL_HAS_C_ATTRIBUTE(nodiscard)
35# define RBIMPL_ATTR_NODISCARD() [[nodiscard]]
36#elif RBIMPL_HAS_ATTRIBUTE(warn_unused_result)
37# define RBIMPL_ATTR_NODISCARD() __attribute__((__warn_unused_result__))
38#elif defined(_Check_return_)
39# /* Take SAL definition. */
40# define RBIMPL_ATTR_NODISCARD() _Check_return_
41#else
42# define RBIMPL_ATTR_NODISCARD() /* void */
43#endif
44
45#endif /* RBIMPL_ATTR_NODISCARD_H */
attribute.h
Defines RBIMPL_HAS_ATTRIBUTE.
c_attribute.h
Defines RBIMPL_HAS_C_ATTRIBUTE.
cpp_attribute.h
Defines RBIMPL_HAS_CPP_ATTRIBUTE.