extpp 0.0.9 → 0.1.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.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +2 -2
- data/Rakefile +1 -28
- data/doc/text/news.md +6 -0
- data/include/ruby/class.hpp +191 -14
- data/{ext/extpp → include/ruby}/function.hpp +20 -7
- data/include/ruby/object.hpp +45 -6
- data/include/ruby/protect.hpp +9 -2
- data/include/ruby.hpp +0 -10
- data/lib/extpp/setup.rb +0 -4
- data/lib/extpp/version.rb +1 -1
- data/lib/extpp.rb +0 -12
- metadata +6 -73
- data/ext/extpp/class.cpp +0 -277
- data/ext/extpp/extconf.rb +0 -110
- data/ext/extpp/function.cpp +0 -28
- data/ext/extpp/object.cpp +0 -48
- data/ext/extpp/protect.cpp +0 -12
- data/lib/extpp/platform.rb +0 -8
- data/test/fixtures/cast/Makefile +0 -269
- data/test/fixtures/cast/cast.cpp +0 -39
- data/test/fixtures/cast/cast.o +0 -0
- data/test/fixtures/cast/cast.so +0 -0
- data/test/fixtures/cast/extconf.rb +0 -4
- data/test/fixtures/cast/mkmf.log +0 -144
- data/test/fixtures/class/Makefile +0 -269
- data/test/fixtures/class/class.cpp +0 -46
- data/test/fixtures/class/class.o +0 -0
- data/test/fixtures/class/class.so +0 -0
- data/test/fixtures/class/extconf.rb +0 -4
- data/test/fixtures/class/mkmf.log +0 -144
- data/test/fixtures/object/Makefile +0 -269
- data/test/fixtures/object/extconf.rb +0 -4
- data/test/fixtures/object/mkmf.log +0 -144
- data/test/fixtures/object/object.cpp +0 -102
- data/test/fixtures/object/object.o +0 -0
- data/test/fixtures/object/object.so +0 -0
- data/test/fixtures/protect/Makefile +0 -269
- data/test/fixtures/protect/extconf.rb +0 -4
- data/test/fixtures/protect/mkmf.log +0 -144
- data/test/fixtures/protect/protect.cpp +0 -70
- data/test/fixtures/protect/protect.o +0 -0
- data/test/fixtures/protect/protect.so +0 -0
- data/test/helper.rb +0 -11
- data/test/run-test.rb +0 -31
- data/test/test-cast.rb +0 -46
- data/test/test-class.rb +0 -47
- data/test/test-object.rb +0 -68
- data/test/test-protect.rb +0 -54
@@ -1,269 +0,0 @@
|
|
1
|
-
|
2
|
-
SHELL = /bin/sh
|
3
|
-
|
4
|
-
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
-
V = 0
|
6
|
-
Q1 = $(V:1=)
|
7
|
-
Q = $(Q1:0=@)
|
8
|
-
ECHO1 = $(V:1=@ :)
|
9
|
-
ECHO = $(ECHO1:0=@ echo)
|
10
|
-
NULLCMD = :
|
11
|
-
|
12
|
-
#### Start of system configuration section. ####
|
13
|
-
|
14
|
-
srcdir = .
|
15
|
-
topdir = /tmp/local/include/ruby-2.7.0
|
16
|
-
hdrdir = $(topdir)
|
17
|
-
arch_hdrdir = /tmp/local/include/ruby-2.7.0/x86_64-linux
|
18
|
-
PATH_SEPARATOR = :
|
19
|
-
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
20
|
-
prefix = $(DESTDIR)/tmp/local
|
21
|
-
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
22
|
-
rubyarchprefix = $(rubylibprefix)/$(arch)
|
23
|
-
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
24
|
-
exec_prefix = $(prefix)
|
25
|
-
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
26
|
-
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
27
|
-
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
28
|
-
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
29
|
-
sitehdrdir = $(rubyhdrdir)/site_ruby
|
30
|
-
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
31
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
32
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
33
|
-
vendordir = $(rubylibprefix)/vendor_ruby
|
34
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
35
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
36
|
-
sitedir = $(rubylibprefix)/site_ruby
|
37
|
-
rubyarchdir = $(rubylibdir)/$(arch)
|
38
|
-
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
39
|
-
sitearchincludedir = $(includedir)/$(sitearch)
|
40
|
-
archincludedir = $(includedir)/$(arch)
|
41
|
-
sitearchlibdir = $(libdir)/$(sitearch)
|
42
|
-
archlibdir = $(libdir)/$(arch)
|
43
|
-
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
44
|
-
mandir = $(datarootdir)/man
|
45
|
-
localedir = $(datarootdir)/locale
|
46
|
-
libdir = $(exec_prefix)/lib
|
47
|
-
psdir = $(docdir)
|
48
|
-
pdfdir = $(docdir)
|
49
|
-
dvidir = $(docdir)
|
50
|
-
htmldir = $(docdir)
|
51
|
-
infodir = $(datarootdir)/info
|
52
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
53
|
-
oldincludedir = $(DESTDIR)/usr/include
|
54
|
-
includedir = $(prefix)/include
|
55
|
-
runstatedir = $(localstatedir)/run
|
56
|
-
localstatedir = $(prefix)/var
|
57
|
-
sharedstatedir = $(prefix)/com
|
58
|
-
sysconfdir = $(prefix)/etc
|
59
|
-
datadir = $(datarootdir)
|
60
|
-
datarootdir = $(prefix)/share
|
61
|
-
libexecdir = $(exec_prefix)/libexec
|
62
|
-
sbindir = $(exec_prefix)/sbin
|
63
|
-
bindir = $(exec_prefix)/bin
|
64
|
-
archdir = $(rubyarchdir)
|
65
|
-
|
66
|
-
|
67
|
-
CC_WRAPPER =
|
68
|
-
CC = gcc
|
69
|
-
CXX = g++
|
70
|
-
LIBRUBY = $(LIBRUBY_SO)
|
71
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
72
|
-
LIBRUBYARG_SHARED = -Wl,-rpath,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)
|
73
|
-
LIBRUBYARG_STATIC = -Wl,-rpath,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static $(MAINLIBS)
|
74
|
-
empty =
|
75
|
-
OUTFLAG = -o $(empty)
|
76
|
-
COUTFLAG = -o $(empty)
|
77
|
-
CSRCFLAG = $(empty)
|
78
|
-
|
79
|
-
RUBY_EXTCONF_H =
|
80
|
-
cflags = $(optflags) $(debugflags) $(warnflags)
|
81
|
-
cxxflags = $(optflags) $(debugflags) $(warnflags)
|
82
|
-
optflags = -O3 -march=native
|
83
|
-
debugflags = -ggdb3
|
84
|
-
warnflags = -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable
|
85
|
-
cppflags =
|
86
|
-
CCDLFLAGS = -fPIC
|
87
|
-
CFLAGS = $(CCDLFLAGS) $(cflags) -fPIC $(ARCH_FLAG)
|
88
|
-
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I/home/kou/work/ruby/extpp/include
|
89
|
-
DEFS =
|
90
|
-
CPPFLAGS = $(DEFS) $(cppflags)
|
91
|
-
CXXFLAGS = $(CCDLFLAGS) -O3 -march\=native -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough\=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute\=format -Wsuggest-attribute\=noreturn -Wunused-variable $(ARCH_FLAG)
|
92
|
-
ldflags = -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic
|
93
|
-
dldflags = -Wl,--compress-debug-sections=zlib
|
94
|
-
ARCH_FLAG =
|
95
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
96
|
-
LDSHARED = $(CC) -shared
|
97
|
-
LDSHAREDXX = $(CXX) -shared
|
98
|
-
AR = ar
|
99
|
-
EXEEXT =
|
100
|
-
|
101
|
-
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
102
|
-
RUBY_SO_NAME = ruby
|
103
|
-
RUBYW_INSTALL_NAME =
|
104
|
-
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
105
|
-
RUBYW_BASE_NAME = rubyw
|
106
|
-
RUBY_BASE_NAME = ruby
|
107
|
-
|
108
|
-
arch = x86_64-linux
|
109
|
-
sitearch = $(arch)
|
110
|
-
ruby_version = 2.7.0
|
111
|
-
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
112
|
-
RUBY = $(ruby)
|
113
|
-
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
|
114
|
-
|
115
|
-
RM = rm -f
|
116
|
-
RM_RF = $(RUBY) -run -e rm -- -rf
|
117
|
-
RMDIRS = rmdir --ignore-fail-on-non-empty -p
|
118
|
-
MAKEDIRS = /bin/mkdir -p
|
119
|
-
INSTALL = /usr/bin/install -c
|
120
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
121
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
122
|
-
COPY = cp
|
123
|
-
TOUCH = exit >
|
124
|
-
|
125
|
-
#### End of system configuration section. ####
|
126
|
-
|
127
|
-
preload =
|
128
|
-
libpath = . $(libdir)
|
129
|
-
LIBPATH = -L. -L$(libdir) -Wl,-rpath,$(libdir)
|
130
|
-
DEFFILE =
|
131
|
-
|
132
|
-
CLEANFILES = mkmf.log
|
133
|
-
DISTCLEANFILES =
|
134
|
-
DISTCLEANDIRS =
|
135
|
-
|
136
|
-
extout =
|
137
|
-
extout_prefix =
|
138
|
-
target_prefix =
|
139
|
-
LOCAL_LIBS =
|
140
|
-
LIBS = $(LIBRUBYARG_SHARED) -lm -lc /home/kou/work/ruby/extpp/ext/extpp/libruby-extpp.so
|
141
|
-
ORIG_SRCS = protect.cpp
|
142
|
-
SRCS = $(ORIG_SRCS)
|
143
|
-
OBJS = protect.o
|
144
|
-
HDRS =
|
145
|
-
LOCAL_HDRS =
|
146
|
-
TARGET = protect
|
147
|
-
TARGET_NAME = protect
|
148
|
-
TARGET_ENTRY = Init_$(TARGET_NAME)
|
149
|
-
DLLIB = $(TARGET).so
|
150
|
-
EXTSTATIC =
|
151
|
-
STATIC_LIB =
|
152
|
-
|
153
|
-
TIMESTAMP_DIR = .
|
154
|
-
BINDIR = $(bindir)
|
155
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
156
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
157
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
158
|
-
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
159
|
-
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
160
|
-
TARGET_SO_DIR =
|
161
|
-
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
162
|
-
CLEANLIBS = $(TARGET_SO)
|
163
|
-
CLEANOBJS = *.o *.bak
|
164
|
-
|
165
|
-
all: $(DLLIB)
|
166
|
-
static: $(STATIC_LIB)
|
167
|
-
.PHONY: all install static install-so install-rb
|
168
|
-
.PHONY: clean clean-so clean-static clean-rb
|
169
|
-
|
170
|
-
clean-static::
|
171
|
-
clean-rb-default::
|
172
|
-
clean-rb::
|
173
|
-
clean-so::
|
174
|
-
clean: clean-so clean-static clean-rb-default clean-rb
|
175
|
-
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
176
|
-
|
177
|
-
distclean-rb-default::
|
178
|
-
distclean-rb::
|
179
|
-
distclean-so::
|
180
|
-
distclean-static::
|
181
|
-
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
182
|
-
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
183
|
-
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
184
|
-
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
185
|
-
|
186
|
-
realclean: distclean
|
187
|
-
install: install-so install-rb
|
188
|
-
|
189
|
-
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
|
190
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
191
|
-
clean-static::
|
192
|
-
-$(Q)$(RM) $(STATIC_LIB)
|
193
|
-
install-rb: pre-install-rb do-install-rb install-rb-default
|
194
|
-
install-rb-default: pre-install-rb-default do-install-rb-default
|
195
|
-
pre-install-rb: Makefile
|
196
|
-
pre-install-rb-default: Makefile
|
197
|
-
do-install-rb:
|
198
|
-
do-install-rb-default:
|
199
|
-
pre-install-rb-default:
|
200
|
-
@$(NULLCMD)
|
201
|
-
$(TIMESTAMP_DIR)/.sitearchdir.time:
|
202
|
-
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
203
|
-
$(Q) $(TOUCH) $@
|
204
|
-
|
205
|
-
site-install: site-install-so site-install-rb
|
206
|
-
site-install-so: install-so
|
207
|
-
site-install-rb: install-rb
|
208
|
-
|
209
|
-
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
210
|
-
|
211
|
-
.cc.o:
|
212
|
-
$(ECHO) compiling $(<)
|
213
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
214
|
-
|
215
|
-
.cc.S:
|
216
|
-
$(ECHO) translating $(<)
|
217
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
218
|
-
|
219
|
-
.mm.o:
|
220
|
-
$(ECHO) compiling $(<)
|
221
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
222
|
-
|
223
|
-
.mm.S:
|
224
|
-
$(ECHO) translating $(<)
|
225
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
226
|
-
|
227
|
-
.cxx.o:
|
228
|
-
$(ECHO) compiling $(<)
|
229
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
230
|
-
|
231
|
-
.cxx.S:
|
232
|
-
$(ECHO) translating $(<)
|
233
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
234
|
-
|
235
|
-
.cpp.o:
|
236
|
-
$(ECHO) compiling $(<)
|
237
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
238
|
-
|
239
|
-
.cpp.S:
|
240
|
-
$(ECHO) translating $(<)
|
241
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
242
|
-
|
243
|
-
.c.o:
|
244
|
-
$(ECHO) compiling $(<)
|
245
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
246
|
-
|
247
|
-
.c.S:
|
248
|
-
$(ECHO) translating $(<)
|
249
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
250
|
-
|
251
|
-
.m.o:
|
252
|
-
$(ECHO) compiling $(<)
|
253
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
254
|
-
|
255
|
-
.m.S:
|
256
|
-
$(ECHO) translating $(<)
|
257
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
258
|
-
|
259
|
-
$(TARGET_SO): $(OBJS) Makefile
|
260
|
-
$(ECHO) linking shared-object $(DLLIB)
|
261
|
-
-$(Q)$(RM) $(@)
|
262
|
-
$(Q) $(LDSHAREDXX) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
$(OBJS): $(HDRS) $(ruby_headers)
|
267
|
-
|
268
|
-
extpp_headers = /home/kou/work/ruby/extpp/include/ruby/object.hpp /home/kou/work/ruby/extpp/include/ruby/class.hpp /home/kou/work/ruby/extpp/include/ruby/protect.hpp /home/kou/work/ruby/extpp/include/ruby/cast.hpp /home/kou/work/ruby/extpp/include/ruby/type.hpp /home/kou/work/ruby/extpp/include/ruby.hpp
|
269
|
-
$(OBJS): $(extpp_headers)
|
@@ -1,144 +0,0 @@
|
|
1
|
-
check_debug_build: checking --enable-debug-build option... -------------------- no
|
2
|
-
|
3
|
-
--------------------
|
4
|
-
|
5
|
-
check_cxx: checking C++ compiler... -------------------- g++
|
6
|
-
|
7
|
-
--------------------
|
8
|
-
|
9
|
-
check_version: checking g++ version... -------------------- 8.3
|
10
|
-
|
11
|
-
--------------------
|
12
|
-
|
13
|
-
"g++ -Werror -Wall -c conftest.cpp"
|
14
|
-
checked program was:
|
15
|
-
/* begin */
|
16
|
-
1: int main(void) {return 0;}/* end */
|
17
|
-
|
18
|
-
"g++ -Werror -Wextra -c conftest.cpp"
|
19
|
-
checked program was:
|
20
|
-
/* begin */
|
21
|
-
1: int main(void) {return 0;}/* end */
|
22
|
-
|
23
|
-
"g++ -Werror -Wdeprecated-declarations -c conftest.cpp"
|
24
|
-
checked program was:
|
25
|
-
/* begin */
|
26
|
-
1: int main(void) {return 0;}/* end */
|
27
|
-
|
28
|
-
"g++ -Werror -Wduplicated-cond -c conftest.cpp"
|
29
|
-
checked program was:
|
30
|
-
/* begin */
|
31
|
-
1: int main(void) {return 0;}/* end */
|
32
|
-
|
33
|
-
"g++ -Werror -Wimplicit-function-declaration -c conftest.cpp"
|
34
|
-
cc1plus: error: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [-Werror]
|
35
|
-
cc1plus: all warnings being treated as errors
|
36
|
-
checked program was:
|
37
|
-
/* begin */
|
38
|
-
1: int main(void) {return 0;}/* end */
|
39
|
-
|
40
|
-
"g++ -Werror -Wimplicit-int -c conftest.cpp"
|
41
|
-
cc1plus: error: command line option ‘-Wimplicit-int’ is valid for C/ObjC but not for C++ [-Werror]
|
42
|
-
cc1plus: all warnings being treated as errors
|
43
|
-
checked program was:
|
44
|
-
/* begin */
|
45
|
-
1: int main(void) {return 0;}/* end */
|
46
|
-
|
47
|
-
"g++ -Werror -Wmisleading-indentation -c conftest.cpp"
|
48
|
-
checked program was:
|
49
|
-
/* begin */
|
50
|
-
1: int main(void) {return 0;}/* end */
|
51
|
-
|
52
|
-
"g++ -Werror -Wpointer-arith -c conftest.cpp"
|
53
|
-
checked program was:
|
54
|
-
/* begin */
|
55
|
-
1: int main(void) {return 0;}/* end */
|
56
|
-
|
57
|
-
"g++ -Werror -Wwrite-strings -c conftest.cpp"
|
58
|
-
checked program was:
|
59
|
-
/* begin */
|
60
|
-
1: int main(void) {return 0;}/* end */
|
61
|
-
|
62
|
-
"g++ -Werror -Wimplicit-fallthrough=0 -c conftest.cpp"
|
63
|
-
checked program was:
|
64
|
-
/* begin */
|
65
|
-
1: int main(void) {return 0;}/* end */
|
66
|
-
|
67
|
-
"g++ -Werror -Wmissing-noreturn -c conftest.cpp"
|
68
|
-
checked program was:
|
69
|
-
/* begin */
|
70
|
-
1: int main(void) {return 0;}/* end */
|
71
|
-
|
72
|
-
"g++ -Werror -Wcast-function-type -c conftest.cpp"
|
73
|
-
checked program was:
|
74
|
-
/* begin */
|
75
|
-
1: int main(void) {return 0;}/* end */
|
76
|
-
|
77
|
-
"g++ -Werror -Wconstant-logical-operand -c conftest.cpp"
|
78
|
-
g++: error: unrecognized command line option ‘-Wconstant-logical-operand’; did you mean ‘-Wno-tautological-compare’?
|
79
|
-
checked program was:
|
80
|
-
/* begin */
|
81
|
-
1: int main(void) {return 0;}/* end */
|
82
|
-
|
83
|
-
"g++ -Werror -Wlong-long -c conftest.cpp"
|
84
|
-
checked program was:
|
85
|
-
/* begin */
|
86
|
-
1: int main(void) {return 0;}/* end */
|
87
|
-
|
88
|
-
"g++ -Werror -Wmissing-field-initializers -c conftest.cpp"
|
89
|
-
checked program was:
|
90
|
-
/* begin */
|
91
|
-
1: int main(void) {return 0;}/* end */
|
92
|
-
|
93
|
-
"g++ -Werror -Woverlength-strings -c conftest.cpp"
|
94
|
-
checked program was:
|
95
|
-
/* begin */
|
96
|
-
1: int main(void) {return 0;}/* end */
|
97
|
-
|
98
|
-
"g++ -Werror -Wpacked-bitfield-compat -c conftest.cpp"
|
99
|
-
checked program was:
|
100
|
-
/* begin */
|
101
|
-
1: int main(void) {return 0;}/* end */
|
102
|
-
|
103
|
-
"g++ -Werror -Wparentheses-equality -c conftest.cpp"
|
104
|
-
g++: error: unrecognized command line option ‘-Wparentheses-equality’; did you mean ‘-Wparentheses’?
|
105
|
-
checked program was:
|
106
|
-
/* begin */
|
107
|
-
1: int main(void) {return 0;}/* end */
|
108
|
-
|
109
|
-
"g++ -Werror -Wself-assign -c conftest.cpp"
|
110
|
-
g++: error: unrecognized command line option ‘-Wself-assign’; did you mean ‘-Wcast-align’?
|
111
|
-
checked program was:
|
112
|
-
/* begin */
|
113
|
-
1: int main(void) {return 0;}/* end */
|
114
|
-
|
115
|
-
"g++ -Werror -Wtautological-compare -c conftest.cpp"
|
116
|
-
checked program was:
|
117
|
-
/* begin */
|
118
|
-
1: int main(void) {return 0;}/* end */
|
119
|
-
|
120
|
-
"g++ -Werror -Wunused-parameter -c conftest.cpp"
|
121
|
-
checked program was:
|
122
|
-
/* begin */
|
123
|
-
1: int main(void) {return 0;}/* end */
|
124
|
-
|
125
|
-
"g++ -Werror -Wunused-value -c conftest.cpp"
|
126
|
-
checked program was:
|
127
|
-
/* begin */
|
128
|
-
1: int main(void) {return 0;}/* end */
|
129
|
-
|
130
|
-
"g++ -Werror -Wsuggest-attribute=format -c conftest.cpp"
|
131
|
-
checked program was:
|
132
|
-
/* begin */
|
133
|
-
1: int main(void) {return 0;}/* end */
|
134
|
-
|
135
|
-
"g++ -Werror -Wsuggest-attribute=noreturn -c conftest.cpp"
|
136
|
-
checked program was:
|
137
|
-
/* begin */
|
138
|
-
1: int main(void) {return 0;}/* end */
|
139
|
-
|
140
|
-
"g++ -Werror -Wunused-variable -c conftest.cpp"
|
141
|
-
checked program was:
|
142
|
-
/* begin */
|
143
|
-
1: int main(void) {return 0;}/* end */
|
144
|
-
|
@@ -1,70 +0,0 @@
|
|
1
|
-
#include <ruby.hpp>
|
2
|
-
|
3
|
-
namespace {
|
4
|
-
class Notifier {
|
5
|
-
public:
|
6
|
-
Notifier(std::string prefix, rb::Object listener) :
|
7
|
-
prefix_(prefix),
|
8
|
-
listener_(listener) {
|
9
|
-
notify("constructed");
|
10
|
-
}
|
11
|
-
|
12
|
-
~Notifier() {
|
13
|
-
notify("destructed");
|
14
|
-
}
|
15
|
-
|
16
|
-
void notify(const char* name) {
|
17
|
-
auto event = prefix_ + name;
|
18
|
-
auto x = rb::Object(rb_str_new(event.data(), event.size()));
|
19
|
-
listener_.send("notify", {x});
|
20
|
-
}
|
21
|
-
|
22
|
-
private:
|
23
|
-
std::string prefix_;
|
24
|
-
rb::Object listener_;
|
25
|
-
};
|
26
|
-
};
|
27
|
-
|
28
|
-
extern "C" void
|
29
|
-
Init_protect(void)
|
30
|
-
{
|
31
|
-
rb::Class klass("ProtectMethods");
|
32
|
-
klass.define_method("protect_raw", [](int argc, VALUE *argv, VALUE self) {
|
33
|
-
VALUE rb_listener;
|
34
|
-
VALUE rb_block;
|
35
|
-
rb_scan_args(argc, argv, "1&", &rb_listener, &rb_block);
|
36
|
-
Notifier outer("outer: ", rb::Object(rb_listener));
|
37
|
-
try {
|
38
|
-
Notifier inner("inner: ", rb::Object(rb_listener));
|
39
|
-
rb::protect(
|
40
|
-
[](VALUE rb_block) -> VALUE {
|
41
|
-
return rb::Object(rb_block).send("call");
|
42
|
-
},
|
43
|
-
rb_block);
|
44
|
-
inner.notify("called");
|
45
|
-
} catch (rb::State& state) {
|
46
|
-
outer.notify("caught");
|
47
|
-
state.jump();
|
48
|
-
}
|
49
|
-
outer.notify("jumped");
|
50
|
-
return Qnil;
|
51
|
-
});
|
52
|
-
klass.define_method("protect_closure", [](int argc, VALUE *argv, VALUE self) {
|
53
|
-
VALUE rb_listener;
|
54
|
-
VALUE rb_block;
|
55
|
-
rb_scan_args(argc, argv, "1&", &rb_listener, &rb_block);
|
56
|
-
Notifier outer("outer: ", rb::Object(rb_listener));
|
57
|
-
try {
|
58
|
-
Notifier inner("inner: ", rb::Object(rb_listener));
|
59
|
-
rb::protect([&rb_block]() -> VALUE {
|
60
|
-
return rb::Object(rb_block).send("call");
|
61
|
-
});
|
62
|
-
inner.notify("called");
|
63
|
-
} catch (rb::State& state) {
|
64
|
-
outer.notify("caught");
|
65
|
-
state.jump();
|
66
|
-
}
|
67
|
-
outer.notify("jumped");
|
68
|
-
return Qnil;
|
69
|
-
});
|
70
|
-
}
|
Binary file
|
Binary file
|
data/test/helper.rb
DELETED
data/test/run-test.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$VERBOSE = true
|
4
|
-
|
5
|
-
require "pathname"
|
6
|
-
|
7
|
-
base_dir = Pathname.new(__dir__).parent.expand_path
|
8
|
-
|
9
|
-
ext_dir = base_dir + "ext" + "extpp"
|
10
|
-
lib_dir = base_dir + "lib"
|
11
|
-
test_dir = base_dir + "test"
|
12
|
-
|
13
|
-
make = nil
|
14
|
-
if system("which gmake > #{File::NULL} 2>&1")
|
15
|
-
make = "gmake"
|
16
|
-
elsif system("which make > #{File::NULL} 2>&1")
|
17
|
-
make = "make"
|
18
|
-
end
|
19
|
-
if make
|
20
|
-
Dir.chdir(ext_dir.to_s) do
|
21
|
-
if File.exist?("Makefile")
|
22
|
-
system("#{make} > #{File::NULL}") or exit(false)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
$LOAD_PATH.unshift(lib_dir.to_s)
|
28
|
-
|
29
|
-
require_relative "helper"
|
30
|
-
|
31
|
-
exit(Test::Unit::AutoRunner.run(true, test_dir.to_s))
|
data/test/test-cast.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
class CastTest < Test::Unit::TestCase
|
2
|
-
extend Helper::Fixture
|
3
|
-
|
4
|
-
class << self
|
5
|
-
def startup
|
6
|
-
lib_dir = File.join(__dir__, "..", "lib")
|
7
|
-
Dir.chdir(fixture_path("cast")) do
|
8
|
-
system(RbConfig.ruby, "-w", "-I", lib_dir, "extconf.rb")
|
9
|
-
system("make")
|
10
|
-
end
|
11
|
-
require fixture_path("cast", "cast")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def setup
|
16
|
-
@caster = Caster.new
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_int32
|
20
|
-
assert_equal(-(2 ** 31),
|
21
|
-
@caster.cast_int32(-(2 ** 31)))
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_int64
|
25
|
-
assert_equal(-(2 ** 63),
|
26
|
-
@caster.cast_int64(-(2 ** 63)))
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_uint32
|
30
|
-
assert_equal(2 ** 32 - 1,
|
31
|
-
@caster.cast_uint32(2 ** 32 - 1))
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_uint64
|
35
|
-
assert_equal(2 ** 64 - 1,
|
36
|
-
@caster.cast_uint64(2 ** 64 - 1))
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_string
|
40
|
-
assert_equal("Hello", @caster.cast_string("Hello"))
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_std_string
|
44
|
-
assert_equal("Hello", @caster.cast_std_string("Hello"))
|
45
|
-
end
|
46
|
-
end
|
data/test/test-class.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
class ClassTest < Test::Unit::TestCase
|
2
|
-
extend Helper::Fixture
|
3
|
-
|
4
|
-
class << self
|
5
|
-
def startup
|
6
|
-
return unless self == ClassTest
|
7
|
-
lib_dir = File.join(__dir__, "..", "lib")
|
8
|
-
Dir.chdir(fixture_path("class")) do
|
9
|
-
system(RbConfig.ruby, "-w", "-I", lib_dir, "extconf.rb")
|
10
|
-
system("make")
|
11
|
-
end
|
12
|
-
require fixture_path("class", "class")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
sub_test_case("no argument") do
|
17
|
-
def test_define_method
|
18
|
-
assert_equal("Hello", Greeting.new.hello)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_define_method_lazy
|
22
|
-
assert_equal("Hello", Greeting.new.hello_lazy)
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_define_method_defined
|
26
|
-
assert_equal("Hello", Greeting.new.hello_defined)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
sub_test_case("with arguments") do
|
31
|
-
def test_define_method
|
32
|
-
assert_equal("Hello Ruby", NamedGreeting.new.hello("Ruby"))
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_define_method_compatible
|
36
|
-
assert_equal("Hello Ruby", NamedGreeting.new.hello_compatible("Ruby"))
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_define_method_lazy
|
40
|
-
assert_equal("Hello Ruby", NamedGreeting.new.hello_lazy("Ruby"))
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_define_method_defined
|
44
|
-
assert_equal("Hello Ruby", NamedGreeting.new.hello_defined("Ruby"))
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
data/test/test-object.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
class ObjectTest < Test::Unit::TestCase
|
2
|
-
extend Helper::Fixture
|
3
|
-
|
4
|
-
class << self
|
5
|
-
def startup
|
6
|
-
return unless self == ObjectTest
|
7
|
-
lib_dir = File.join(__dir__, "..", "lib")
|
8
|
-
Dir.chdir(fixture_path("object")) do
|
9
|
-
system(RbConfig.ruby, "-w", "-I", lib_dir, "extconf.rb")
|
10
|
-
system("make")
|
11
|
-
end
|
12
|
-
require fixture_path("object", "object")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
sub_test_case("to_bool") do
|
17
|
-
def test_true
|
18
|
-
assert_equal(true, ObjectMethods.new.to_bool_true)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_false
|
22
|
-
assert_equal(false, ObjectMethods.new.to_bool_false)
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_nil
|
26
|
-
assert_equal(false, ObjectMethods.new.to_bool_nil)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_to_ruby
|
31
|
-
assert_equal("Hello", ObjectMethods.new.to_ruby("Hello"))
|
32
|
-
end
|
33
|
-
|
34
|
-
sub_test_case("send") do
|
35
|
-
def test_no_arguments
|
36
|
-
assert_equal("1", ObjectMethods.new.send_no_arguments(1, "to_s"))
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_two_arguments
|
40
|
-
assert_equal("ell",
|
41
|
-
ObjectMethods.new.send_two_arguments("hello",
|
42
|
-
"[]",
|
43
|
-
1,
|
44
|
-
3))
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_block
|
48
|
-
assert_equal([1, 4, 9],
|
49
|
-
ObjectMethods.new.send_block([1, 2, 3], "collect"))
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
sub_test_case("instance variable") do
|
54
|
-
def test_set
|
55
|
-
object = Object.new
|
56
|
-
methods = ObjectMethods.new
|
57
|
-
assert_equal("me", methods.ivar_set(object, "@name", "me"))
|
58
|
-
assert_equal("me", object.instance_variable_get("@name"))
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_get
|
62
|
-
object = Object.new
|
63
|
-
object.instance_variable_set("@name", "me")
|
64
|
-
methods = ObjectMethods.new
|
65
|
-
assert_equal("me", methods.ivar_get(object, "@name"))
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|