rubycc 1.0.0

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.
Files changed (159) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +56 -0
  3. data/LICENSE.txt +21 -0
  4. data/NOTICE +52 -0
  5. data/README.md +208 -0
  6. data/data/README.md +117 -0
  7. data/data/r10_corpus_scan.json +4082 -0
  8. data/data/r10_manual_classification.json +5342 -0
  9. data/data/r10_verification_m4a.json +1531 -0
  10. data/data/r10_verification_m4b.json +1818 -0
  11. data/data/r10_verification_m4c.json +1489 -0
  12. data/data/r10_verification_m4d.json +318 -0
  13. data/data/r10_verification_rbs.json +192 -0
  14. data/data/verified_gems.json +397 -0
  15. data/exe/rmake +16 -0
  16. data/exe/rubycc +9 -0
  17. data/exe/rubycc-ar +114 -0
  18. data/exe/rubycc-doctor +14 -0
  19. data/exe/rubycc-pkgconf +8 -0
  20. data/include/float.h +87 -0
  21. data/include/iso646.h +18 -0
  22. data/include/libc/alloca.h +18 -0
  23. data/include/libc/arpa/inet.h +61 -0
  24. data/include/libc/assert.h +43 -0
  25. data/include/libc/dirent.h +72 -0
  26. data/include/libc/dlfcn.h +58 -0
  27. data/include/libc/features.h +205 -0
  28. data/include/libc/glibc/aarch64/ctype.h +108 -0
  29. data/include/libc/glibc/aarch64/endian.h +54 -0
  30. data/include/libc/glibc/aarch64/errno.h +154 -0
  31. data/include/libc/glibc/aarch64/fcntl.h +144 -0
  32. data/include/libc/glibc/aarch64/inttypes.h +182 -0
  33. data/include/libc/glibc/aarch64/limits.h +63 -0
  34. data/include/libc/glibc/aarch64/pthread.h +131 -0
  35. data/include/libc/glibc/aarch64/setjmp.h +84 -0
  36. data/include/libc/glibc/aarch64/stdint.h +174 -0
  37. data/include/libc/glibc/aarch64/sys/epoll.h +88 -0
  38. data/include/libc/glibc/aarch64/sys/fcntl.h +19 -0
  39. data/include/libc/glibc/aarch64/sys/select.h +75 -0
  40. data/include/libc/glibc/aarch64/sys/stat.h +136 -0
  41. data/include/libc/glibc/aarch64/sys/syscall.h +167 -0
  42. data/include/libc/glibc/aarch64/sys/time.h +74 -0
  43. data/include/libc/glibc/aarch64/sys/types.h +127 -0
  44. data/include/libc/glibc/aarch64/time.h +113 -0
  45. data/include/libc/glibc/x86_64/ctype.h +108 -0
  46. data/include/libc/glibc/x86_64/endian.h +54 -0
  47. data/include/libc/glibc/x86_64/errno.h +154 -0
  48. data/include/libc/glibc/x86_64/fcntl.h +134 -0
  49. data/include/libc/glibc/x86_64/inttypes.h +182 -0
  50. data/include/libc/glibc/x86_64/limits.h +61 -0
  51. data/include/libc/glibc/x86_64/pthread.h +111 -0
  52. data/include/libc/glibc/x86_64/setjmp.h +82 -0
  53. data/include/libc/glibc/x86_64/stdint.h +163 -0
  54. data/include/libc/glibc/x86_64/sys/epoll.h +91 -0
  55. data/include/libc/glibc/x86_64/sys/fcntl.h +19 -0
  56. data/include/libc/glibc/x86_64/sys/select.h +75 -0
  57. data/include/libc/glibc/x86_64/sys/stat.h +130 -0
  58. data/include/libc/glibc/x86_64/sys/syscall.h +188 -0
  59. data/include/libc/glibc/x86_64/sys/time.h +74 -0
  60. data/include/libc/glibc/x86_64/sys/types.h +123 -0
  61. data/include/libc/glibc/x86_64/time.h +113 -0
  62. data/include/libc/grp.h +50 -0
  63. data/include/libc/langinfo.h +126 -0
  64. data/include/libc/link.h +18 -0
  65. data/include/libc/locale.h +83 -0
  66. data/include/libc/math.h +191 -0
  67. data/include/libc/netinet/in.h +126 -0
  68. data/include/libc/netinet/tcp.h +44 -0
  69. data/include/libc/poll.h +46 -0
  70. data/include/libc/pwd.h +58 -0
  71. data/include/libc/regex.h +53 -0
  72. data/include/libc/sched.h +35 -0
  73. data/include/libc/signal.h +204 -0
  74. data/include/libc/stdio.h +157 -0
  75. data/include/libc/stdlib.h +92 -0
  76. data/include/libc/string.h +74 -0
  77. data/include/libc/strings.h +25 -0
  78. data/include/libc/sys/cdefs.h +126 -0
  79. data/include/libc/sys/inotify.h +111 -0
  80. data/include/libc/sys/ioctl.h +36 -0
  81. data/include/libc/sys/mman.h +65 -0
  82. data/include/libc/sys/param.h +41 -0
  83. data/include/libc/sys/resource.h +109 -0
  84. data/include/libc/sys/socket.h +167 -0
  85. data/include/libc/sys/statfs.h +82 -0
  86. data/include/libc/sys/timerfd.h +55 -0
  87. data/include/libc/sys/uio.h +40 -0
  88. data/include/libc/sys/un.h +25 -0
  89. data/include/libc/sys/utsname.h +35 -0
  90. data/include/libc/sys/wait.h +135 -0
  91. data/include/libc/termios.h +179 -0
  92. data/include/libc/unistd.h +194 -0
  93. data/include/stdalign.h +16 -0
  94. data/include/stdarg.h +31 -0
  95. data/include/stdatomic.h +158 -0
  96. data/include/stdbool.h +15 -0
  97. data/include/stdckdint.h +28 -0
  98. data/include/stddef.h +60 -0
  99. data/include/stdnoreturn.h +18 -0
  100. data/include/x86intrin.h +16 -0
  101. data/lib/rubycc/backend/aarch64.rb +1724 -0
  102. data/lib/rubycc/backend/x86_64.rb +1369 -0
  103. data/lib/rubycc/compile_error.rb +36 -0
  104. data/lib/rubycc/compiler.rb +305 -0
  105. data/lib/rubycc/doctor/builder.rb +151 -0
  106. data/lib/rubycc/doctor/cli.rb +190 -0
  107. data/lib/rubycc/doctor/fetcher.rb +84 -0
  108. data/lib/rubycc/doctor/gemfile.rb +115 -0
  109. data/lib/rubycc/doctor/verified_gems.rb +114 -0
  110. data/lib/rubycc/doctor.rb +16 -0
  111. data/lib/rubycc/driver.rb +463 -0
  112. data/lib/rubycc/front/ast.rb +528 -0
  113. data/lib/rubycc/front/constant_evaluator.rb +631 -0
  114. data/lib/rubycc/front/initializer_resolver.rb +592 -0
  115. data/lib/rubycc/front/lexeme_reader.rb +460 -0
  116. data/lib/rubycc/front/lexer.rb +232 -0
  117. data/lib/rubycc/front/parser.rb +4122 -0
  118. data/lib/rubycc/front/token.rb +49 -0
  119. data/lib/rubycc/ir/call_convention.rb +486 -0
  120. data/lib/rubycc/ir/generator.rb +6036 -0
  121. data/lib/rubycc/ir/ir.rb +417 -0
  122. data/lib/rubycc/link/compat_runtime.rb +89 -0
  123. data/lib/rubycc/link/errors.rb +13 -0
  124. data/lib/rubycc/link/executable_linker.rb +405 -0
  125. data/lib/rubycc/link/library_resolver.rb +437 -0
  126. data/lib/rubycc/link/partial_linker.rb +546 -0
  127. data/lib/rubycc/link/shared_linker.rb +1732 -0
  128. data/lib/rubycc/mkmf_shim.rb +83 -0
  129. data/lib/rubycc/objfile/ar_archive.rb +437 -0
  130. data/lib/rubycc/objfile/elf_reader.rb +646 -0
  131. data/lib/rubycc/objfile/elf_writer.rb +891 -0
  132. data/lib/rubycc/objfile/relocatable_writer.rb +376 -0
  133. data/lib/rubycc/pkgconf/cli.rb +139 -0
  134. data/lib/rubycc/pkgconf/errors.rb +39 -0
  135. data/lib/rubycc/pkgconf/model.rb +28 -0
  136. data/lib/rubycc/pkgconf/parser.rb +109 -0
  137. data/lib/rubycc/pkgconf/pkgconf.rb +15 -0
  138. data/lib/rubycc/pkgconf/resolver.rb +70 -0
  139. data/lib/rubycc/pkgconf/search_path.rb +38 -0
  140. data/lib/rubycc/pkgconf/system_path_filter.rb +131 -0
  141. data/lib/rubycc/preprocess/constant_expression.rb +219 -0
  142. data/lib/rubycc/preprocess/glibc_version.rb +124 -0
  143. data/lib/rubycc/preprocess/pp_token.rb +62 -0
  144. data/lib/rubycc/preprocess/preprocessor.rb +2020 -0
  145. data/lib/rubycc/preprocess/scanner.rb +290 -0
  146. data/lib/rubycc/preprocess/token_converter.rb +157 -0
  147. data/lib/rubycc/rmake/cli.rb +143 -0
  148. data/lib/rubycc/rmake/errors.rb +71 -0
  149. data/lib/rubycc/rmake/executor.rb +818 -0
  150. data/lib/rubycc/rmake/expander.rb +251 -0
  151. data/lib/rubycc/rmake/makefile.rb +352 -0
  152. data/lib/rubycc/rmake/model.rb +137 -0
  153. data/lib/rubycc/rmake/parser.rb +226 -0
  154. data/lib/rubycc/rmake/rmake.rb +15 -0
  155. data/lib/rubycc/type.rb +1236 -0
  156. data/lib/rubycc/version.rb +5 -0
  157. data/lib/rubycc.rb +36 -0
  158. data/lib/rubygems_plugin.rb +102 -0
  159. metadata +219 -0
