| 1 |
#ifndef RUBY_BACKWARD2_LONG_LONG_H /*-*-C++-*-vi:se ft=cpp:*/ |
| 2 |
#define RUBY_BACKWARD2_LONG_LONG_H |
| 3 |
/** |
| 4 |
* @file |
| 5 |
* @author Ruby developers <[email protected]> |
| 6 |
* @copyright This file is a part of the programming language Ruby. |
| 7 |
* Permission is hereby granted, to either redistribute and/or |
| 8 |
* modify this file, provided that the conditions mentioned in the |
| 9 |
* file COPYING are met. Consult the file for details. |
| 10 |
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are |
| 11 |
* implementation details. Don't take them as canon. They could |
| 12 |
* rapidly appear then vanish. The name (path) of this header file |
| 13 |
* is also an implementation detail. Do not expect it to persist |
| 14 |
* at the place it is now. Developers are free to move it anywhere |
| 15 |
* anytime at will. |
| 16 |
* @note To ruby-core: remember that this header can be possibly |
| 17 |
* recursively included from extension libraries written in C++. |
| 18 |
* Do not expect for instance `__VA_ARGS__` is always available. |
| 19 |
* We assume C99 for ruby itself but we don't assume languages of |
| 20 |
* extension libraries. They could be written in C++98. |
| 21 |
* @brief Defines old #LONG_LONG |
| 22 |
* |
| 23 |
* No known compiler that can compile today's ruby lacks long long. |
| 24 |
* Historically MSVC was one of such compiler, but it implemented long long a |
| 25 |
* while ago (some time back in 2013). The macros are for backwards |
| 26 |
* compatibility only. |
| 27 |
*/ |
| 28 |
#include "ruby/internal/config.h" |
| 29 |
#include "ruby/internal/has/warning.h" |
| 30 |
#include "ruby/internal/warning_push.h" |
| 31 |
|
| 32 |
#if defined(__DOXYGEN__) |
| 33 |
# /** @cond INTERNAL_MACRO */ |
| 34 |
# define HAVE_LONG_LONG 1 |
| 35 |
# define HAVE_TRUE_LONG_LONG 1 |
| 36 |
# /** @endcond */ |
| 37 |
# /** @deprecated Just use `long long` directly. */ |
| 38 |
# define LONG_LONG long long. |
| 39 |
|
| 40 |
#elif RBIMPL_HAS_WARNING("-Wc++11-long-long") |
| 41 |
# define HAVE_TRUE_LONG_LONG 1 |
| 42 |
# define LONG_LONG \ |
| 43 |
RBIMPL_WARNING_PUSH() \ |
| 44 |
RBIMPL_WARNING_IGNORED(-Wc++11-long-long) \ |
| 45 |
long long \ |
| 46 |
RBIMPL_WARNING_POP() |
| 47 |
|
| 48 |
#elif RBIMPL_HAS_WARNING("-Wlong-long") |
| 49 |
# define HAVE_TRUE_LONG_LONG 1 |
| 50 |
# define LONG_LONG \ |
| 51 |
RBIMPL_WARNING_PUSH() \ |
| 52 |
RBIMPL_WARNING_IGNORED(-Wlong-long) \ |
| 53 |
long long \ |
| 54 |
RBIMPL_WARNING_POP() |
| 55 |
|
| 56 |
#elif defined(HAVE_LONG_LONG) |
| 57 |
# define HAVE_TRUE_LONG_LONG 1 |
| 58 |
# define LONG_LONG long long |
| 59 |
|
| 60 |
#elif SIZEOF___INT64 > 0 |
| 61 |
# define HAVE_LONG_LONG 1 |
| 62 |
# define LONG_LONG __int64 |
| 63 |
# undef SIZEOF_LONG_LONG |
| 64 |
# define SIZEOF_LONG_LONG SIZEOF___INT64 |
| 65 |
|
| 66 |
#else |
| 67 |
# error Hello! Ruby developers believe this message must not happen. |
| 68 |
# error If you encounter this message, can you file a bug report? |
| 69 |
# error Remember to attach a detailed description of your environment. |
| 70 |
# error Thank you! |
| 71 |
#endif |
| 72 |
|
| 73 |
#endif /* RBIMPL_BACKWARD2_LONG_LONG_H */ |