Ruby 3.5.0dev (2025-01-10 revision 5fab31b15e32622c4b71d1d347a41937e9f9c212)
cast.h
1#ifndef RBIMPL_CAST_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_CAST_H
29
30#if ! defined(__cplusplus)
31# define RBIMPL_CAST(expr) (expr)
32
33#elif RBIMPL_COMPILER_SINCE(GCC, 4, 6, 0)
34# /* g++ has -Wold-style-cast since 1997 or so, but its _Pragma is broken. */
35# /* See https://gcc.godbolt.org/z/XWhU6J */
36# define RBIMPL_CAST(expr) (expr)
37# pragma GCC diagnostic ignored "-Wold-style-cast"
38
39#elif RBIMPL_HAS_WARNING("-Wold-style-cast")
40# define RBIMPL_CAST(expr) \
41 RBIMPL_WARNING_PUSH() \
42 RBIMPL_WARNING_IGNORED(-Wold-style-cast) \
43 (expr) \
44 RBIMPL_WARNING_POP()
45
46#else
47# define RBIMPL_CAST(expr) (expr)
48#endif
49
50#endif /* RBIMPL_CAST_H */
Defines RBIMPL_COMPILER_SINCE.
Defines RBIMPL_HAS_WARNING.
Defines RBIMPL_WARNING_PUSH.