zscan 2.0.8 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/pack/pack-27.c +1 -0
- data/ext/pack/pack.c +1 -0
- data/ext/pack/ruby/backward/2/assume.h +43 -0
- data/ext/pack/ruby/backward/2/attributes.h +157 -0
- data/ext/pack/ruby/backward/2/bool.h +37 -0
- data/ext/pack/ruby/backward/2/extern.h +46 -0
- data/ext/pack/ruby/backward/2/gcc_version_since.h +38 -0
- data/ext/pack/ruby/backward/2/inttypes.h +132 -0
- data/ext/pack/ruby/backward/2/limits.h +100 -0
- data/ext/pack/ruby/backward/2/long_long.h +65 -0
- data/ext/pack/ruby/backward/2/r_cast.h +27 -0
- data/ext/pack/ruby/backward/2/rmodule.h +31 -0
- data/ext/pack/ruby/backward/2/stdalign.h +30 -0
- data/ext/pack/ruby/backward/2/stdarg.h +47 -0
- data/ext/pack/ruby/backward/classext.h +25 -0
- data/ext/pack/ruby/backward/rubyio.h +18 -0
- data/ext/pack/ruby/backward/rubysig.h +26 -0
- data/ext/pack/ruby/backward/st.h +18 -0
- data/ext/pack/ruby/backward/util.h +18 -0
- data/ext/pack/ruby/internal/anyargs.h +375 -0
- data/ext/pack/ruby/internal/arithmetic.h +38 -0
- data/ext/pack/ruby/internal/arithmetic/char.h +58 -0
- data/ext/pack/ruby/internal/arithmetic/double.h +39 -0
- data/ext/pack/ruby/internal/arithmetic/fixnum.h +44 -0
- data/ext/pack/ruby/internal/arithmetic/gid_t.h +34 -0
- data/ext/pack/ruby/internal/arithmetic/int.h +163 -0
- data/ext/pack/ruby/internal/arithmetic/intptr_t.h +42 -0
- data/ext/pack/ruby/internal/arithmetic/long.h +244 -0
- data/ext/pack/ruby/internal/arithmetic/long_long.h +53 -0
- data/ext/pack/ruby/internal/arithmetic/mode_t.h +34 -0
- data/ext/pack/ruby/internal/arithmetic/off_t.h +49 -0
- data/ext/pack/ruby/internal/arithmetic/pid_t.h +34 -0
- data/ext/pack/ruby/internal/arithmetic/short.h +54 -0
- data/ext/pack/ruby/internal/arithmetic/size_t.h +51 -0
- data/ext/pack/ruby/internal/arithmetic/st_data_t.h +59 -0
- data/ext/pack/ruby/internal/arithmetic/uid_t.h +34 -0
- data/ext/pack/ruby/internal/assume.h +90 -0
- data/ext/pack/ruby/internal/attr/alloc_size.h +32 -0
- data/ext/pack/ruby/internal/attr/artificial.h +46 -0
- data/ext/pack/ruby/internal/attr/cold.h +37 -0
- data/ext/pack/ruby/internal/attr/const.h +46 -0
- data/ext/pack/ruby/internal/attr/constexpr.h +85 -0
- data/ext/pack/ruby/internal/attr/deprecated.h +59 -0
- data/ext/pack/ruby/internal/attr/diagnose_if.h +42 -0
- data/ext/pack/ruby/internal/attr/enum_extensibility.h +32 -0
- data/ext/pack/ruby/internal/attr/error.h +32 -0
- data/ext/pack/ruby/internal/attr/flag_enum.h +33 -0
- data/ext/pack/ruby/internal/attr/forceinline.h +40 -0
- data/ext/pack/ruby/internal/attr/format.h +38 -0
- data/ext/pack/ruby/internal/attr/maybe_unused.h +38 -0
- data/ext/pack/ruby/internal/attr/noalias.h +58 -0
- data/ext/pack/ruby/internal/attr/nodiscard.h +45 -0
- data/ext/pack/ruby/internal/attr/noexcept.h +91 -0
- data/ext/pack/ruby/internal/attr/noinline.h +35 -0
- data/ext/pack/ruby/internal/attr/nonnull.h +32 -0
- data/ext/pack/ruby/internal/attr/noreturn.h +48 -0
- data/ext/pack/ruby/internal/attr/pure.h +43 -0
- data/ext/pack/ruby/internal/attr/restrict.h +45 -0
- data/ext/pack/ruby/internal/attr/returns_nonnull.h +37 -0
- data/ext/pack/ruby/internal/attr/warning.h +32 -0
- data/ext/pack/ruby/internal/attr/weakref.h +32 -0
- data/ext/pack/ruby/internal/cast.h +53 -0
- data/ext/pack/ruby/internal/compiler_is.h +45 -0
- data/ext/pack/ruby/internal/compiler_is/apple.h +41 -0
- data/ext/pack/ruby/internal/compiler_is/clang.h +38 -0
- data/ext/pack/ruby/internal/compiler_is/gcc.h +46 -0
- data/ext/pack/ruby/internal/compiler_is/intel.h +41 -0
- data/ext/pack/ruby/internal/compiler_is/msvc.h +57 -0
- data/ext/pack/ruby/internal/compiler_is/sunpro.h +55 -0
- data/ext/pack/ruby/internal/compiler_since.h +61 -0
- data/ext/pack/ruby/internal/config.h +131 -0
- data/ext/pack/ruby/internal/constant_p.h +37 -0
- data/ext/pack/ruby/internal/core.h +35 -0
- data/ext/pack/ruby/internal/core/rarray.h +275 -0
- data/ext/pack/ruby/internal/core/rbasic.h +85 -0
- data/ext/pack/ruby/internal/core/rbignum.h +51 -0
- data/ext/pack/ruby/internal/core/rclass.h +47 -0
- data/ext/pack/ruby/internal/core/rdata.h +174 -0
- data/ext/pack/ruby/internal/core/rfile.h +36 -0
- data/ext/pack/ruby/internal/core/rhash.h +62 -0
- data/ext/pack/ruby/internal/core/rmatch.h +73 -0
- data/ext/pack/ruby/internal/core/robject.h +97 -0
- data/ext/pack/ruby/internal/core/rregexp.h +84 -0
- data/ext/pack/ruby/internal/core/rstring.h +215 -0
- data/ext/pack/ruby/internal/core/rstruct.h +73 -0
- data/ext/pack/ruby/internal/core/rtypeddata.h +184 -0
- data/ext/pack/ruby/internal/ctype.h +203 -0
- data/ext/pack/ruby/internal/dllexport.h +92 -0
- data/ext/pack/ruby/internal/dosish.h +63 -0
- data/ext/pack/ruby/internal/error.h +74 -0
- data/ext/pack/ruby/internal/eval.h +50 -0
- data/ext/pack/ruby/internal/event.h +75 -0
- data/ext/pack/ruby/internal/fl_type.h +469 -0
- data/ext/pack/ruby/internal/gc.h +35 -0
- data/ext/pack/ruby/internal/glob.h +35 -0
- data/ext/pack/ruby/internal/globals.h +159 -0
- data/ext/pack/ruby/internal/has/attribute.h +164 -0
- data/ext/pack/ruby/internal/has/builtin.h +105 -0
- data/ext/pack/ruby/internal/has/c_attribute.h +38 -0
- data/ext/pack/ruby/internal/has/cpp_attribute.h +79 -0
- data/ext/pack/ruby/internal/has/declspec_attribute.h +48 -0
- data/ext/pack/ruby/internal/has/extension.h +33 -0
- data/ext/pack/ruby/internal/has/feature.h +31 -0
- data/ext/pack/ruby/internal/has/warning.h +31 -0
- data/ext/pack/ruby/internal/intern/array.h +78 -0
- data/ext/pack/ruby/internal/intern/bignum.h +105 -0
- data/ext/pack/ruby/internal/intern/class.h +57 -0
- data/ext/pack/ruby/internal/intern/compar.h +34 -0
- data/ext/pack/ruby/internal/intern/complex.h +60 -0
- data/ext/pack/ruby/internal/intern/cont.h +40 -0
- data/ext/pack/ruby/internal/intern/dir.h +33 -0
- data/ext/pack/ruby/internal/intern/enum.h +33 -0
- data/ext/pack/ruby/internal/intern/enumerator.h +79 -0
- data/ext/pack/ruby/internal/intern/error.h +82 -0
- data/ext/pack/ruby/internal/intern/eval.h +59 -0
- data/ext/pack/ruby/internal/intern/file.h +44 -0
- data/ext/pack/ruby/internal/intern/gc.h +57 -0
- data/ext/pack/ruby/internal/intern/hash.h +59 -0
- data/ext/pack/ruby/internal/intern/io.h +70 -0
- data/ext/pack/ruby/internal/intern/load.h +39 -0
- data/ext/pack/ruby/internal/intern/marshal.h +35 -0
- data/ext/pack/ruby/internal/intern/numeric.h +42 -0
- data/ext/pack/ruby/internal/intern/object.h +90 -0
- data/ext/pack/ruby/internal/intern/parse.h +64 -0
- data/ext/pack/ruby/internal/intern/proc.h +53 -0
- data/ext/pack/ruby/internal/intern/process.h +46 -0
- data/ext/pack/ruby/internal/intern/random.h +45 -0
- data/ext/pack/ruby/internal/intern/range.h +35 -0
- data/ext/pack/ruby/internal/intern/rational.h +46 -0
- data/ext/pack/ruby/internal/intern/re.h +50 -0
- data/ext/pack/ruby/internal/intern/ruby.h +37 -0
- data/ext/pack/ruby/internal/intern/select.h +52 -0
- data/ext/pack/ruby/internal/intern/select/largesize.h +103 -0
- data/ext/pack/ruby/internal/intern/select/posix.h +82 -0
- data/ext/pack/ruby/internal/intern/select/win32.h +124 -0
- data/ext/pack/ruby/internal/intern/signal.h +40 -0
- data/ext/pack/ruby/internal/intern/sprintf.h +43 -0
- data/ext/pack/ruby/internal/intern/string.h +290 -0
- data/ext/pack/ruby/internal/intern/struct.h +47 -0
- data/ext/pack/ruby/internal/intern/thread.h +76 -0
- data/ext/pack/ruby/internal/intern/time.h +52 -0
- data/ext/pack/ruby/internal/intern/variable.h +83 -0
- data/ext/pack/ruby/internal/intern/vm.h +77 -0
- data/ext/pack/ruby/internal/interpreter.h +94 -0
- data/ext/pack/ruby/internal/iterator.h +65 -0
- data/ext/pack/ruby/internal/memory.h +286 -0
- data/ext/pack/ruby/internal/method.h +39 -0
- data/ext/pack/ruby/internal/module.h +39 -0
- data/ext/pack/ruby/internal/newobj.h +73 -0
- data/ext/pack/ruby/internal/rgengc.h +199 -0
- data/ext/pack/ruby/internal/scan_args.h +394 -0
- data/ext/pack/ruby/internal/special_consts.h +204 -0
- data/ext/pack/ruby/internal/static_assert.h +77 -0
- data/ext/pack/ruby/internal/stdalign.h +124 -0
- data/ext/pack/ruby/internal/stdbool.h +51 -0
- data/ext/pack/ruby/internal/symbol.h +114 -0
- data/ext/pack/ruby/internal/token_paste.h +75 -0
- data/ext/pack/ruby/internal/value.h +66 -0
- data/ext/pack/ruby/internal/value_type.h +354 -0
- data/ext/pack/ruby/internal/variable.h +62 -0
- data/ext/pack/ruby/internal/warning_push.h +91 -0
- data/ext/pack/ruby/internal/xmalloc.h +201 -0
- data/lib/zscan.rb +1 -1
- data/readme.md +2 -0
- data/zscan.gemspec +1 -1
- metadata +162 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#ifndef RBIMPL_ATTR_FORCEINLINE_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_ATTR_FORCEINLINE_H
|
|
3
|
+
/**
|
|
4
|
+
* @file
|
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
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 #RBIMPL_ATTR_FORCEINLINE.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/compiler_since.h"
|
|
24
|
+
#include "ruby/internal/has/attribute.h"
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Wraps (or simulates) `__forceinline`. MSVC complains on declarations like
|
|
28
|
+
* `static inline __forceinline void foo()`. It seems MSVC's `inline` and
|
|
29
|
+
* `__forceinline` are mutually exclusive. We have to mimic that behaviour for
|
|
30
|
+
* non-MSVC compilers.
|
|
31
|
+
*/
|
|
32
|
+
#if RBIMPL_COMPILER_SINCE(MSVC, 12, 0, 0)
|
|
33
|
+
# define RBIMPL_ATTR_FORCEINLINE() __forceinline
|
|
34
|
+
#elif RBIMPL_HAS_ATTRIBUTE(always_inline)
|
|
35
|
+
# define RBIMPL_ATTR_FORCEINLINE() __attribute__((__always_inline__)) inline
|
|
36
|
+
#else
|
|
37
|
+
# define RBIMPL_ATTR_FORCEINLINE() inline
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
#endif /* RBIMPL_ATTR_FORCEINLINE_H */
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#ifndef RBIMPL_ATTR_FORMAT_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_ATTR_FORMAT_H
|
|
3
|
+
/**
|
|
4
|
+
* @file
|
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
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 #RBIMPL_ATTR_FORMAT.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/has/attribute.h"
|
|
24
|
+
|
|
25
|
+
/** Wraps (or simulates) `__attribute__((format))` */
|
|
26
|
+
#if RBIMPL_HAS_ATTRIBUTE(format)
|
|
27
|
+
# define RBIMPL_ATTR_FORMAT(x, y, z) __attribute__((__format__(x, y, z)))
|
|
28
|
+
#else
|
|
29
|
+
# define RBIMPL_ATTR_FORMAT(x, y, z) /* void */
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
#if defined(__MINGW_PRINTF_FORMAT)
|
|
33
|
+
# define RBIMPL_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
|
|
34
|
+
#else
|
|
35
|
+
# define RBIMPL_PRINTF_FORMAT __printf__
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#endif /* RBIMPL_ATTR_FORMAT_H */
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#ifndef RBIMPL_ATTR_MAYBE_UNUSED_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_ATTR_MAYBE_UNUSED_H
|
|
3
|
+
/**
|
|
4
|
+
* @file
|
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
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 #RBIMPL_ATTR_MAYBE_UNUSED.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/has/attribute.h"
|
|
24
|
+
#include "ruby/internal/has/c_attribute.h"
|
|
25
|
+
#include "ruby/internal/has/cpp_attribute.h"
|
|
26
|
+
|
|
27
|
+
/** Wraps (or simulates) `[[maybe_unused]]` */
|
|
28
|
+
#if RBIMPL_HAS_CPP_ATTRIBUTE(maybe_unused)
|
|
29
|
+
# define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
|
|
30
|
+
#elif RBIMPL_HAS_C_ATTRIBUTE(maybe_unused)
|
|
31
|
+
# define RBIMPL_ATTR_MAYBE_UNUSED() [[maybe_unused]]
|
|
32
|
+
#elif RBIMPL_HAS_ATTRIBUTE(unused)
|
|
33
|
+
# define RBIMPL_ATTR_MAYBE_UNUSED() __attribute__((__unused__))
|
|
34
|
+
#else
|
|
35
|
+
# define RBIMPL_ATTR_MAYBE_UNUSED() /* void */
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#endif /* RBIMPL_ATTR_MAYBE_UNUSED */
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#ifndef RBIMPL_ATTR_NOALIAS_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_ATTR_NOALIAS_H
|
|
3
|
+
/**
|
|
4
|
+
* @file
|
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
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 #RBIMPL_ATTR_NOALIAS.
|
|
22
|
+
*
|
|
23
|
+
* ### Q&A ###
|
|
24
|
+
*
|
|
25
|
+
* - Q: There are seemingly similar attributes named #RBIMPL_ATTR_CONST,
|
|
26
|
+
* #RBIMPL_ATTR_PURE, and #RBIMPL_ATTR_NOALIAS. What are the difference?
|
|
27
|
+
*
|
|
28
|
+
* - A: Allowed operations are different.
|
|
29
|
+
*
|
|
30
|
+
* - #RBIMPL_ATTR_CONST ... Functions attributed by this are not allowed to
|
|
31
|
+
* read/write _any_ pointers at all (there are exceptional situations
|
|
32
|
+
* when reading a pointer is possible but forget that; they are too
|
|
33
|
+
* exceptional to be useful). Just remember that everything pointer-
|
|
34
|
+
* related are NG.
|
|
35
|
+
*
|
|
36
|
+
* - #RBIMPL_ATTR_PURE ... Functions attributed by this can read any
|
|
37
|
+
* nonvolatile pointers, but no writes are allowed at all. The ability
|
|
38
|
+
* to read _any_ nonvolatile pointers makes it possible to mark ::VALUE-
|
|
39
|
+
* taking functions as being pure, as long as they are read-only.
|
|
40
|
+
*
|
|
41
|
+
* - #RBIMPL_ATTR_NOALIAS ... Can both read/write, but only through
|
|
42
|
+
* pointers passed to the function as parameters. This is a typical
|
|
43
|
+
* situation when you create a C++ non-static member function which only
|
|
44
|
+
* concerns `this`. No global variables are allowed to read/write. So
|
|
45
|
+
* this is not a super-set of being pure. If you want to read something,
|
|
46
|
+
* that has to be passed to the function as a pointer. ::VALUE -taking
|
|
47
|
+
* functions thus cannot be attributed as such.
|
|
48
|
+
*/
|
|
49
|
+
#include "ruby/internal/has/declspec_attribute.h"
|
|
50
|
+
|
|
51
|
+
/** Wraps (or simulates) `__declspec((noalias))` */
|
|
52
|
+
#if RBIMPL_HAS_DECLSPEC_ATTRIBUTE(noalias)
|
|
53
|
+
# define RBIMPL_ATTR_NOALIAS() __declspec(noalias)
|
|
54
|
+
#else
|
|
55
|
+
# define RBIMPL_ATTR_NOALIAS() /* void */
|
|
56
|
+
#endif
|
|
57
|
+
|
|
58
|
+
#endif /* RBIMPL_ATTR_NOALIAS_H */
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#ifndef RBIMPL_ATTR_NODISCARD_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_ATTR_NODISCARD_H
|
|
3
|
+
/**
|
|
4
|
+
* @file
|
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
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 #RBIMPL_ATTR_NODISCARD.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/has/attribute.h"
|
|
24
|
+
#include "ruby/internal/has/c_attribute.h"
|
|
25
|
+
#include "ruby/internal/has/cpp_attribute.h"
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Wraps (or simulates) `[[nodiscard]]`. In C++ (at least since C++20) a
|
|
29
|
+
* nodiscard attribute can have a message why the result shall not be ignoed.
|
|
30
|
+
* However GCC attribute and SAL annotation cannot take them.
|
|
31
|
+
*/
|
|
32
|
+
#if RBIMPL_HAS_CPP_ATTRIBUTE(nodiscard)
|
|
33
|
+
# define RBIMPL_ATTR_NODISCARD() [[nodiscard]]
|
|
34
|
+
#elif RBIMPL_HAS_C_ATTRIBUTE(nodiscard)
|
|
35
|
+
# define RBIMPL_ATTR_NODISCARD() [[nodiscard]]
|
|
36
|
+
#elif RBIMPL_HAS_ATTRIBUTE(warn_unused_result)
|
|
37
|
+
# define RBIMPL_ATTR_NODISCARD() __attribute__((__warn_unused_result__))
|
|
38
|
+
#elif defined(_Check_return_)
|
|
39
|
+
# /* Take SAL definition. */
|
|
40
|
+
# define RBIMPL_ATTR_NODISCARD() _Check_return_
|
|
41
|
+
#else
|
|
42
|
+
# define RBIMPL_ATTR_NODISCARD() /* void */
|
|
43
|
+
#endif
|
|
44
|
+
|
|
45
|
+
#endif /* RBIMPL_ATTR_NODISCARD_H */
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#ifndef RBIMPL_ATTR_NOEXCEPT_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_ATTR_NOEXCEPT_H
|
|
3
|
+
/**
|
|
4
|
+
* @file
|
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
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 #RBIMPL_ATTR_NOEXCEPT.
|
|
22
|
+
*
|
|
23
|
+
* This isn't actually an attribute in C++ but who cares...
|
|
24
|
+
*
|
|
25
|
+
* Mainly due to aesthetic reasons, this one is rarely used in the project.
|
|
26
|
+
* But can be handy on occasions, especially when a function's noexcept-ness
|
|
27
|
+
* depends on its calling functions.
|
|
28
|
+
*
|
|
29
|
+
* ### Q&A ###
|
|
30
|
+
*
|
|
31
|
+
* - Q: Can a function that raises Ruby exceptions be attributed `noexcept`?
|
|
32
|
+
*
|
|
33
|
+
* - A: Yes. `noexcept` is about C++ exceptions, not Ruby's. They don't
|
|
34
|
+
* interface each other. You can safely attribute a function that raises
|
|
35
|
+
* Ruby exceptions as `noexcept`.
|
|
36
|
+
*
|
|
37
|
+
* - Q: How, then, can I assert that a function I wrote doesn't raise any Ruby
|
|
38
|
+
* exceptions?
|
|
39
|
+
*
|
|
40
|
+
* - A: `__attribute__((__leaf__))` is for that purpose. A function attributed
|
|
41
|
+
* as leaf can still throw C++ exceptions, but not Ruby's. Note however,
|
|
42
|
+
* that it's extremely difficult -- if not impossible -- to assert that a
|
|
43
|
+
* function doesn't raise any Ruby exceptions at all. Use of that
|
|
44
|
+
* attribute is not recommended; mere mortals can't properly use that by
|
|
45
|
+
* hand.
|
|
46
|
+
*
|
|
47
|
+
* - Q: Does it make sense to attribute an inline function `noexcept`?
|
|
48
|
+
*
|
|
49
|
+
* - A: I thought so before. But no, I don't think they are useful any longer.
|
|
50
|
+
*
|
|
51
|
+
* - When an inline function attributed `noexcept` actually doesn't throw
|
|
52
|
+
* any exceptions at all: these days I don't see any difference in
|
|
53
|
+
* generated assembly by adding/removing this attribute. C++ compilers
|
|
54
|
+
* get smarter and smarter. Today they can infer if it actually throws
|
|
55
|
+
* or not without any annotations by humans (correct me if I'm wrong).
|
|
56
|
+
*
|
|
57
|
+
* - When an inline function attributed `noexcepr` actually _does_ throw an
|
|
58
|
+
* exception: they have to call `std::terminate` then (C++ standard
|
|
59
|
+
* mandates so). This means exception handling routines are actually
|
|
60
|
+
* enforced, not omitted. This doesn't impact runtime performance (The
|
|
61
|
+
* Itanium C++ ABI has zero-cost exception handling), but does impact on
|
|
62
|
+
* generated binary size. This is bad.
|
|
63
|
+
*/
|
|
64
|
+
#include "ruby/internal/compiler_since.h"
|
|
65
|
+
#include "ruby/internal/has/feature.h"
|
|
66
|
+
|
|
67
|
+
/** Wraps (or simulates) C++11 `noexcept` */
|
|
68
|
+
#if ! defined(__cplusplus)
|
|
69
|
+
# /* Doesn't make sense. */
|
|
70
|
+
# define RBIMPL_ATTR_NOEXCEPT(_) /* void */
|
|
71
|
+
|
|
72
|
+
#elif RBIMPL_HAS_FEATURE(cxx_noexcept)
|
|
73
|
+
# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_))
|
|
74
|
+
|
|
75
|
+
#elif defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__
|
|
76
|
+
# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_))
|
|
77
|
+
|
|
78
|
+
#elif defined(__INTEL_CXX11_MODE__)
|
|
79
|
+
# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_))
|
|
80
|
+
|
|
81
|
+
#elif RBIMPL_COMPILER_SINCE(MSVC, 19, 0, 0)
|
|
82
|
+
# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_))
|
|
83
|
+
|
|
84
|
+
#elif __cplusplus >= 201103L
|
|
85
|
+
# define RBIMPL_ATTR_NOEXCEPT(_) noexcept(noexcept(_))
|
|
86
|
+
|
|
87
|
+
#else
|
|
88
|
+
# define RBIMPL_ATTR_NOEXCEPT(_) /* void */
|
|
89
|
+
#endif
|
|
90
|
+
|
|
91
|
+
#endif /* RBIMPL_ATTR_NOEXCEPT_H */
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#ifndef RBIMPL_ATTR_NOINLINE_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_ATTR_NOINLINE_H
|
|
3
|
+
/**
|
|
4
|
+
* @file
|
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
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 #RBIMPL_ATTR_NOINLINE.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/has/attribute.h"
|
|
24
|
+
#include "ruby/internal/has/declspec_attribute.h"
|
|
25
|
+
|
|
26
|
+
/** Wraps (or simulates) `__declspec(noinline)` */
|
|
27
|
+
#if RBIMPL_HAS_DECLSPEC_ATTRIBUTE(noinline)
|
|
28
|
+
# define RBIMPL_ATTR_NOINLINE() __declspec(noinline)
|
|
29
|
+
#elif RBIMPL_HAS_ATTRIBUTE(noinline)
|
|
30
|
+
# define RBIMPL_ATTR_NOINLINE() __attribute__((__noinline__))
|
|
31
|
+
#else
|
|
32
|
+
# define RBIMPL_ATTR_NOINLINE() /* void */
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
#endif /* RBIMPL_ATTR_NOINLINE_H */
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#ifndef RBIMPL_ATTR_NONNULL_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_ATTR_NONNULL_H
|
|
3
|
+
/**
|
|
4
|
+
* @file
|
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
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 #RBIMPL_ATTR_NONNULL.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/has/attribute.h"
|
|
24
|
+
|
|
25
|
+
/** Wraps (or simulates) `__attribute__((nonnull))` */
|
|
26
|
+
#if RBIMPL_HAS_ATTRIBUTE(nonnull)
|
|
27
|
+
# define RBIMPL_ATTR_NONNULL(list) __attribute__((__nonnull__ list))
|
|
28
|
+
#else
|
|
29
|
+
# define RBIMPL_ATTR_NONNULL(list) /* void */
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
#endif /* RBIMPL_ATTR_NONNULL_H */
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#ifndef RBIMPL_ATTR_NORETURN_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_ATTR_NORETURN_H
|
|
3
|
+
/**
|
|
4
|
+
* @file
|
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
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 #RBIMPL_ATTR_NORETURN.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/has/attribute.h"
|
|
24
|
+
#include "ruby/internal/has/cpp_attribute.h"
|
|
25
|
+
#include "ruby/internal/has/declspec_attribute.h"
|
|
26
|
+
|
|
27
|
+
/** Wraps (or simulates) `[[noreturn]]` */
|
|
28
|
+
#if RBIMPL_HAS_DECLSPEC_ATTRIBUTE(noreturn)
|
|
29
|
+
# define RBIMPL_ATTR_NORETURN() __declspec(noreturn)
|
|
30
|
+
|
|
31
|
+
#elif RBIMPL_HAS_ATTRIBUTE(noreturn)
|
|
32
|
+
# define RBIMPL_ATTR_NORETURN() __attribute__((__noreturn__))
|
|
33
|
+
|
|
34
|
+
#elif RBIMPL_HAS_CPP_ATTRIBUTE(noreturn)
|
|
35
|
+
# define RBIMPL_ATTR_NORETURN() [[noreturn]]
|
|
36
|
+
|
|
37
|
+
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112)
|
|
38
|
+
# define RBIMPL_ATTR_NORETURN() _Noreturn
|
|
39
|
+
|
|
40
|
+
#elif defined(_Noreturn)
|
|
41
|
+
# /* glibc <sys/cdefs.h> has this macro. */
|
|
42
|
+
# define RBIMPL_ATTR_NORETURN() _Noreturn
|
|
43
|
+
|
|
44
|
+
#else
|
|
45
|
+
# define RBIMPL_ATTR_NORETURN() /* void */
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
#endif /* RBIMPL_ATTR_NORETURN_H */
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#ifndef RBIMPL_ATTR_PURE_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
2
|
+
#define RBIMPL_ATTR_PURE_H
|
|
3
|
+
/**
|
|
4
|
+
* @file
|
|
5
|
+
* @author Ruby developers <ruby-core@ruby-lang.org>
|
|
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 #RBIMPL_ATTR_PURE.
|
|
22
|
+
*/
|
|
23
|
+
#include "ruby/internal/compiler_since.h"
|
|
24
|
+
#include "ruby/internal/has/attribute.h"
|
|
25
|
+
#include "ruby/assert.h"
|
|
26
|
+
|
|
27
|
+
/** Wraps (or simulates) `__attribute__((pure))` */
|
|
28
|
+
#if RBIMPL_HAS_ATTRIBUTE(pure)
|
|
29
|
+
# define RBIMPL_ATTR_PURE() __attribute__((__pure__))
|
|
30
|
+
#elif RBIMPL_COMPILER_SINCE(SunPro, 5, 10, 0)
|
|
31
|
+
# define RBIMPL_ATTR_PURE() _Pragma("does_not_write_global_data")
|
|
32
|
+
#else
|
|
33
|
+
# define RBIMPL_ATTR_PURE() /* void */
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
/** Enables #RBIMPL_ATTR_PURE iff. #RUBY_NDEBUG. */
|
|
37
|
+
#if RUBY_NDEBUG
|
|
38
|
+
# define RBIMPL_ATTR_PURE_ON_NDEBUG() RBIMPL_ATTR_PURE()
|
|
39
|
+
#else
|
|
40
|
+
# define RBIMPL_ATTR_PURE_ON_NDEBUG() /* void */
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#endif /* RBIMPL_ATTR_PURE_H */
|