@@ -0,0 +1,158 @@
1
+ /* rubycc's freestanding <stdatomic.h> subset.
2
+ *
3
+ * rubycc compiles `_Atomic T` as plain `T` — same size, same alignment, same
4
+ * ABI (measured against gcc type by type; see test/test_header_abi.rb's
5
+ * STDATOMIC spec) — and only for the types that measurement covers: integer,
6
+ * floating and pointer types of 1, 2, 4 or 8 bytes. `_Atomic` on an aggregate,
7
+ * on a 16-byte scalar, on an array or on a function is a compile error rather
8
+ * than a silently non-atomic object.
9
+ *
10
+ * What this header provides, all of it resting on the __atomic_* builtins the
11
+ * compiler actually lowers to locked machine sequences:
12
+ *
13
+ * atomic_load / atomic_store / atomic_exchange, their _explicit forms,
14
+ * atomic_compare_exchange_strong / _weak and their _explicit forms,
15
+ * atomic_fetch_add / atomic_fetch_sub and their _explicit forms,
16
+ * atomic_init, ATOMIC_VAR_INIT, kill_dependency,
17
+ * atomic_thread_fence / atomic_signal_fence, the memory_order constants,
18
+ * the atomic_* typedefs and the ATOMIC_*_LOCK_FREE macros.
19
+ *
20
+ * What it deliberately does NOT provide, because the builtins underneath
21
+ * cannot implement it and a name that does not work is worse than a missing
22
+ * one:
23
+ *
24
+ * atomic_fetch_or / _and / _xor — rubycc has __atomic_or_fetch (which yields
25
+ * the *new* value) but no __atomic_fetch_or, and the old value cannot be
26
+ * recovered from the new one for a bitwise or; there is no and/xor form at
27
+ * all.
28
+ * atomic_flag, atomic_flag_test_and_set, atomic_flag_clear — these need
29
+ * __atomic_test_and_set / __atomic_clear on a 1-byte object, and rubycc
30
+ * lowers neither (its atomic objects are 4 or 8 bytes wide).
31
+ * atomic_is_lock_free — needs __atomic_is_lock_free.
32
+ *
33
+ * One further limit, stated rather than hidden: reading or writing an _Atomic
34
+ * object with ordinary C operators (`x = 1;`, `if (x)`) compiles to an
35
+ * ordinary access. At the admitted widths that access is a single naturally
36
+ * aligned instruction, so it is still indivisible, but it does not carry the
37
+ * sequential consistency C11 gives an atomic assignment. Use the macros below
38
+ * where the ordering matters.
39
+ */
40
+ #ifndef RUBYCC_STDATOMIC_H
41
+ #define RUBYCC_STDATOMIC_H
42
+
43
+ #include <stddef.h>
44
+
45
+ /* C11 makes memory_order an enumeration; the values are what matter and they
46
+ * are the compiler's own __ATOMIC_* constants (whose values match gcc's, see
47
+ * test/test_atomic_builtins.rb), so an int typedef carries the same width (4)
48
+ * and the same values. */
49
+ typedef int memory_order;
50
+
51
+ #define memory_order_relaxed __ATOMIC_RELAXED
52
+ #define memory_order_consume __ATOMIC_CONSUME
53
+ #define memory_order_acquire __ATOMIC_ACQUIRE
54
+ #define memory_order_release __ATOMIC_RELEASE
55
+ #define memory_order_acq_rel __ATOMIC_ACQ_REL
56
+ #define memory_order_seq_cst __ATOMIC_SEQ_CST
57
+
58
+ /* The atomic-lock-free macros (7.17.1): 2 means "always lock-free", 0 means
59
+ * "never". gcc answers 2 for every one of these on x86-64 (measured), because
60
+ * it falls back to libatomic's locked path for the widths its ISA cannot do in
61
+ * one instruction. rubycc has no such fallback — it refuses an operation it
62
+ * cannot lower — so the honest answer is 2 only for the widths
63
+ * Rubycc::IR::Generator::ATOMIC_WIDTHS covers, and 0 for the rest. A program
64
+ * branching on these therefore takes its non-lock-free path for exactly the
65
+ * types whose atomic operations rubycc would reject. */
66
+ #define ATOMIC_BOOL_LOCK_FREE 0
67
+ #define ATOMIC_CHAR_LOCK_FREE 0
68
+ #define ATOMIC_CHAR16_T_LOCK_FREE 0
69
+ #define ATOMIC_SHORT_LOCK_FREE 0
70
+ #define ATOMIC_CHAR32_T_LOCK_FREE 2
71
+ #define ATOMIC_WCHAR_T_LOCK_FREE 2
72
+ #define ATOMIC_INT_LOCK_FREE 2
73
+ #define ATOMIC_LONG_LOCK_FREE 2
74
+ #define ATOMIC_LLONG_LOCK_FREE 2
75
+ #define ATOMIC_POINTER_LOCK_FREE 2
76
+
77
+ /* The atomic typedefs (7.17.6). Each is written with the _Atomic qualifier so
78
+ * the name documents itself, and each has its unqualified type's layout. The
79
+ * narrow ones are declared even though no atomic operation lowers for them:
80
+ * the type is usable, and an operation on it is refused at the call site with
81
+ * the compiler's own "4 or 8 bytes only" diagnostic. */
82
+ typedef _Atomic _Bool atomic_bool;
83
+ typedef _Atomic char atomic_char;
84
+ typedef _Atomic signed char atomic_schar;
85
+ typedef _Atomic unsigned char atomic_uchar;
86
+ typedef _Atomic short atomic_short;
87
+ typedef _Atomic unsigned short atomic_ushort;
88
+ typedef _Atomic int atomic_int;
89
+ typedef _Atomic unsigned int atomic_uint;
90
+ typedef _Atomic long atomic_long;
91
+ typedef _Atomic unsigned long atomic_ulong;
92
+ typedef _Atomic long long atomic_llong;
93
+ typedef _Atomic unsigned long long atomic_ullong;
94
+ typedef _Atomic size_t atomic_size_t;
95
+ typedef _Atomic ptrdiff_t atomic_ptrdiff_t;
96
+
97
+ /* Initialization (7.17.2). ATOMIC_VAR_INIT is the initializer for a static or
98
+ * automatic atomic object and atomic_init the run-time equivalent; neither is
99
+ * an atomic operation, so a plain store is the whole of it. */
100
+ #define ATOMIC_VAR_INIT(value) (value)
101
+ #define atomic_init(object, value) ((void)(*(object) = (value)))
102
+
103
+ /* kill_dependency (7.17.3.1): rubycc tracks no consume-order dependency chain
104
+ * (every operation is lowered at sequential consistency), so breaking one is
105
+ * the identity. */
106
+ #define kill_dependency(y) (y)
107
+
108
+ /* Fences (7.17.4). atomic_signal_fence only has to order against a signal
109
+ * handler on the same thread, which a full thread fence does as well, so both
110
+ * spellings emit the target's fence instruction. */
111
+ #define atomic_thread_fence(order) __atomic_thread_fence(order)
112
+ #define atomic_signal_fence(order) __atomic_thread_fence(order)
113
+
114
+ /* The generic operations (7.17.7). Each is a macro over the corresponding
115
+ * builtin, so it takes the object's type from its pointer argument the way
116
+ * C11's type-generic functions do. The non-_explicit spellings are the
117
+ * memory_order_seq_cst cases, which is what rubycc lowers every order to
118
+ * anyway. */
119
+ #define atomic_store_explicit(object, desired, order) \
120
+ __atomic_store_n((object), (desired), (order))
121
+ #define atomic_store(object, desired) \
122
+ __atomic_store_n((object), (desired), __ATOMIC_SEQ_CST)
123
+
124
+ #define atomic_load_explicit(object, order) __atomic_load_n((object), (order))
125
+ #define atomic_load(object) __atomic_load_n((object), __ATOMIC_SEQ_CST)
126
+
127
+ #define atomic_exchange_explicit(object, desired, order) \
128
+ __atomic_exchange_n((object), (desired), (order))
129
+ #define atomic_exchange(object, desired) \
130
+ __atomic_exchange_n((object), (desired), __ATOMIC_SEQ_CST)
131
+
132
+ /* The `weak` flag is the only thing separating the strong and weak forms; a
133
+ * strong compare-exchange never fails spuriously, so it satisfies the weak
134
+ * contract too and rubycc lowers both alike. The flag is still passed as
135
+ * written, so the two spellings stay distinguishable at the call site. */
136
+ #define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \
137
+ __atomic_compare_exchange_n((object), (expected), (desired), 0, (success), (failure))
138
+ #define atomic_compare_exchange_strong(object, expected, desired) \
139
+ __atomic_compare_exchange_n((object), (expected), (desired), 0, \
140
+ __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
141
+
142
+ #define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \
143
+ __atomic_compare_exchange_n((object), (expected), (desired), 1, (success), (failure))
144
+ #define atomic_compare_exchange_weak(object, expected, desired) \
145
+ __atomic_compare_exchange_n((object), (expected), (desired), 1, \
146
+ __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
147
+
148
+ #define atomic_fetch_add_explicit(object, operand, order) \
149
+ __atomic_fetch_add((object), (operand), (order))
150
+ #define atomic_fetch_add(object, operand) \
151
+ __atomic_fetch_add((object), (operand), __ATOMIC_SEQ_CST)
152
+
153
+ #define atomic_fetch_sub_explicit(object, operand, order) \
154
+ __atomic_fetch_sub((object), (operand), (order))
155
+ #define atomic_fetch_sub(object, operand) \
156
+ __atomic_fetch_sub((object), (operand), __ATOMIC_SEQ_CST)
157
+
158
+ #endif
data/include/stdbool.h ADDED
@@ -0,0 +1,15 @@
1
+ /* rubycc freestanding <stdbool.h>: boolean macros (ISO C 7.18).
2
+ rubycc targets C11, so bool/true/false are ordinary macros over _Bool. */
3
+
4
+ #ifndef _RUBYCC_STDBOOL_H
5
+ #define _RUBYCC_STDBOOL_H
6
+
7
+ #ifndef __cplusplus
8
+ #define bool _Bool
9
+ #define true 1
10
+ #define false 0
11
+ #endif
12
+
13
+ #define __bool_true_false_are_defined 1
14
+
15
+ #endif
@@ -0,0 +1,28 @@
1
+ /* rubycc freestanding <stdckdint.h>: checked integer arithmetic (ISO C23 7.20).
2
+ Compiler-supplied rather than libc-supplied, like <stdarg.h> and <stdbool.h>:
3
+ the ckd_* macros are type-generic over every integer type, which only the
4
+ compiler can express, so C23 makes the header the implementation's job.
5
+
6
+ rubycc ships it because an installed Ruby can force it on. Ruby's
7
+ <ruby/internal/stdckdint.h> includes this header whenever its config.h says
8
+ HAVE_STDCKDINT_H -- which is decided by whatever compiler built that Ruby, not
9
+ by rubycc -- and <ruby/internal/memory.h> then calls ckd_mul(). Without this
10
+ header such a Ruby's ruby.h does not preprocess at all under rubycc, which is
11
+ how the gap was found (docs/STEPS.md Step 175, on musl + Ruby 4.0).
12
+
13
+ The macros are one-liners over the overflow builtins added in Step 177: each
14
+ computes its operands' product/sum/difference in infinite precision, stores
15
+ the result converted to *r, and answers whether that conversion lost the
16
+ value. Note the argument order differs from the builtins' -- C23 puts the
17
+ result pointer first. */
18
+
19
+ #ifndef _RUBYCC_STDCKDINT_H
20
+ #define _RUBYCC_STDCKDINT_H
21
+
22
+ #define __STDC_VERSION_STDCKDINT_H__ 202311L
23
+
24
+ #define ckd_add(r, a, b) ((_Bool)__builtin_add_overflow((a), (b), (r)))
25
+ #define ckd_sub(r, a, b) ((_Bool)__builtin_sub_overflow((a), (b), (r)))
26
+ #define ckd_mul(r, a, b) ((_Bool)__builtin_mul_overflow((a), (b), (r)))
27
+
28
+ #endif
data/include/stddef.h ADDED
@@ -0,0 +1,60 @@
1
+ /* rubycc freestanding <stddef.h>: common definitions (ISO C 7.19).
2
+ Types are fixed for the x86-64 System V LP64 target. The __need_* guards
3
+ honor the glibc partial-include protocol (a header pulling in only NULL or
4
+ size_t rather than the whole file). */
5
+
6
+ #if defined __need_NULL || defined __need_size_t || defined __need_wchar_t || defined __need_ptrdiff_t
7
+ #if defined __need_NULL
8
+ #ifndef NULL
9
+ #define NULL ((void*)0)
10
+ #endif
11
+ #undef __need_NULL
12
+ #endif
13
+ #if defined __need_size_t
14
+ #ifndef _RUBYCC_SIZE_T
15
+ #define _RUBYCC_SIZE_T
16
+ typedef unsigned long size_t;
17
+ #endif
18
+ #undef __need_size_t
19
+ #endif
20
+ #if defined __need_wchar_t
21
+ #ifndef _RUBYCC_WCHAR_T
22
+ #define _RUBYCC_WCHAR_T
23
+ typedef int wchar_t;
24
+ #endif
25
+ #undef __need_wchar_t
26
+ #endif
27
+ #if defined __need_ptrdiff_t
28
+ #ifndef _RUBYCC_PTRDIFF_T
29
+ #define _RUBYCC_PTRDIFF_T
30
+ typedef long ptrdiff_t;
31
+ #endif
32
+ #undef __need_ptrdiff_t
33
+ #endif
34
+ #else
35
+ #ifndef _RUBYCC_STDDEF_H
36
+ #define _RUBYCC_STDDEF_H
37
+ #ifndef _RUBYCC_SIZE_T
38
+ #define _RUBYCC_SIZE_T
39
+ typedef unsigned long size_t;
40
+ #endif
41
+ #ifndef _RUBYCC_PTRDIFF_T
42
+ #define _RUBYCC_PTRDIFF_T
43
+ typedef long ptrdiff_t;
44
+ #endif
45
+ #ifndef _RUBYCC_WCHAR_T
46
+ #define _RUBYCC_WCHAR_T
47
+ typedef int wchar_t;
48
+ #endif
49
+ #ifndef NULL
50
+ #define NULL ((void*)0)
51
+ #endif
52
+ /* Folds to a size_t constant via __builtin_offsetof, so it holds in a
53
+ constant-expression context (a static initializer, an array bound, a case
54
+ label) as well as at run time — unlike the traditional address-of-member
55
+ form "((size_t)&(((t*)0)->m))", which rubycc's constant evaluator cannot
56
+ fold. */
57
+ #define offsetof(t, m) __builtin_offsetof(t, m)
58
+ typedef struct { long long __ll; long double __ld; } max_align_t;
59
+ #endif
60
+ #endif
@@ -0,0 +1,18 @@
1
+ /* rubycc freestanding <stdnoreturn.h>: the _Noreturn convenience macro
2
+ (ISO C 7.23).
3
+
4
+ This header used to expand `noreturn` to nothing, because rubycc did not
5
+ accept the _Noreturn function specifier and dropping an optimization hint
6
+ changes no observable behavior. That workaround only ever covered code that
7
+ reached the specifier through this header: musl's own <stdlib.h> writes the
8
+ bare keyword (`_Noreturn void abort (void);`), so on a musl host rubycc
9
+ stopped there and ruby.h did not preprocess at all -- measured in CI, see
10
+ docs/STEPS.md Step 181. rubycc accepts the specifier itself as of Step 182,
11
+ so the macro is now the plain C11 definition. */
12
+
13
+ #ifndef _RUBYCC_STDNORETURN_H
14
+ #define _RUBYCC_STDNORETURN_H
15
+
16
+ #define noreturn _Noreturn
17
+
18
+ #endif
@@ -0,0 +1,16 @@
1
+ /* rubycc freestanding <x86intrin.h>: an intentionally empty stub.
2
+
3
+ CRuby's config.h bakes in HAVE_X86INTRIN_H (it was probed with gcc), so
4
+ headers such as json's vendored fast_float parser include <x86intrin.h>
5
+ unconditionally on x86-64. rubycc, however, provides no SIMD intrinsics.
6
+
7
+ This is safe because every actual use of an intrinsic behind such an include
8
+ is itself guarded by a target-feature macro (__AVX2__, __LZCNT__, __SSE4_2__
9
+ and the like), and rubycc defines none of those. With the feature macros
10
+ undefined, the intrinsic bodies are never reached, so an empty header
11
+ satisfies the include without pulling in declarations rubycc cannot honor. */
12
+
13
+ #ifndef _RUBYCC_X86INTRIN_H
14
+ #define _RUBYCC_X86INTRIN_H
15
+
16
+ #endif /* _RUBYCC_X86INTRIN_H */