Permalink
Browse files

Merge remote-tracking branch 'origin/master' into gh838_cmdline_cleanup

  • Loading branch information...
2 parents bf60df5 + ce2c408 commit eaa1466dda9172fb84701c7ac2e8db266f053fea @rurban rurban committed Sep 25, 2012
View
20 ChangeLog
@@ -1,5 +1,23 @@
2012-10-16 release 4.9.0
- Core
+ + Keep encoding information in the imcc optimizer, which fixes the
+ concat op but probably many more cases with non-ascii encoded
+ constant strings. [GH #837]
+ + Fixed ByteBuffer set_string_native, which became out of sync with
+ two internal buffers. [GH #835]
+ + Preload Configure steps when called with perl -d Configure.pl
+ + Strip unneeded config keys from installed config hash. Saves 6360
+ bytes from every installed executable.
+ - Build
+ + Improved warnings for clang.
+ + Cleaned wrong UNUSED(arg) macros in all pmc's due to an improved
+ pmc2c compiler, which SHIMs all UNUSED args. [GH #836]
+ - Branches
+ + The threads branch is almost ready to be merged. Some remaining races
+ have been fixed. There are only some remaining platforms errors on
+ darwin/x86.
+ - Libraries
+ + Fixed Mime/Base64 encode_base64. Split long lines at 76 chars [GH #826]
- Documentation
- Tests
- Community
@@ -15,7 +33,7 @@
+ Moved dynpmc/os to pmc os. loadlib 'os' is not needed anymore.
- Platforms
+ Fixed for the FileHandle open method the append mode on Windows.
- + Fix compilation on Windows without working mt.exe
+ + Fix compilation on Windows without working mt.exe
+ Detect GNU/Hurd as linux proper.
+ Fixed broken int3 trap on Solaris with gcc.
+ Updated the vms port on a YAPC::EU hackathon with vaxman and mvorl.
View
9 Configure.pl
@@ -42,6 +42,15 @@
);
exit(1) unless defined $args;
+# preload all steps for debugging because some Windows systems cannot
+# do "b postpone stepname"
+if (defined &DB::DB) {
+ for my $step_name (@{ $steps_list_ref } ) {
+ eval "use $step_name;"; ## no critic (BuiltinFunctions::ProhibitStringyEval)
+ die $@ if $@;
+ }
+}
+
my $opttest = Parrot::Configure::Options::Test->new($args);
# configuration tests will only be run if you requested them
View
1 MANIFEST
@@ -1861,6 +1861,7 @@ t/pmc/bigint.t [test]
t/pmc/bignum.t [test]
t/pmc/boolean.t [test]
t/pmc/bytebuffer.t [test]
+t/pmc/bytebuffer2.t [test]
t/pmc/callcontext.t [test]
t/pmc/capture.t [test]
t/pmc/class.t [test]
View
16 compilers/imcc/optimizer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002-2010, Parrot Foundation.
+ * Copyright (C) 2002-2012, Parrot Foundation.
*/
/*
@@ -1070,13 +1070,15 @@ IMCC_subst_constants(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit),
case 'S':
{
char * const cstr = Parrot_str_to_cstring(imcc->interp, REG_STR(imcc->interp, 0));
-
- r[1] = mk_const(imcc, cstr, r[0]->set);
-
- snprintf(b, sizeof (b), "%p", REG_STR(imcc->interp, 0));
+ const STR_VTABLE* encoding = REG_STR(imcc->interp, 0)->encoding;
+ if (encoding == Parrot_ascii_encoding_ptr) {
+ r[1] = mk_const(imcc, cstr, r[0]->set);
+ }
+ else {
+ snprintf(b, sizeof (b), "%s:\"%s\"", encoding->name, cstr);
+ r[1] = mk_const(imcc, b, 'U');
+ }
Parrot_str_free_cstring(cstr);
-
- break;
}
default:
break;
View
20 config/auto/libffi.pm
@@ -55,13 +55,11 @@ sub runstep {
my $pkgconfig_exec = check_progs([ @pkgconfig_variations ], $verbose);
unless ($pkgconfig_exec) {
print "Program 'pkg-config' needed for libffi\n" if $verbose;
- $conf->data->set( HAS_LIBFFI => undef );
- $conf->data->set( has_libffi => undef );
+ $conf->data->set( HAS_LIBFFI => 0 );
+ $conf->data->set( has_libffi => 0 );
$self->set_result('lack pkg-config');
return 1;
}
- my $rv = $self->_handle_pkgconfig_exec($conf, $pkgconfig_exec, $verbose);
- return 1 unless $rv;
my $libffi_options_cflags = '';
my $libffi_options_libs = '';
@@ -118,20 +116,6 @@ sub _evaluate_cc_run {
return $has_libffi;
}
-sub _handle_pkgconfig_exec {
- my ($self, $conf, $pkgconfig_exec, $verbose) = @_;
- if (! $pkgconfig_exec) {
- print "Program 'pkg-config' needed for libffi\n" if $verbose;
- $conf->data->set( HAS_LIBFFI => undef );
- $conf->data->set( has_libffi => undef );
- $self->set_result('lack pkg-config');
- return;
- }
- else {
- return 1;
- }
-}
-
1;
=head1 AUTHOR
View
40 config/auto/warnings.pm
@@ -62,7 +62,7 @@ Configure. This can be used to hold warnings that aren't ready to be
added to the default run yet.
'only' should be used as we add new warnings to the build, it will let
-us insure that files we know are clean for a new warning stay clean.
+us ensure that files we know are clean for a new warning stay clean.
'never' should be used when a particular file contains generated code
(e.g. imcc) and we cannot update it to conform to the standards.
@@ -208,6 +208,7 @@ sub _init {
$gcc->{'cage'} = [ @gcc_or_gpp_cage ];
$gpp->{'cage'} = [ @gcc_or_gpp_cage, @gpp_cage ];
+ # strip from the list
$gcc->{'todo'} = $gpp->{'todo'} = {
'-Wformat-nonliteral' => [ qw(
src/spf_render.c
@@ -218,7 +219,7 @@ sub _init {
src/extra_nci_thunks.c
) ],
};
-
+ # strip from the list
$gcc->{'never'} = $gpp->{'never'} = {
'-Wformat-nonliteral' => [ qw(
compilers/imcc/imclexer.c
@@ -233,6 +234,12 @@ sub _init {
compilers/imcc/imcparser.c
) ],
};
+ # add at the end
+ $gcc->{'override'} = $gpp->{'override'} = {
+ '-Wno-unused-result' => [ qw(
+ src/ops/core_ops.c
+ ) ],
+ };
# Warning flags docs
# http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/cpp/lin/compiler_c/index.htm
@@ -279,6 +286,12 @@ sub _init {
$data->{'warnings'}{'icc'} = $icc;
$data->{'warnings'}{'clang'} = $gcc;
+ $data->{'warnings'}{'clang'}->{'override'} = {
+ '-Wno-parentheses-equality' => [ qw(
+ src/ops/core_ops.c
+ ) ],
+ };
+
## end gcc/g++
return $data;
@@ -311,6 +324,16 @@ sub runstep {
push @{$self->{'warnings'}{$compiler}{'basic'}},
'-fvisibility=hidden';
};
+ if ($conf->data->get('clang') and $compiler eq 'g++') { # clang++
+ unshift @{$self->{'warnings'}{$compiler}{'basic'}},
+ '-x c++';
+ $self->{'warnings'}{$compiler}{'override'} = {
+ '-Wno-parentheses-equality' => [ qw(
+ src/ops/core_ops.c
+ ) ],
+ };
+ }
+
# standard warnings.
my @warnings = grep {$self->valid_warning($conf, $_)}
@{$self->{'warnings'}{$compiler}{'basic'}};
@@ -346,6 +369,19 @@ sub runstep {
}
}
+ if (exists $self->{'warnings'}{$compiler}{override}) {
+ my %add = %{$self->{'warnings'}{$compiler}{override}};
+ foreach my $warning (keys %add) {
+ if ($self->valid_warning($conf, $warning)) {
+ foreach my $file (@{$add{$warning}}) {
+ $per_file{$file} = exists $per_file{$file}
+ ? [ @{$per_file{$file}}, $warning ] : [ @warnings, $warning ];
+ }
+ }
+ }
+ }
+
+
$conf->data->set('ccwarn', join(' ', @warnings));
foreach my $file (keys %per_file) {
$conf->data->set("ccwarn::$file", join(' ', @{$per_file{$file}}));
View
9 config/gen/config_pm.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2011, Parrot Foundation.
+# Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
@@ -180,6 +180,13 @@ END
elsif (s/\"\@PWD\@\"/$cwdcharset\"$cwd\"/) {
print {$OUT} $_;
}
+ elsif (/\@NOINSTALL\@/) {
+ # do not install internal keys
+ for ($conf->data->keys()) {
+ print {$OUT} " delete \$P0[\"$_\"]\n"
+ if /^ccwarn::/ or /_tests$/ or /coveragedir$/;
+ }
+ }
else {
print {$OUT} $_;
}
View
5 config/gen/config_pm/config_lib_pir.in
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2009, Parrot Foundation.
+# Copyright (C) 2004-2012, Parrot Foundation.
.include 'datatypes.pasm'
.include 'parrot_version.pir'
@@ -25,8 +25,9 @@ no_arg:
branch freeze_config
is_install:
set $P0["installed"], "1"
-freeze_config:
+ @NOINSTALL@
+freeze_config:
freeze $S0, $P0
print $S0
.end
View
14 config/gen/makefiles/root.in
@@ -591,10 +591,12 @@ MAKE_C = @make_c@
# These need to be above lines that define suffix rules to be portable
# (certainly FreeBSD make doesn't grok the pir.pbc rule otherwise)
-.SUFFIXES : .c .S .s .pmc .dump $(O) .str .pir .pbc
+.SUFFIXES : .c .S .s .i .pmc .dump $(O) .str .pir .pbc
.c$(O) : # suffix rule (limited support)
$(CC) $(CFLAGS) @optimize@ $(CC_WARN) -I$(@D) -Isrc/ @cc_o_out@$@ -c $<
+.c.i : # suffix rule (limited support)
+ $(CC) -E $(CFLAGS) -I$(@D) -Isrc/ @cc_o_out@$@ -c $<
#UNLESS(win32):.s$(O) : # suffix rule (limited support)
#UNLESS(win32): $(CC) $(CFLAGS) @optimize@ $(CC_WARN) -I$(@D) @cc_o_out@$@ -c $<
@@ -733,10 +735,10 @@ src/string/private_cstring.h : $(STR_FILES) $(BUILD_TOOLS_DIR)/c2str.pl
H2INC = $(BUILD_TOOLS_DIR)/h2inc.pl
# classes PMC build utils and rules
-PMC2C = $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl @no_lines_flag@
-PMC2CD = $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --dump @no_lines_flag@
-PMC2CC = $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --c @no_lines_flag@
-PMC2CV = $(PERL) $(BUILD_TOOLS_DIR)/pmc2c.pl --vtable @no_lines_flag@
+PMC2C = $(PERL) -Ilib $(BUILD_TOOLS_DIR)/pmc2c.pl @no_lines_flag@
+PMC2CD = $(PERL) -Ilib $(BUILD_TOOLS_DIR)/pmc2c.pl --dump @no_lines_flag@
+PMC2CC = $(PERL) -Ilib $(BUILD_TOOLS_DIR)/pmc2c.pl --c @no_lines_flag@
+PMC2CV = $(PERL) -Ilib $(BUILD_TOOLS_DIR)/pmc2c.pl --vtable @no_lines_flag@
#.pmc.dump : # suffix rule (limited support)
# $(PMC2CD) $<
@@ -2022,6 +2024,7 @@ src/gc/malloc_trace$(O) : src/gc/malloc.c src/gc/malloc_trace.c
src/packfile/pf_items$(O) : $(PARROT_H_HEADERS) src/packfile/pf_items.c
+## SUFFIX OVERRIDE - add -Wno-unused-result for number of write_b
# core_ops depends upon config.h so that it gets updated along with
# updates to config.h's version numbers
src/ops/core_ops$(O) : src/ops/core_ops.c \
@@ -2038,6 +2041,7 @@ src/ops/core_ops$(O) : src/ops/core_ops.c \
$(INC_DIR)/events.h \
$(INC_DIR)/scheduler_private.h \
src/io/io_private.h
+ $(CC) $(CFLAGS) @optimize::src/ops/core_ops.c@ @ccwarn::src/ops/core_ops.c@ @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/ops/core_ops.c
@TEMP_pmc_build@
View
5 docs/project/release_manager_guide.pod
@@ -545,8 +545,11 @@ calendar, visible at
L<http://www.google.com/calendar/render?cid=ldhctdamsgfg5a1cord52po9h8@group.calendar.google.com>.
- Oct 16, 2012 - 4.9.0 - dukeleto
- - Nov 20, 2012 - 4.10.0 - ??
+ - Nov 20, 2012 - 4.10.0 - rurban
- Dec 18, 2012 - 4.11.0 - ??
+ - Jan 15, 2013 - 5.0.0 - dukeleto
+ - Feb 19, 2013 - 5.1.0 - ??
+ - Mar 19, 2013 - 5.2.0 - ??
=cut
View
47 examples/benchmarks/stress_strings1.pir
@@ -0,0 +1,47 @@
+# Copyright (C) 2010-2012, Parrot Foundation.
+
+=head1 NAME
+
+examples/benchmarks/stress_strings1.pir - comparison with stress_stringsu.pir
+
+=head1 SYNOPSIS
+
+ % time ./parrot examples/benchmarks/stress_strings1.pir
+ % time ./parrot examples/benchmarks/stress_stringsu.pir
+
+=head1 DESCRIPTION
+
+Create non-encoded strings, running through the imcc optimizer.
+Some of the strings are long-lived, most of them are short lived.
+
+=cut
+
+.sub 'main' :main
+ .local pmc rsa # array of long lived strings.
+ .local pmc args
+ .local int i
+
+ rsa = new ['ResizableStringArray']
+ args = new ['ResizablePMCArray']
+ i = 0
+ push args, i
+ loop:
+ $S0 = "c"
+ args[0] = i
+ sprintf $S1, "%d", args
+ $S2 = concat $S0, $S1
+ $I0 = i % 10 # every 10th string is longlived
+ if $I0 goto inc_i
+ push rsa, $S2
+ inc_i:
+ inc i
+ if i < 10000000 goto loop
+
+.end
+
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
48 examples/benchmarks/stress_stringsu.pir
@@ -0,0 +1,48 @@
+# Copyright (C) 2010-2012, Parrot Foundation.
+
+=head1 NAME
+
+examples/benchmarks/stress_stringsu.pir - GC unicode strings stress-testing
+
+=head1 SYNOPSIS
+
+ % time ./parrot examples/benchmarks/stress_stringsu.pir
+
+=head1 DESCRIPTION
+
+Create encoded strings, running through the imcc optimizer, which reencodes the strings.
+Some of the strings are long-lived, most of them are short lived.
+
+Main purpose - test encoding issues and imcc performance. [GH #873]
+
+=cut
+
+.sub 'main' :main
+ .local pmc rsa # array of long lived strings.
+ .local pmc args
+ .local int i
+
+ rsa = new ['ResizableStringArray']
+ args = new ['ResizablePMCArray']
+ i = 0
+ push args, i
+ loop:
+ $S0 = utf8:"\x{a2}"
+ args[0] = i
+ sprintf $S1, "%d", args
+ $S2 = concat $S0, $S1
+ $I0 = i % 10 # every 10th string is longlived
+ if $I0 goto inc_i
+ push rsa, $S2
+ inc_i:
+ inc i
+ if i < 10000000 goto loop
+
+.end
+
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
41 lib/Parrot/Pmc2c/Method.pm
@@ -36,6 +36,7 @@ sub new {
parent_name => "",
decorators => [],
pmc_unused => 0,
+ interp_unused => 0,
%{ $self_hash || {} }
)
};
@@ -66,8 +67,7 @@ EOC
}
sub is_vtable {
- my ($self) = @_;
- my $type = $self->type;
+ my $type = shift->type;
return $type eq VTABLE || $type eq VTABLE_ENTRY;
}
@@ -76,10 +76,21 @@ sub is_multi {
return $self->type eq MULTI;
}
+# if is_ro
sub pmc_unused {
+ return shift->{pmc_unused};
+}
+
+# detect empty body, like return 1
+sub interp_unused {
my ($self) = @_;
- return $self->{pmc_unused};
+ my $body = $self->body;
+ if ($body->{data} and $body->{data} =~ /^\s+return 1;\s+$/) {
+ $self->{interp_unused} = 1;
+ $self->{pmc_unused} = 1;
+ }
+ return $self->{interp_unused};
}
=head2 C<trans($type)>
@@ -246,6 +257,27 @@ sub decl {
$args = ", $args" if $args =~ /\S/;
$args =~ s/(\w+)\s*(\*)\s*/$1 $2/g;
+ # SHIM UNUSED(arg) in body
+ my $body = $self->body;
+ if ($body->{data} and $body->{data} =~ /^\s*UNUSED\((\w+)\)/m) {
+ my $key = $1;
+ if ($args =~ s/, (\w+ \*?$key)/, SHIM($1)/) {
+ $body->{data} =~ s/^\s*UNUSED\((\w+)\);?\n//;
+ }
+ if ($body->{data} =~ m/^\s*UNUSED\(SELF\);?\n/) {
+ $self->{pmc_unused} = 1;
+ $body->{data} =~ s/^\s*UNUSED\(SELF\);?\n//;
+ }
+ if ($body->{data} =~ m/^\s*UNUSED\((INTERP|interp)\);?\n/) {
+ $self->{interp_unused} = 1;
+ $body->{data} =~ s/^\s*UNUSED\((INTERP|interp)\);?\n//;
+ warn "Replace UNUSED(interp) with UNUSED(INTERP) in $pmcname METHOD $meth\n"
+ if $1 eq 'interp'
+ and $self->{parent_name} ne 'Null'
+ and $body->{data} != /^\s*$/;
+ }
+ }
+
my ( $extern, $newl, $semi );
if ( $for_header eq 'HEADER' ) {
$newl = ' ';
@@ -255,10 +287,11 @@ sub decl {
$newl = "\n";
$semi = '';
}
+ my $interp = $self->interp_unused ? 'SHIM_INTERP' : 'PARROT_INTERP';
my $pmcarg = $self->pmc_unused ? 'SHIM(PMC *_self)' : 'ARGMOD(PMC *_self)';
return <<"EOC";
-static $decs $ret${newl}Parrot_${pmcname}_$meth(PARROT_INTERP, $pmcarg$args)$semi
+static $decs $ret${newl}Parrot_${pmcname}_$meth($interp, $pmcarg$args)$semi
EOC
}
View
5 lib/Parrot/Pmc2c/PMC/Null.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008, Parrot Foundation.
+# Copyright (C) 2007-2012, Parrot Foundation.
package Parrot::Pmc2c::PMC::Null;
use base 'Parrot::Pmc2c::PMC';
@@ -42,8 +42,7 @@ sub pre_method_gen {
# take care to mark the parameters as unused
# to avoid compiler warnings
my $body = <<"EOC";
- UNUSED(interp)
- UNUSED(_self)
+ UNUSED(SELF)
EOC
foreach my $param (split /,\s*/, $method->parameters) {
View
18 runtime/parrot/library/MIME/Base64.pir
@@ -89,7 +89,6 @@ then a warning is generated if perl is running under -w.
.param string plain
.local string base64
-
.local pmc six_to_eight
six_to_eight = get_global 'six_to_eight'
@@ -106,17 +105,19 @@ then a warning is generated if perl is running under -w.
base64 = ''
- .local int i
+ .local int i, j
.local int eight_0, eight_1, eight_2
.local int six_0, six_1, six_2, six_3
.local int tmp_int_1, tmp_int_2
.local string s_tmp_1
i = 0
+ j = 0
START_3:
if i >= len goto END_3
# read 3*8 bits
+ # TODO GH #813 and #814 unicode chars
eight_0 = ord plain, i
inc i
eight_1 = ord plain, i
@@ -156,9 +157,14 @@ then a warning is generated if perl is running under -w.
tmp_int_1 = six_to_eight[six_3]
s_tmp_1 = chr tmp_int_1
base64 = concat base64, s_tmp_1
-
-
- goto START_3
+ inc j
+
+ if j == 19 goto line_split
+ goto START_3
+ line_split:
+ base64 = concat base64, "\n"
+ j = 0
+ goto START_3
END_3:
# padding with '='
@@ -281,7 +287,7 @@ and on the article on de.selfhtml.org.
=head1 COPYRIGHT
-Copyright (C) 2006-2008, Parrot Foundation.
+Copyright (C) 2006-2012, Parrot Foundation.
=cut
View
7 src/dynpmc/gziphandle.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2010-2011, Parrot Foundation.
+Copyright (C) 2010-2012, Parrot Foundation.
=head1 NAME
@@ -19,15 +19,16 @@ This PMC wraps the zlib.
*/
+BEGIN_PMC_HEADER_PREAMBLE
#include <zlib.h>
-#include "parrot/extend.h"
+END_PMC_HEADER_PREAMBLE
/* HEADERIZER HFILE: none */
/* HEADERIZER BEGIN: static */
/* HEADERIZER END: static */
pmclass GzipHandle extends Handle dynpmc auto_attrs {
- ATTR void *file;
+ ATTR gzFile file;
/*
View
3 src/ops/core.ops
@@ -58,6 +58,8 @@ Halts the interpreter. See also B<exit>.
=cut
inline op end() :check_event :flow {
+ UNUSED(interp);
+ UNUSED(cur_opcode);
goto ADDRESS(0);
}
@@ -97,7 +99,6 @@ actions on it.
inline op noop() {
UNUSED(interp);
- UNUSED(CUR_OPCODE);
}
inline op check_events() :flow {
View
9 src/ops/core_ops.c
@@ -13605,13 +13605,14 @@ static op_info_t core_op_info_table[1126] = {
opcode_t *
Parrot_end(opcode_t *cur_opcode, PARROT_INTERP) {
+ UNUSED(interp);
+ UNUSED(cur_opcode);
return (opcode_t *)0;
}
opcode_t *
Parrot_noop(opcode_t *cur_opcode, PARROT_INTERP) {
UNUSED(interp);
- UNUSED(CUR_OPCODE);
return cur_opcode + 1;
}
@@ -13746,15 +13747,13 @@ Parrot_local_return_p(opcode_t *cur_opcode, PARROT_INTERP) {
opcode_t *
Parrot_jump_i(opcode_t *cur_opcode, PARROT_INTERP) {
- opcode_t * const loc = INTVAL2PTR(opcode_t *, IREG(1));
-
+ opcode_t * const loc = INTVAL2PTR(opcode_t *, IREG(1));
return (opcode_t *)loc;
}
opcode_t *
Parrot_jump_ic(opcode_t *cur_opcode, PARROT_INTERP) {
- opcode_t * const loc = INTVAL2PTR(opcode_t *, ICONST(1));
-
+ opcode_t * const loc = INTVAL2PTR(opcode_t *, ICONST(1));
return (opcode_t *)loc;
}
View
6 src/platform/generic/cpu_type.c
@@ -31,7 +31,7 @@ For win32, look in platform/win32/cpu_type.c
=over 4
-=item C<STRING *Parrot_get_cpu_type(Parrot_Interp)>
+=item C<STRING * Parrot_get_cpu_type(Parrot_Interp interp)>
Fetch CPU type for non-win32 systems
For win32, look in platform/win32/misc.c
@@ -45,11 +45,13 @@ For win32, look in platform/win32/misc.c
STRING *
Parrot_get_cpu_type(Parrot_Interp interp) {
struct utsname uname_info;
- char *proc_arch = "";
+ char *proc_arch;
#ifdef PARROT_HAS_HEADER_SYSUTSNAME
uname(&uname_info);
proc_arch = uname_info.machine;
+#else
+ *proc_arch = '\0';
#endif
return Parrot_str_new_init(interp, proc_arch, strlen(proc_arch),
Parrot_ascii_encoding_ptr, 0);
View
6 src/pmc/addrregistry.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2005-2011, Parrot Foundation.
+Copyright (C) 2005-2012, Parrot Foundation.
=head1 NAME
@@ -183,10 +183,10 @@ reaches 0, delete the entry.
*/
VTABLE void set_pmc_keyed(PMC *key, PMC *value) {
+ UNUSED(value)
const void *oldval;
ptrcast_t newval = 1;
Hash *hash;
- UNUSED(value);
GET_ATTR_pmc_registry(INTERP, SELF, hash);
@@ -199,10 +199,10 @@ reaches 0, delete the entry.
}
VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) {
+ UNUSED(value)
const void *oldval;
ptrcast_t newval = 1;
Hash *hash;
- UNUSED(value);
GET_ATTR_str_registry(INTERP, SELF, hash);
View
21 src/pmc/bytebuffer.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2010-2011, Parrot Foundation.
+Copyright (C) 2010-2012, Parrot Foundation.
=head1 NAME
@@ -200,15 +200,28 @@ Reset the buffer with the content of the string.
VTABLE void set_string_native(STRING *new_string) {
INTVAL allocated_size;
+ INTVAL new_length;
GET_ATTR_allocated_size(INTERP, SELF, allocated_size);
+ new_length = Parrot_str_byte_length(interp, new_string);
if (allocated_size) {
unsigned char *content;
GET_ATTR_content(INTERP, SELF, content);
- Parrot_gc_free_memory_chunk(INTERP, content);
- SET_ATTR_allocated_size(INTERP, SELF, 0);
+ if (allocated_size < new_length) {
+ content = (unsigned char *)Parrot_gc_reallocate_memory_chunk(INTERP,
+ content, new_length);
+ }
+ memcpy(content, new_string->strstart, new_length);
+ SET_ATTR_content(INTERP, SELF, content);
+ }
+ else {
+ unsigned char * const content = (unsigned char *)
+ Parrot_gc_allocate_memory_chunk(INTERP, new_length);
+ memcpy(content, new_string->strstart, new_length);
+ SET_ATTR_content(INTERP, SELF, content);
}
SET_ATTR_source(INTERP, SELF, new_string);
- SET_ATTR_size(INTERP, SELF, Parrot_str_byte_length(INTERP, new_string));
+ SET_ATTR_size(INTERP, SELF, new_length);
+ SET_ATTR_allocated_size(INTERP, SELF, new_length);
}
/*
View
4 src/pmc/class.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2011, Parrot Foundation.
+Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
@@ -1762,8 +1762,8 @@ Called after the class has been thawed.
*/
VTABLE void thawfinish(PMC *info) {
- Parrot_Class_attributes * const _class = PARROT_CLASS(SELF);
UNUSED(info)
+ Parrot_Class_attributes * const _class = PARROT_CLASS(SELF);
/* Recalculate full MRO from thawed parents */
_class->all_parents = Parrot_ComputeMRO_C3(INTERP, SELF);
View
4 src/pmc/continuation.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2010, Parrot Foundation.
+Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
@@ -283,10 +283,10 @@ destination to continue execution.
*/
VTABLE opcode_t *invoke(void *next) {
+ UNUSED(next)
PMC * const from_obj = Parrot_pcc_get_signature(INTERP, CURRENT_CONTEXT(INTERP));
opcode_t *pc;
PackFile_ByteCode *seg;
- UNUSED(next)
GET_ATTR_seg(INTERP, SELF, seg);
GET_ATTR_address(INTERP, SELF, pc);
View
3 src/pmc/default.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2011, Parrot Foundation.
+Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
@@ -893,7 +893,6 @@ Initializes the PMC during unarchiving.
*/
VTABLE void thaw(PMC *info) {
- UNUSED(INTERP);
UNUSED(info);
/* default - initialize the PMC */
SELF.init();
View
12 src/pmc/key.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2009, Parrot Foundation.
+Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
@@ -42,6 +42,7 @@ Initializes the key.
*/
VTABLE void init() {
+ UNUSED(INTERP)
PObj_custom_mark_SET(SELF);
}
@@ -186,7 +187,9 @@ Sets the value of the key to C<*value>.
*/
VTABLE void set_pmc(PMC *value) {
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ UNUSED(SELF)
+ UNUSED(value)
+ Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_UNIMPLEMENTED,
"this is broken - see TT #1683");
}
@@ -245,6 +248,8 @@ Returns the key itself.
*/
VTABLE PMC *get_pmc_keyed(PMC *key) {
+ UNUSED(INTERP)
+ UNUSED(SELF)
return key;
}
@@ -350,8 +355,8 @@ Called after the Key has been thawed: convert last PMC_NULL key to NULL.
}
VTABLE void thawfinish(PMC *info) {
- PMC *key = SELF;
UNUSED(info)
+ PMC *key = SELF;
while (1) {
PMC *next;
@@ -398,6 +403,7 @@ Aggregate interface.
*/
VTABLE INTVAL elements() {
+ UNUSED(INTERP)
INTVAL n = 0;
for (; SELF; SELF = PARROT_KEY(SELF)->next_key)
n++;
View
3 src/pmc/orderedhashiterator.pmc
@@ -124,7 +124,6 @@ Returns this Iterator's Hash.
*/
VTABLE PMC* get_pmc() {
- UNUSED(INTERP)
return PARROT_ORDEREDHASHITERATOR(SELF)->pmc_hash;
}
@@ -153,12 +152,10 @@ Returns the number of remaining elements in the Hash.
*/
VTABLE INTVAL elements() {
- UNUSED(INTERP)
return PARROT_ORDEREDHASHITERATOR(SELF)->elements;
}
VTABLE INTVAL get_integer() {
- UNUSED(INTERP)
return SELF.elements();
}
View
16 src/pmc/pointer.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2011, Parrot Foundation.
+Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
@@ -38,7 +38,7 @@ Initializes the pointer.
*/
VTABLE void init() {
- UNUSED(interp);
+ UNUSED(INTERP)
PObj_custom_mark_SET(SELF);
}
@@ -88,7 +88,7 @@ Sets the pointer value.
*/
VTABLE void set_pointer(void *ptr) {
- UNUSED(interp);
+ UNUSED(INTERP)
PARROT_POINTER(SELF)->pointer = ptr;
}
@@ -103,7 +103,7 @@ Returns the pointer value.
*/
VTABLE void *get_pointer() {
- UNUSED(interp);
+ UNUSED(INTERP)
return PARROT_POINTER(SELF)->pointer;
}
@@ -118,7 +118,7 @@ Returns the pointer value as an integer.
*/
VTABLE INTVAL get_integer() {
- UNUSED(interp);
+ UNUSED(INTERP)
return (INTVAL)(PARROT_POINTER(SELF)->pointer);
}
@@ -133,7 +133,6 @@ Returns the pointer value as a floating-point number.
*/
VTABLE FLOATVAL get_number() {
- UNUSED(interp);
return (FLOATVAL)(INTVAL)(PARROT_POINTER(SELF)->pointer);
}
@@ -148,7 +147,6 @@ Returns the pointer value as a Parrot string.
*/
VTABLE STRING *get_repr() {
- UNUSED(interp);
return Parrot_sprintf_c(INTERP, "Pointer = 0x%p", PARROT_POINTER(SELF)->pointer);
}
@@ -178,7 +176,7 @@ Returns whether the pointer is not C<NULL>.
*/
VTABLE INTVAL get_bool() {
- UNUSED(interp);
+ UNUSED(INTERP)
return (INTVAL)(PMC_data(SELF) != NULL);
}
@@ -193,7 +191,7 @@ Returns whether the pointer has the same value as C<*pmc2>.
*/
VTABLE INTVAL is_same(PMC *pmc2) {
- UNUSED(interp);
+ UNUSED(INTERP)
return (INTVAL)(SELF->vtable == pmc2->vtable &&
PARROT_POINTER(SELF)->pointer == PARROT_POINTER(pmc2)->pointer);
}
View
22 src/pmc/scheduler.pmc
@@ -126,8 +126,8 @@ current maximum, and a birthtime of the current time.
void push_pmc(PMC *task) {
/* TODO: This doesn't appear to do anything */
Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
- PMC * const type_pmc = VTABLE_get_attr_str(interp, task, CONST_STRING(interp, "type"));
- STRING * const type = VTABLE_get_string(interp, type_pmc);
+ PMC * const type_pmc = VTABLE_get_attr_str(INTERP, task, CONST_STRING(INTERP, "type"));
+ STRING * const type = VTABLE_get_string(INTERP, type_pmc);
}
@@ -175,8 +175,8 @@ Frees the scheduler's underlying struct.
*/
VTABLE void destroy() {
- UNUSED(SELF);
- UNUSED(interp);
+ UNUSED(SELF)
+ UNUSED(INTERP)
}
@@ -307,16 +307,16 @@ Returns a ResizablePMCArray containing pointers to all active tasks.
METHOD active_tasks() {
Parrot_Scheduler_attributes *sdata = PARROT_SCHEDULER(SELF);
- PMC * const tasks = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
- PMC * const iter = Parrot_pmc_new_init(interp, enum_class_HashIterator, sdata->all_tasks);
+ PMC * const tasks = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
+ PMC * const iter = Parrot_pmc_new_init(INTERP, enum_class_HashIterator, sdata->all_tasks);
- while (!VTABLE_get_bool(interp, iter)) {
- PMC * const pair = VTABLE_shift_pmc(interp, iter);
+ while (!VTABLE_get_bool(INTERP, iter)) {
+ PMC * const pair = VTABLE_shift_pmc(INTERP, iter);
PMC * task = PMCNULL;
- STRING * const value = CONST_STRING(interp, "value");
- Parrot_pcc_invoke_method_from_c_args(interp, pair,
+ STRING * const value = CONST_STRING(INTERP, "value");
+ Parrot_pcc_invoke_method_from_c_args(INTERP, pair,
value, "->P", &task);
- VTABLE_push_pmc(interp, tasks, task);
+ VTABLE_push_pmc(INTERP, tasks, task);
}
RETURN(PMC* tasks);
View
4 src/pmc/sub.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2011, Parrot Foundation.
+Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
@@ -334,8 +334,8 @@ now.> -DRS
*/
VTABLE INTVAL get_integer_keyed(PMC *key) {
- Parrot_Sub_attributes *sub;
UNUSED(key)
+ Parrot_Sub_attributes *sub;
PMC_get_sub(INTERP, SELF, sub);
return (INTVAL) (sub->seg->base.data);
View
36 src/pmc/undef.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2004-2011, Parrot Foundation.
+Copyright (C) 2004-2012, Parrot Foundation.
=head1 NAME
@@ -101,8 +101,8 @@ Returns 0.
*/
VTABLE INTVAL get_integer() {
- UNUSED(SELF);
- UNUSED(INTERP);
+ UNUSED(SELF)
+ UNUSED(INTERP)
return 0;
}
@@ -117,8 +117,8 @@ Returns 0.
*/
VTABLE INTVAL defined() {
- UNUSED(SELF);
- UNUSED(INTERP);
+ UNUSED(SELF)
+ UNUSED(INTERP)
return 0;
}
@@ -148,8 +148,8 @@ Returns 0.0.
*/
VTABLE FLOATVAL get_number() {
- UNUSED(SELF);
- UNUSED(INTERP);
+ UNUSED(SELF)
+ UNUSED(INTERP)
return 0.0;
}
@@ -179,7 +179,7 @@ Returns an empty string.
*/
VTABLE STRING *get_string() {
- UNUSED(SELF);
+ UNUSED(SELF)
Parrot_warn(INTERP, PARROT_WARNINGS_UNDEF_FLAG,
"Stringifying an Undef PMC");
@@ -212,8 +212,8 @@ Returns 0.
*/
VTABLE INTVAL get_bool() {
- UNUSED(SELF);
- UNUSED(INTERP);
+ UNUSED(SELF)
+ UNUSED(INTERP)
return 0;
}
@@ -228,8 +228,8 @@ Unknown. (TODO)
*/
VTABLE void share() {
- UNUSED(SELF);
- UNUSED(INTERP);
+ UNUSED(SELF)
+ UNUSED(INTERP)
/* see src/pmc/integer.pmc */
}
@@ -258,16 +258,16 @@ Returns 1 if the C<*value> is an Undef PMC, 0 otherwise.
*/
MULTI INTVAL is_equal(Undef value) {
- UNUSED(SELF);
- UNUSED(INTERP);
- UNUSED(value);
+ UNUSED(SELF)
+ UNUSED(INTERP)
+ UNUSED(value)
return 1;
}
MULTI INTVAL is_equal(DEFAULT value) {
- UNUSED(SELF);
- UNUSED(INTERP);
- UNUSED(value);
+ UNUSED(SELF)
+ UNUSED(INTERP)
+ UNUSED(value)
return 0;
}
}
View
2 src/string/api.c
@@ -700,7 +700,7 @@ STRING *encodingname)>
Given a buffer and an encoding, creates and returns a new string. If buffer is
NULL the result is a null string. Otherwise, the buffer should be a zero
terminated c-style string and its content must be valid for the encoding
-specified. If encoding is null, assume plaftorm encoding.
+specified. If encoding is null, assume platform encoding.
=cut
View
14 t/dynpmc/select.t
@@ -46,7 +46,7 @@ it to become ready for an I/O operation.
test_update()
test_read()
test_write()
- test_select()
+ test_select(osname)
end:
.end
@@ -151,6 +151,7 @@ it to become ready for an I/O operation.
.end
.sub 'test_select'
+ .param string osname
$S0 = 'README2'
$P9 = new 'String'
$P9 = 'FH1'
@@ -180,9 +181,16 @@ it to become ready for an I/O operation.
$P7 = $P6[2]
$I0 = $P7
- # passes on linux, cygwin, freebsd
- is($I0, 0, 'Test has_exception() for README2 (array index)', 'varies across OSes' :named('todo'))
+ if osname == 'linux' goto good
+ if osname == 'cygwin' goto good
+ if osname == 'freebsd' goto good
+ todo:
+ is($I0, 0, 'Test has_exception() for README2 (array index)', 'varies across OSes' :named('todo'))
+ goto out
+ good:
+ is($I0, 0, 'Test has_exception() for README2 (array index)')
+ out:
unlink($S0)
.end
View
12 t/library/mime_base64.t
@@ -1,5 +1,5 @@
#!./parrot
-# Copyright (C) 2006-2010, Parrot Foundation.
+# Copyright (C) 2006-2012, Parrot Foundation.
=head1 NAME
@@ -37,6 +37,8 @@ Test cases taken from base64.t of MIME::Base64.
.local pmc encode_decode_tests, decode_tests
encode_decode_tests = json.'compile'( <<'END_JSON' )
[ ["Hello, World!\n","SGVsbG8sIFdvcmxkIQo="],
+ ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ "YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh\nYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ=="],
["\u0000","AA=="],
["\u0001","AQ=="],
["\u0002","Ag=="],
@@ -304,8 +306,8 @@ Test cases taken from base64.t of MIME::Base64.
["aaa","YWFh"],
["aaa","YWFh"],
["Aladdin:open sesame","QWxhZGRpbjpvcGVuIHNlc2FtZQ=="],
- ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ=="],
- ["Multipurpose Internet Mail Extensions: The Base64 Content-Transfer-Encoding is designed to represent sequences of octets in a form that is not humanly readable. ","TXVsdGlwdXJwb3NlIEludGVybmV0IE1haWwgRXh0ZW5zaW9uczogVGhlIEJhc2U2NCBDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nIGlzIGRlc2lnbmVkIHRvIHJlcHJlc2VudCBzZXF1ZW5jZXMgb2Ygb2N0ZXRzIGluIGEgZm9ybSB0aGF0IGlzIG5vdCBodW1hbmx5IHJlYWRhYmxlLiA="]
+ ["Multipurpose Internet Mail Extensions: The Base64 Content-Transfer-Encoding is designed to represent sequences of octets in a form that is not humanly readable. ",
+ "TXVsdGlwdXJwb3NlIEludGVybmV0IE1haWwgRXh0ZW5zaW9uczogVGhlIEJhc2U2NCBDb250ZW50\nLVRyYW5zZmVyLUVuY29kaW5nIGlzIGRlc2lnbmVkIHRvIHJlcHJlc2VudCBzZXF1ZW5jZXMgb2Yg\nb2N0ZXRzIGluIGEgZm9ybSB0aGF0IGlzIG5vdCBodW1hbmx5IHJlYWRhYmxlLiA="]
]
END_JSON
@@ -342,6 +344,8 @@ END_JSON
comment = 'encode'
comment_count = count
comment = concat comment, comment_count
+ # comment = concat comment, " "
+ # comment = concat comment, plain
test_encode( plain, base64, comment )
comment = 'decode'
comment_count = count
@@ -406,7 +410,7 @@ END_JSON
=head1 AUTHOR
-Bernhard Schmalhofer <Bernhard Schmalhofer@gmx.de>
+Bernhard Schmalhofer <Bernhard Schmalhofer@gmx.de> and others.
=cut
View
25 t/op/stringu.t
@@ -1,11 +1,11 @@
#!perl
-# Copyright (C) 2001-2009, Parrot Foundation.
+# Copyright (C) 2001-2012, Parrot Foundation.
use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 47;
+use Parrot::Test tests => 48;
use Parrot::Config;
=head1 NAME
@@ -22,6 +22,27 @@ Tests Parrot unicode string system.
=cut
+pir_output_is(<<'CODE',<<'OUTPUT', 'non-ascii immc optimizer GH#837');
+.sub main
+ $S1 = utf8:"\x{a2}"
+ say $S1
+
+ concat $S1, unicode:"\x{a2}", unicode:"\x{a2}"
+ say $S1
+
+ concat $S2, unicode:"\x{a2}", "c"
+ say $S2
+
+ concat $S3, unicode:"\x{62}", unicode:"\x{62}"
+ say $S3
+.end
+CODE
+¢¢
+¢c
+bb
+OUTPUT
+
pir_output_is( <<'CODE', <<OUTPUT, "angstrom" );
.sub main :main
$P0 = getinterp
View
59 t/pmc/bytebuffer.t
@@ -1,5 +1,5 @@
#!./parrot
-# Copyright (C) 2010, Parrot Foundation.
+# Copyright (C) 2010-2012, Parrot Foundation.
=head1 NAME
@@ -21,7 +21,7 @@ Tests C<ByteBuffer> PMC..
.sub 'main' :main
.include 'test_more.pir'
- plan(46)
+ plan(57)
test_init()
test_set_string()
@@ -33,6 +33,7 @@ Tests C<ByteBuffer> PMC..
test_iterate()
test_invalid()
test_get_chars()
+ test_resize()
.end
################################################################
@@ -404,6 +405,60 @@ end:
throws_type(get_chars_oob, .EXCEPTION_OUT_OF_BOUNDS, 'get_chars out of bounds')
.end
+# GH 835
+.sub test_resize
+ .local int i
+ .local string s1, s2
+ s1 = 'ABC'
+ s2 = 'DEF'
+
+ .local pmc b_normal, b_resize_normal, b_init_size, b_resize_too_big
+ b_normal = new ['ByteBuffer']
+ b_resize_normal = new ['ByteBuffer']
+ b_init_size = new ['ByteBuffer'],4
+ b_resize_too_big = new ['ByteBuffer']
+
+ b_normal = s1
+ i = b_normal[0]
+ is(i, 65, 'simple init - no problem expected')
+ b_normal = s2
+ i = b_normal[0]
+ is(i, 68, 'reset string with new value')
+
+ b_resize_normal = s1
+ i = b_resize_normal[0]
+ is(i, 65, 'simple init - no problem expected')
+
+ # oddly also works resize to smaller values like 2,1,0
+ b_resize_normal = 3
+ b_resize_normal = s2
+ i = b_resize_normal[0]
+ is(i, 68, 'reset resized normal buff with new string')
+
+ b_init_size[0] = 65
+ b_init_size[1] = 66
+ b_init_size[2] = 67
+ # line below probably not needed but I shouldn't cause problem
+ b_init_size[3] = 0
+
+ i = b_init_size[0]
+ is(i, 65, 'simple init - no problem expected')
+
+ b_init_size = s2
+ i = b_init_size[0]
+ is(i, 68, 'reset sized buff with new string GH #835')
+
+ b_resize_too_big = s1
+ i = b_resize_too_big[0]
+ is(i, 65, 'simple init - no problem expected')
+
+ b_resize_too_big = 5
+ b_resize_too_big = s2
+ i = b_resize_too_big[0]
+ is(i, 68, 'reset resized too big buff with new string GH #835')
+.end
+
+
# Local Variables:
# mode: pir
# fill-column: 100
View
80 t/pmc/bytebuffer2.t
@@ -0,0 +1,80 @@
+#!./parrot
+# Copyright (C) 2012, Parrot Foundation.
+
+=head1 NAME
+
+t/pmc/bytebuffer2.t - Test ByteBuffer resize behaviour
+
+=head1 SYNOPSIS
+
+ % prove t/pmc/bytebuffer2.t
+
+=head1 DESCRIPTION
+
+This file must be seperate from F<t/pmc/bytebuffer.t> as calling the
+function from there does not expose this problem.
+
+=cut
+
+# GH 835
+.sub test :main
+ .include 'test_more.pir'
+ plan(8)
+
+ .local int i
+
+ .local string s1, s2
+ s1 = 'ABC'
+ s2 = 'DEF'
+
+ .local pmc b_normal, b_resize_normal, b_init_size, b_resize_too_big
+ b_normal = new ['ByteBuffer']
+ b_resize_normal = new ['ByteBuffer']
+ b_init_size = new ['ByteBuffer'],4
+ b_resize_too_big = new ['ByteBuffer']
+
+ b_normal = s1
+ i = b_normal[0]
+ is(i, 65, 'simple init - no problem expected')
+ b_normal = s2
+ i = b_normal[0]
+ is(i, 68, 'reset string with new value')
+
+ b_resize_normal = s1
+ i = b_resize_normal[0]
+ is(i, 65, 'simple init - no problem expected')
+
+ # oddly also works resize to smaller values like 2,1,0
+ b_resize_normal = 3
+ b_resize_normal = s2
+ i = b_resize_normal[0]
+ is(i, 68, 'reset resized normal buff with new string')
+
+ b_init_size[0] = 65
+ b_init_size[1] = 66
+ b_init_size[2] = 67
+ # line below probably not needed but I shouldn't cause problem
+ b_init_size[3] = 0
+
+ i = b_init_size[0]
+ is(i, 65, 'simple init - no problem expected')
+
+ b_init_size = s2
+ i = b_init_size[0]
+ is(i, 68, 'reset sized buff with new string GH #835')
+
+ b_resize_too_big = s1
+ i = b_resize_too_big[0]
+ is(i, 65, 'simple init - no problem expected')
+
+ b_resize_too_big = 5
+ b_resize_too_big = s2
+ i = b_resize_too_big[0]
+ is(i, 68, 'reset resized too big buff with new string GH #835')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
2 t/pmc/filehandle.t
@@ -163,7 +163,7 @@ CODE
OUT
SKIP: {
- skip 'no asynch calls yet' => 1;
+ skip 'no async calls yet' => 1;
pir_output_is( <<'CODE', <<'OUT', 'open and close - asynchronous' );
.sub 'test' :main
View
2 t/pmc/nci.t
@@ -1917,7 +1917,7 @@ OUTPUT
.local int current
wait:
# Give the scheduler a point to interrupt this Task
- # and switch to the asynchonous callback Task
+ # and switch to the asynchronous callback Task
pass
# Usually a single pass will be enough, but on a loaded system preemption
View
2 t/pmc/parrotio.t
@@ -81,7 +81,7 @@ OUT
unlink 'new_file';
SKIP: {
- skip 'no asynch calls yet' => 1;
+ skip 'no async calls yet' => 1;
pir_output_is( <<'CODE', <<'OUT', 'open and close - asynchronous' );
.sub 'test' :main
View
2 t/pmc/stringhandle.t
@@ -111,7 +111,7 @@ CODE
OUT
SKIP: {
- skip 'no asynch calls yet' => 1;
+ skip 'no async calls yet' => 1;
pir_output_is( <<'CODE', <<'OUT', 'open and close - asynchronous' );
.sub 'test' :main
View
39 t/steps/auto/libffi-01.t
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Test::More tests => 28;
+use Test::More tests => 17;
use Carp;
use lib qw( lib t/configure/testlib );
use_ok('config::auto::libffi');
@@ -93,43 +93,6 @@ $step->set_result(undef);
$conf->data->set( HAS_LIBFFI => undef );
$conf->data->set( has_libffi => undef );
-##### _handle_pkgconfig_exec #####
-
-my ($pkgconfig_exec, $verbose);
-
-$pkgconfig_exec = 1;
-$verbose = 0;
-$ret = $step->_handle_pkgconfig_exec( $conf, $pkgconfig_exec, $verbose);
-ok( $ret, '_handle_pkgconfig_exec() returned true' );
-ok( ! defined($step->result), 'result undefined as expected' );
-
-$pkgconfig_exec = 0;
-$verbose = 0;
-$ret = $step->_handle_pkgconfig_exec( $conf, $pkgconfig_exec, $verbose);
-ok( ! defined($ret), '_handle_pkgconfig_exec() returned undefined value' );
-is( $step->result, 'lack pkg-config', 'Got expected result' );
-ok( ! defined($conf->data->get( 'HAS_LIBFFI')), 'HAS_LIBFFI undef as expected');
-ok( ! defined($conf->data->get( 'has_libffi')), 'has_libffi undef as expected');
-
-{
- my ($stdout, $stderr);
- $pkgconfig_exec = 0;
- $verbose = 1;
- capture(
- sub { $ret =
- $step->_handle_pkgconfig_exec( $conf, $pkgconfig_exec, $verbose);
- },
- \$stdout,
- \$stderr,
- );
- ok( ! defined($ret), '_handle_pkgconfig_exec() returned undefined value' );
- is( $step->result, 'lack pkg-config', 'Got expected result' );
- ok( ! defined($conf->data->get( 'HAS_LIBFFI')), 'HAS_LIBFFI undef as expected');
- ok( ! defined($conf->data->get( 'has_libffi')), 'has_libffi undef as expected');
- like( $stdout, qr/Program 'pkg-config' needed for libffi/,
- "Got expected verbose output when pkg-config not found" );
-}
-
pass("Completed all tests in $0");
################### DOCUMENTATION ###################

0 comments on commit eaa1466

Please sign in to comment.