1 | Index: MANIFEST |
---|
2 | =================================================================== |
---|
3 | --- MANIFEST (revision 41543) |
---|
4 | +++ MANIFEST (working copy) |
---|
5 | @@ -1,7 +1,7 @@ |
---|
6 | # ex: set ro: |
---|
7 | # $Id$ |
---|
8 | # |
---|
9 | -# generated by tools/dev/mk_manifest_and_skip.pl Sat Sep 19 08:24:23 2009 UT |
---|
10 | +# generated by tools/dev/mk_manifest_and_skip.pl Tue Sep 29 01:34:44 2009 UT |
---|
11 | # |
---|
12 | # See below for documentation on the format of this file. |
---|
13 | # |
---|
14 | @@ -236,8 +236,6 @@ |
---|
15 | config/auto/frames/test_exec_cygwin_c.in [] |
---|
16 | config/auto/frames/test_exec_linux_c.in [] |
---|
17 | config/auto/frames/test_exec_openbsd_c.in [] |
---|
18 | -config/auto/funcptr.pm [] |
---|
19 | -config/auto/funcptr/test_c.in [] |
---|
20 | config/auto/gc.pm [] |
---|
21 | config/auto/gc/test_c.in [] |
---|
22 | config/auto/gcc.pm [] |
---|
23 | @@ -1922,7 +1920,6 @@ |
---|
24 | t/steps/auto/env-01.t [test] |
---|
25 | t/steps/auto/format-01.t [test] |
---|
26 | t/steps/auto/frames-01.t [test] |
---|
27 | -t/steps/auto/funcptr-01.t [test] |
---|
28 | t/steps/auto/gc-01.t [test] |
---|
29 | t/steps/auto/gcc-01.t [test] |
---|
30 | t/steps/auto/gdbm-01.t [test] |
---|
31 | Index: lib/Parrot/Configure/Step/List.pm |
---|
32 | =================================================================== |
---|
33 | --- lib/Parrot/Configure/Step/List.pm (revision 41543) |
---|
34 | +++ lib/Parrot/Configure/Step/List.pm (working copy) |
---|
35 | @@ -42,7 +42,6 @@ |
---|
36 | auto::jit |
---|
37 | auto::frames |
---|
38 | auto::cpu |
---|
39 | - auto::funcptr |
---|
40 | auto::cgoto |
---|
41 | auto::inline |
---|
42 | auto::gc |
---|
43 | Index: Configure.pl |
---|
44 | =================================================================== |
---|
45 | --- Configure.pl (revision 41543) |
---|
46 | +++ Configure.pl (working copy) |
---|
47 | @@ -623,7 +623,6 @@ |
---|
48 | auto::jit |
---|
49 | auto::frames |
---|
50 | auto::cpu |
---|
51 | - auto::funcptr |
---|
52 | auto::cgoto |
---|
53 | auto::inline |
---|
54 | auto::gc |
---|
55 | Index: t/steps/auto/funcptr-01.t |
---|
56 | =================================================================== |
---|
57 | --- t/steps/auto/funcptr-01.t (revision 41543) |
---|
58 | +++ t/steps/auto/funcptr-01.t (working copy) |
---|
59 | @@ -1,134 +0,0 @@ |
---|
60 | -#! perl |
---|
61 | -# Copyright (C) 2007, Parrot Foundation. |
---|
62 | -# $Id$ |
---|
63 | -# auto/funcptr-01.t |
---|
64 | - |
---|
65 | -use strict; |
---|
66 | -use warnings; |
---|
67 | -use Test::More tests => 28; |
---|
68 | -use Carp; |
---|
69 | -use lib qw( lib t/configure/testlib ); |
---|
70 | -use_ok('config::init::defaults'); |
---|
71 | -use_ok('config::auto::funcptr'); |
---|
72 | -use Parrot::BuildUtil; |
---|
73 | -use Parrot::Configure; |
---|
74 | -use Parrot::Configure::Options qw( process_options ); |
---|
75 | -use Parrot::Configure::Test qw( test_step_thru_runstep); |
---|
76 | -use Parrot::Configure::Test qw( |
---|
77 | - test_step_thru_runstep |
---|
78 | - rerun_defaults_for_testing |
---|
79 | - test_step_constructor_and_description |
---|
80 | -); |
---|
81 | -use IO::CaptureOutput qw( capture ); |
---|
82 | - |
---|
83 | -########### --jitcapable=0 ########### |
---|
84 | - |
---|
85 | -my ($args, $step_list_ref) = process_options( { |
---|
86 | - argv => [ q{--jitcapable=0} ], |
---|
87 | - mode => q{configure}, |
---|
88 | -} ); |
---|
89 | - |
---|
90 | -my $conf = Parrot::Configure->new(); |
---|
91 | - |
---|
92 | -my $serialized = $conf->pcfreeze(); |
---|
93 | - |
---|
94 | -test_step_thru_runstep($conf, q{init::defaults}, $args); |
---|
95 | - |
---|
96 | -my $pkg = q{auto::funcptr}; |
---|
97 | - |
---|
98 | -$conf->add_steps($pkg); |
---|
99 | -$conf->options->set(%{$args}); |
---|
100 | -my $step = test_step_constructor_and_description($conf); |
---|
101 | -my $ret = $step->runstep($conf); |
---|
102 | -ok($ret, "runstep() returned defined value" ); |
---|
103 | - |
---|
104 | -$conf->replenish($serialized); |
---|
105 | - |
---|
106 | -########### _cast_void_pointers_msg() ########### |
---|
107 | - |
---|
108 | -($args, $step_list_ref) = process_options( { |
---|
109 | - argv => [ ], |
---|
110 | - mode => q{configure}, |
---|
111 | -} ); |
---|
112 | -rerun_defaults_for_testing($conf, $args ); |
---|
113 | -$conf->add_steps($pkg); |
---|
114 | -$conf->options->set( %{$args} ); |
---|
115 | -$step = test_step_constructor_and_description($conf); |
---|
116 | -{ |
---|
117 | - my $stdout; |
---|
118 | - my $ret = capture( |
---|
119 | - sub { auto::funcptr::_cast_void_pointers_msg(); }, |
---|
120 | - \$stdout, |
---|
121 | - ); |
---|
122 | - like($stdout, qr/Although it is not required/s, |
---|
123 | - "Got expected advisory message"); |
---|
124 | -} |
---|
125 | - |
---|
126 | -########### _set_positive_result() ########### |
---|
127 | - |
---|
128 | -{ |
---|
129 | - my $stdout; |
---|
130 | - my $ret = capture( |
---|
131 | - sub { auto::funcptr::_set_positive_result($step, $conf); }, |
---|
132 | - \$stdout, |
---|
133 | - ); |
---|
134 | - is($step->result, q{yes}, "Got expected result"); |
---|
135 | - ok(! $stdout, "Nothing printed to STDOUT, as expected"); |
---|
136 | -} |
---|
137 | - |
---|
138 | -$conf->replenish($serialized); |
---|
139 | - |
---|
140 | -########### --verbose; _set_positive_result() ########### |
---|
141 | - |
---|
142 | -($args, $step_list_ref) = process_options( { |
---|
143 | - argv => [ q{--verbose} ], |
---|
144 | - mode => q{configure}, |
---|
145 | -} ); |
---|
146 | -rerun_defaults_for_testing($conf, $args ); |
---|
147 | -$conf->add_steps($pkg); |
---|
148 | -$conf->options->set( %{$args} ); |
---|
149 | -$step = test_step_constructor_and_description($conf); |
---|
150 | -{ |
---|
151 | - my $stdout; |
---|
152 | - my $ret = capture( |
---|
153 | - sub { auto::funcptr::_set_positive_result($step, $conf); }, |
---|
154 | - \$stdout, |
---|
155 | - ); |
---|
156 | - is($step->result, q{yes}, "Got expected result"); |
---|
157 | - like($stdout, qr/yes/, "Got expected verbose output"); |
---|
158 | -} |
---|
159 | - |
---|
160 | -pass("Completed all tests in $0"); |
---|
161 | - |
---|
162 | -################### DOCUMENTATION ################### |
---|
163 | - |
---|
164 | -=head1 NAME |
---|
165 | - |
---|
166 | -auto/funcptr-01.t - test auto::funcptr |
---|
167 | - |
---|
168 | -=head1 SYNOPSIS |
---|
169 | - |
---|
170 | - % prove t/steps/auto/funcptr-01.t |
---|
171 | - |
---|
172 | -=head1 DESCRIPTION |
---|
173 | - |
---|
174 | -The files in this directory test functionality used by F<Configure.pl>. |
---|
175 | - |
---|
176 | -The tests in this file test aspects of auto::funcptr. |
---|
177 | - |
---|
178 | -=head1 AUTHOR |
---|
179 | - |
---|
180 | -James E Keenan |
---|
181 | - |
---|
182 | -=head1 SEE ALSO |
---|
183 | - |
---|
184 | -config::auto::funcptr, F<Configure.pl>. |
---|
185 | - |
---|
186 | -=cut |
---|
187 | - |
---|
188 | -# Local Variables: |
---|
189 | -# mode: cperl |
---|
190 | -# cperl-indent-level: 4 |
---|
191 | -# fill-column: 100 |
---|
192 | -# End: |
---|
193 | -# vim: expandtab shiftwidth=4: |
---|
194 | Index: config/auto/funcptr.pm |
---|
195 | =================================================================== |
---|
196 | --- config/auto/funcptr.pm (revision 41543) |
---|
197 | +++ config/auto/funcptr.pm (working copy) |
---|
198 | @@ -1,80 +0,0 @@ |
---|
199 | -# Copyright (C) 2001-2003, Parrot Foundation. |
---|
200 | -# $Id$ |
---|
201 | - |
---|
202 | -=head1 NAME |
---|
203 | - |
---|
204 | -config/auto/funcptr.pm - Function Pointer Casts |
---|
205 | - |
---|
206 | -=head1 DESCRIPTION |
---|
207 | - |
---|
208 | -Verifies that the compiler supports function pointer casts. |
---|
209 | - |
---|
210 | -=cut |
---|
211 | - |
---|
212 | -package auto::funcptr; |
---|
213 | - |
---|
214 | -use strict; |
---|
215 | -use warnings; |
---|
216 | - |
---|
217 | -use base qw(Parrot::Configure::Step); |
---|
218 | - |
---|
219 | -use Parrot::Configure::Utils ':auto'; |
---|
220 | - |
---|
221 | - |
---|
222 | -sub _init { |
---|
223 | - my $self = shift; |
---|
224 | - my %data; |
---|
225 | - $data{description} = q{Does compiler support function pointer casts}; |
---|
226 | - $data{result} = q{}; |
---|
227 | - return \%data; |
---|
228 | -} |
---|
229 | - |
---|
230 | -sub runstep { |
---|
231 | - my ( $self, $conf ) = @_; |
---|
232 | - |
---|
233 | - my $jitcapable = $conf->data->get('jitcapable'); |
---|
234 | - |
---|
235 | - if ($jitcapable) { |
---|
236 | - $conf->cc_gen('config/auto/funcptr/test_c.in'); |
---|
237 | - eval { $conf->cc_build(); }; |
---|
238 | - |
---|
239 | - if ( $@ || $conf->cc_run() !~ /OK/ ) { |
---|
240 | - _cast_void_pointers_msg(); |
---|
241 | - exit(-1); |
---|
242 | - } |
---|
243 | - $conf->cc_clean(); |
---|
244 | - $self->_set_positive_result($conf); |
---|
245 | - } |
---|
246 | - |
---|
247 | - return 1; |
---|
248 | -} |
---|
249 | - |
---|
250 | -sub _cast_void_pointers_msg { |
---|
251 | - print <<"END"; |
---|
252 | -Although it is not required by the ANSI C standard, |
---|
253 | -Parrot requires the ability to cast from void pointers to function |
---|
254 | -pointers for its JIT support. |
---|
255 | - |
---|
256 | -Your compiler does not appear to support this behavior with the |
---|
257 | -flags you have specified. You must adjust your settings in order |
---|
258 | -to use the JIT code. |
---|
259 | - |
---|
260 | -If you wish to continue without JIT support, please re-run this script |
---|
261 | -With the '--jitcapable=0' argument. |
---|
262 | -END |
---|
263 | -} |
---|
264 | - |
---|
265 | -sub _set_positive_result { |
---|
266 | - my ($self, $conf) = @_; |
---|
267 | - print " (yes) " if $conf->options->get('verbose'); |
---|
268 | - $self->set_result('yes'); |
---|
269 | -} |
---|
270 | - |
---|
271 | -1; |
---|
272 | - |
---|
273 | -# Local Variables: |
---|
274 | -# mode: cperl |
---|
275 | -# cperl-indent-level: 4 |
---|
276 | -# fill-column: 100 |
---|
277 | -# End: |
---|
278 | -# vim: expandtab shiftwidth=4: |
---|
279 | Index: config/auto/funcptr/test_c.in |
---|
280 | =================================================================== |
---|
281 | --- config/auto/funcptr/test_c.in (revision 41543) |
---|
282 | +++ config/auto/funcptr/test_c.in (working copy) |
---|
283 | @@ -1,43 +0,0 @@ |
---|
284 | -/* |
---|
285 | -Copyright (C) 2002-2009, Parrot Foundation. |
---|
286 | -$Id$ |
---|
287 | - |
---|
288 | -figure out if the compiler will let us do non-ansi function pointer casts. |
---|
289 | -*/ |
---|
290 | - |
---|
291 | -#include <stdio.h> |
---|
292 | - |
---|
293 | -int |
---|
294 | -a_function(int some_number) |
---|
295 | -{ |
---|
296 | - if (some_number == 42) { |
---|
297 | - printf("OK\n"); |
---|
298 | - return 0; |
---|
299 | - } |
---|
300 | - else { |
---|
301 | - printf("FAIL\n"); |
---|
302 | - return -1; |
---|
303 | - } |
---|
304 | -} |
---|
305 | - |
---|
306 | -typedef int (*func_t)(int); |
---|
307 | - |
---|
308 | -int |
---|
309 | -main(int argc, char *argv[]) |
---|
310 | -{ |
---|
311 | - void *voidptr; |
---|
312 | - func_t funcptr; |
---|
313 | - |
---|
314 | - voidptr = (void *)a_function; |
---|
315 | - funcptr = a_function; |
---|
316 | - funcptr = (func_t)voidptr; |
---|
317 | - |
---|
318 | - return funcptr(42); |
---|
319 | -} |
---|
320 | - |
---|
321 | -/* |
---|
322 | - * Local variables: |
---|
323 | - * c-file-style: "parrot" |
---|
324 | - * End: |
---|
325 | - * vim: expandtab shiftwidth=4: |
---|
326 | - */ |
---|