Merge pull request #2991 from shyouhei/ruby.h
[ruby.git] / include / ruby / 3 / attr / flag_enum.h
bloba026ab5de14f9c6f291391cb7c6b2e4d218efe92
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_ATTR_FLAG_ENUM.
20 * @see https://clang.llvm.org/docs/AttributeReference.html#flag_enum
22 #include "ruby/3/has/attribute.h"
24 /** Wraps (or simulates) `__attribute__((flag_enum)` */
25 #if defined(RUBY3_ATTR_FLAG_ENUM)
26 # /* Take that. */
28 #elif RUBY3_HAS_ATTRIBUTE(flag_enum)
29 # define RUBY3_ATTR_FLAG_ENUM() __attribute__((__flag_enum__))
31 #else
32 # define RUBY3_ATTR_FLAG_ENUM() /* void */
33 #endif