Merge pull request #2991 from shyouhei/ruby.h
[ruby.git] / include / ruby / 3 / compiler_is / gcc.h
blob6b0a5f62cff6a1937fa17bcfffe754bb0a52f261
1 /** \noop-*-C++-*-vi:ft=cpp
2 * @file
3 * @author Ruby developers <ruby-core@ruby-lang.org>
4 * @copyright This file is a part of the programming language Ruby.
5 * Permission is hereby granted, to either redistribute and/or
6 * modify this file, provided that the conditions mentioned in the
7 * file COPYING are met. Consult the file for details.
8 * @warning Symbols prefixed with either `RUBY3` or `ruby3` are
9 * implementation details. Don't take them as canon. They could
10 * rapidly appear then vanish. The name (path) of this header file
11 * is also an implementation detail. Do not expect it to persist
12 * at the place it is now. Developers are free to move it anywhere
13 * anytime at will.
14 * @note To ruby-core: remember that this header can be possibly
15 * recursively included from extension libraries written in C++.
16 * Do not expect for instance `__VA_ARGS__` is always available.
17 * We assume C99 for ruby itself but we don't assume languages of
18 * extension libraries. They could be written in C++98.
19 * @brief Defines #RUBY3_COMPILER_IS_GCC.
21 #include "ruby/3/compiler_is/apple.h"
22 #include "ruby/3/compiler_is/clang.h"
23 #include "ruby/3/compiler_is/intel.h"
25 #if defined(RUBY3_COMPILER_IS_GCC)
26 # /* Take that. */
28 #elif ! defined(__GNUC__)
29 # define RUBY3_COMPILER_IS_GCC 0
31 #elif RUBY3_COMPILER_IS(Apple)
32 # define RUBY3_COMPILER_IS_GCC 0
34 #elif RUBY3_COMPILER_IS(Clang)
35 # define RUBY3_COMPILER_IS_GCC 0
37 #elif RUBY3_COMPILER_IS(Intel)
38 # define RUBY3_COMPILER_IS_GCC 0
40 #else
41 # define RUBY3_COMPILER_IS_GCC 1
42 # define RUBY3_COMPILER_VERSION_MAJOR __GNUC__
43 # define RUBY3_COMPILER_VERSION_MINOR __GNUC_MINOR__
44 # define RUBY3_COMPILER_VERSION_PATCH __GNUC_PATCHLEVEL__
45 #endif