Ruby: include/ruby/internal/token_paste.h Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

token_paste.h
Go to the documentation of this file.
1#ifndef RBIMPL_TOKEN_PASTE_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_TOKEN_PASTE_H
23#include "ruby/internal/config.h"
24#include "ruby/internal/compiler_since.h"
25#include "ruby/internal/has/warning.h"
26#include "ruby/internal/warning_push.h"
27
28/* :TODO: add your compiler here. There are many compilers that can suppress
29 * warnings via pragmas, but not all of them accept such things inside of `#if`
30 * and variants' conditions. And such nitpicking behavours tend not be
31 * documented. Please improve this file when you are really sure about your
32 * compiler's behaviour. */
33
34#if RBIMPL_COMPILER_SINCE(GCC, 4, 2, 0)
35# /* GCC is one of such compiler who cannot write `_Pragma` inside of a `#if`.
36# * Cannot but globally kill everything. This is of course a very bad thing.
37# * If you know how to reroute this please tell us. */
38# /* https://gcc.godbolt.org/z/K2xr7X */
39# define RBIMPL_TOKEN_PASTE(x, y) TOKEN_PASTE(x, y)
40# pragma GCC diagnostic ignored "-Wundef"
41# /* > warning: "symbol" is not defined, evaluates to 0 [-Wundef] */
42
43#elif RBIMPL_COMPILER_IS(Intel)
44# /* Ditto for icc. */
45# /* https://gcc.godbolt.org/z/pTwDxE */
46# define RBIMPL_TOKEN_PASTE(x, y) TOKEN_PASTE(x, y)
47# pragma warning(disable: 193)
48# /* > warning #193: zero used for undefined preprocessing identifier */
49
50#elif RBIMPL_COMPILER_BEFORE(MSVC, 19, 14, 26428)
51# /* :FIXME: is 19.14 the exact version they supported this? */
52# define RBIMPL_TOKEN_PASTE(x, y) TOKEN_PASTE(x, y)
53# pragma warning(disable: 4668)
54# /* > warning C4668: 'symbol' is not defined as a preprocessor macro */
55
56#elif RBIMPL_COMPILER_IS(MSVC)
57# define RBIMPL_TOKEN_PASTE(x, y) \
58 RBIMPL_WARNING_PUSH() \
59 RBIMPL_WARNING_IGNORED(4668) \
60 TOKEN_PASTE(x, y) \
61 RBIMPL_WARNING_POP()
62
63#elif RBIMPL_HAS_WARNING("-Wundef")
64# define RBIMPL_TOKEN_PASTE(x, y) \
65 RBIMPL_WARNING_PUSH() \
66 RBIMPL_WARNING_IGNORED(-Wundef) \
67 TOKEN_PASTE(x, y) \
68 RBIMPL_WARNING_POP()
69
70#else
71# /* No way. */
72# define RBIMPL_TOKEN_PASTE(x, y) TOKEN_PASTE(x, y)
73#endif
74
75#endif /* RBIMPL_TOKEN_PASTE_H */
compiler_since.h
Defines RBIMPL_COMPILER_SINCE.
warning.h
Defines RBIMPL_HAS_WARNING.
config.h
Thin wrapper to ruby/config.h.
warning_push.h
Defines RBIMPL_WARNING_PUSH.