diff --git a/modules/compiler_vm/languages/_c_base.pm b/modules/compiler_vm/languages/_c_base.pm index edd91556..71d12028 100755 --- a/modules/compiler_vm/languages/_c_base.pm +++ b/modules/compiler_vm/languages/_c_base.pm @@ -202,7 +202,7 @@ sub preprocess_code { my $has_main = 0; my $prelude = ''; - while($precode =~ s/^\s*(#.*\n{1,2})//g) { + while($precode =~ s/^\s*(#.*\n{1,2}|using.*\n{1,2})//g) { $prelude .= $1; } @@ -417,6 +417,8 @@ sub postprocess_output { $output =~ s/ called by gdb \(\) at statement: void gdb\(\) { __asm__\(""\); }//g; $output =~ s/called by \?\? \(\) //g; $output =~ s/\s0x[a-z0-9]+: note: pointer points here.*?\^//gms; + $output =~ s/\s0x[a-z0-9]+: note: pointer points here\s+//gms; + $output =~ s/store to address 0x[a-z0-9]+ with insufficient space/store to location with insufficient space/gms; my $removed_warning = 0; @@ -431,22 +433,6 @@ sub postprocess_output { $output =~ s/^\[\s+(warning:|info:)/[$1/; # remove leading spaces in first warning/info - # backspace - my $boutput = ""; - my $active_position = 0; - $output =~ s/\n$//; - while($output =~ /(.)/gms) { - my $c = $1; - if($c eq "\b") { - if(--$active_position <= 0) { - $active_position = 0; - } - next; - } - substr($boutput, $active_position++, 1) = $c; - } - $output = $boutput; - if($self->{warn_unterminated_define} == 1) { if($output =~ m/^\[(warning:|info:)/) { $output =~ s/^\[/[warning: preprocessor directive not terminated by \\n, the remainder of the line will be part of this directive /; diff --git a/modules/compiler_vm/languages/_default.pm b/modules/compiler_vm/languages/_default.pm index 8ad63be6..7639bb67 100755 --- a/modules/compiler_vm/languages/_default.pm +++ b/modules/compiler_vm/languages/_default.pm @@ -133,6 +133,22 @@ sub postprocess_output { print FILE "$self->{output}\n"; close FILE; } + + # backspace + my $boutput = ""; + my $active_position = 0; + $self->{output} =~ s/\n$//; + while($self->{output} =~ /(.)/gms) { + my $c = $1; + if($c eq "\b") { + if(--$active_position <= 0) { + $active_position = 0; + } + next; + } + substr($boutput, $active_position++, 1) = $c; + } + $self->{output} = $boutput; } sub show_output { diff --git a/modules/compiler_vm/languages/java.pm b/modules/compiler_vm/languages/java.pm index cc1653cd..33569044 100755 --- a/modules/compiler_vm/languages/java.pm +++ b/modules/compiler_vm/languages/java.pm @@ -256,29 +256,4 @@ sub preprocess_code { print "final code: [$self->{code}]\n" if $self->{debug}; } -sub postprocess_output { - my $self = shift; - $self->SUPER::postprocess_output; - - my $output = $self->{output}; - - # backspace - my $boutput = ""; - my $active_position = 0; - $output =~ s/\n$//; - while($output =~ /(.)/gms) { - my $c = $1; - if($c eq "\b") { - if(--$active_position <= 0) { - $active_position = 0; - } - next; - } - substr($boutput, $active_position++, 1) = $c; - } - $output = $boutput; - - $self->{output} = $output; -} - 1;