Ruby 3.5.0dev (2025-02-20 revision 34098b669c0cbc024cd08e686891f1dfe0a10aaf)
warning_push.h
Go to the documentation of this file.
1#ifndef RBIMPL_WARNING_PUSH_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_WARNING_PUSH_H
47
48#if defined(__DOXYGEN__)
49
55#define RBIMPL_WARNING_PUSH() __pragma(warning(push))
56
62#define RBIMPL_WARNING_POP() __pragma(warning(pop))
63
71#define RBIMPL_WARNING_ERROR(flag) __pragma(warning(error: flag))
72
80#define RBIMPL_WARNING_IGNORED(flag) __pragma(warning(disable: flag))
81
82#elif RBIMPL_COMPILER_SINCE(MSVC, 12, 0, 0)
83# /* Not sure exactly when but it seems VC++ 6.0 is a version with it.*/
84# define RBIMPL_WARNING_PUSH() __pragma(warning(push))
85# define RBIMPL_WARNING_POP() __pragma(warning(pop))
86# define RBIMPL_WARNING_ERROR(flag) __pragma(warning(error: flag))
87# define RBIMPL_WARNING_IGNORED(flag) __pragma(warning(disable: flag))
88
89#elif RBIMPL_COMPILER_SINCE(Intel, 13, 0, 0)
90# define RBIMPL_WARNING_PUSH() __pragma(warning(push))
91# define RBIMPL_WARNING_POP() __pragma(warning(pop))
92# define RBIMPL_WARNING_ERROR(flag) __pragma(warning(error: flag))
93# define RBIMPL_WARNING_IGNORED(flag) __pragma(warning(disable: flag))
94
95#elif RBIMPL_COMPILER_IS(Clang) || RBIMPL_COMPILER_IS(Apple)
96# /* Not sure exactly when but it seems LLVM 2.6.0 is a version with it. */
97# define RBIMPL_WARNING_PRAGMA0(x) _Pragma(# x)
98# define RBIMPL_WARNING_PRAGMA1(x) RBIMPL_WARNING_PRAGMA0(clang diagnostic x)
99# define RBIMPL_WARNING_PRAGMA2(x, y) RBIMPL_WARNING_PRAGMA1(x # y)
100# define RBIMPL_WARNING_PUSH() RBIMPL_WARNING_PRAGMA1(push)
101# define RBIMPL_WARNING_POP() RBIMPL_WARNING_PRAGMA1(pop)
102# define RBIMPL_WARNING_ERROR(flag) RBIMPL_WARNING_PRAGMA2(error, flag)
103# define RBIMPL_WARNING_IGNORED(flag) RBIMPL_WARNING_PRAGMA2(ignored, flag)
104
105#elif RBIMPL_COMPILER_SINCE(GCC, 4, 6, 0)
106# /* https://gcc.gnu.org/onlinedocs/gcc-4.6.0/gcc/Diagnostic-Pragmas.html */
107# define RBIMPL_WARNING_PRAGMA0(x) _Pragma(# x)
108# define RBIMPL_WARNING_PRAGMA1(x) RBIMPL_WARNING_PRAGMA0(GCC diagnostic x)
109# define RBIMPL_WARNING_PRAGMA2(x, y) RBIMPL_WARNING_PRAGMA1(x # y)
110# define RBIMPL_WARNING_PUSH() RBIMPL_WARNING_PRAGMA1(push)
111# define RBIMPL_WARNING_POP() RBIMPL_WARNING_PRAGMA1(pop)
112# define RBIMPL_WARNING_ERROR(flag) RBIMPL_WARNING_PRAGMA2(error, flag)
113# define RBIMPL_WARNING_IGNORED(flag) RBIMPL_WARNING_PRAGMA2(ignored, flag)
114
115#else
116# /* :FIXME: improve here */
117# define RBIMPL_WARNING_PUSH() /* void */
118# define RBIMPL_WARNING_POP() /* void */
119# define RBIMPL_WARNING_ERROR(flag) /* void */
120# define RBIMPL_WARNING_IGNORED(flag) /* void */
121#endif /* _MSC_VER */
124#endif /* RBIMPL_WARNING_PUSH_H */
Defines RBIMPL_COMPILER_IS.
Defines RBIMPL_COMPILER_SINCE.