# HG changeset patch # User Tatsuki IHA # Date 1513849941 -32400 # Node ID 831b7f6fd68715dc36ea50cb0710e41f4510faa2 # Parent b6437feb04eea2b0bebefe6c10328f4c7dc2b625 Fix warning pointer type diff -r b6437feb04ee -r 831b7f6fd687 src/parallel_execution/examples/calc/calc.cbc --- a/src/parallel_execution/examples/calc/calc.cbc Thu Dec 21 00:34:25 2017 +0900 +++ b/src/parallel_execution/examples/calc/calc.cbc Thu Dec 21 18:52:21 2017 +0900 @@ -32,7 +32,7 @@ goto initDataGears(context, loopCounter, taskManager); } -__code code1(struct Time* time) { +__code code1(struct Timer* timer) { printf("cpus:\t\t%d\n", cpu_num); printf("gpus:\t\t%d\n", gpu_num); printf("length:\t\t%d\n", length); @@ -48,7 +48,7 @@ } __code code1_stub(struct Context* context) { - goto code1(context, Gearef(context, Time)); + goto code1(context, Gearef(context, Timer)); } diff -r b6437feb04ee -r 831b7f6fd687 src/parallel_execution/generate_stub.pl --- a/src/parallel_execution/generate_stub.pl Thu Dec 21 00:34:25 2017 +0900 +++ b/src/parallel_execution/generate_stub.pl Thu Dec 21 18:52:21 2017 +0900 @@ -162,12 +162,13 @@ my $next = $2; my @args = split(/,/,$3); push(@{$code{$name}->{$method}},"\_\_code $next"); - } elsif ($args =~ s/^(struct|union)?\s*(\w+)(\*)*+\s(\w+)//) { + } elsif ($args =~ s/^(struct|union)?\s*(\w+)(\**)\s+(\w+)//) { my $structType = $1; my $typeName = $2; + my $ptrType = $3; my $varName = $4; my $typeField = lcfirst($typeName); - push(@{$code{$name}->{$method}},"$typeName $varName"); + push(@{$code{$name}->{$method}},"$typeName$ptrType $varName"); } elsif ($args =~ s/(.*,)//) { } else { last; @@ -211,7 +212,7 @@ } sub generateStubArgs { - my($codeGearName, $varName, $typeName, $typeField, $interface,$output) = @_; + my($codeGearName, $varName, $typeName, $ptrType, $typeField, $interface,$output) = @_; my $varname1 = $output?"O_$varName":$varName; for my $n ( @{$dataGearVar{$codeGearName}} ) { # we already have it @@ -228,12 +229,12 @@ if ($varName eq $ivar) { if ($typeName eq $var{$interface}->{$ivar}) { if ($output) { - $dataGearName{$codeGearName} .= "\t$typeName** O_$varName = &Gearef(context, $interface)->$varName;\n"; - $outputVar{$codeGearName} .= "\t$typeName* $varName;\n"; + $dataGearName{$codeGearName} .= "\t$typeName$ptrType* O_$varName = &Gearef(context, $interface)->$varName;\n"; + $outputVar{$codeGearName} .= "\t$typeName$ptrType $varName;\n"; return 1; } - $dataGearName{$codeGearName} .= "\t$typeName* $varName = Gearef(context, $interface)->$varName;\n"; + $dataGearName{$codeGearName} .= "\t$typeName$ptrType $varName = Gearef(context, $interface)->$varName;\n"; return 1; } } @@ -247,10 +248,10 @@ } # global or local variable case if ($typeName eq "Code") { - $dataGearName{$codeGearName} .= "\tenum $typeName $varName = Gearef(context, $interface)->$varName;\n"; + $dataGearName{$codeGearName} .= "\tenum $typeName$ptrType $varName = Gearef(context, $interface)->$varName;\n"; return 1; } - $dataGearName{$codeGearName} .= "\t$typeName* $varName = Gearef(context, $typeName);\n"; + $dataGearName{$codeGearName} .= "\t$typeName$ptrType $varName = Gearef(context, $typeName);\n"; return 1; } } @@ -340,7 +341,7 @@ if ($args =~ s/^(\s)*\_\_code\s+(\w+)\(([^)]*)\)//) { my $next = $2; my @args = split(/,/,$3); - if (&generateStubArgs($codeGearName, $next, "Code", $next, $interface,0) ) { + if (&generateStubArgs($codeGearName, $next, "Code", "", $next, $interface,0) ) { $newArgs .= "enum Code $next"; } # analyze continuation arguments @@ -349,23 +350,25 @@ for my $arg (@args) { $arg =~ s/^\s*//; last if ($arg =~ /\.\.\./); - $arg =~ s/^(struct|union) (\w+)(\*)+\s(\w+)//; + $arg =~ s/^(struct|union)? (\w+)(\**)\s(\w+)//; my $structType = $1; my $typeName = $2; + my $ptrType = $3; my $varName = $4; my $typeField = lcfirst($typeName); push(@{$outputArgs{$codeGearName}->{$next}}, $varName); - if (&generateStubArgs($codeGearName, $varName, $typeName, $typeField, $interface,1)) { + if (&generateStubArgs($codeGearName, $varName, $typeName, $ptrType, $typeField, $interface,1)) { $newArgs .= ",$structType $typeName **O_$varName"; } } - } elsif ($args =~ s/^(struct|union) (\w+)(\*)+\s(\w+)//) { + } elsif ($args =~ s/^(struct|union)? (\w+)(\**)\s(\w+)//) { my $structType = $1; my $typeName = $2; + my $ptrType = $3; my $varName = $4; my $typeField = lcfirst($typeName); $newArgs .= $&; # assuming no duplicate - &generateStubArgs($codeGearName, $varName, $typeName, $typeField, $interface,0); + &generateStubArgs($codeGearName, $varName, $typeName, $ptrType, $typeField, $interface,0); } elsif ($args =~ s/(.*,)//) { $newArgs .= $1; } else { @@ -427,8 +430,8 @@ } else { print $fd "\tGearef(context, $ntype)->$pName = C_$arg;\n"; } - } elsif ($pType =~ s/Data$//){ - print $fd "\tGearef(context, $ntype)->$pName = (union Data*) $arg;\n"; + } elsif ($pType =~ /Data\**$/){ + print $fd "\tGearef(context, $ntype)->$pName = (union $pType) $arg;\n"; } else { print $fd "\tGearef(context, $ntype)->$pName = $arg;\n"; } diff -r b6437feb04ee -r 831b7f6fd687 src/parallel_execution/test/multiDimIterator_test.cbc --- a/src/parallel_execution/test/multiDimIterator_test.cbc Thu Dec 21 00:34:25 2017 +0900 +++ b/src/parallel_execution/test/multiDimIterator_test.cbc Thu Dec 21 18:52:21 2017 +0900 @@ -2,6 +2,7 @@ #include #include #include +#include "Iterator.h" #include "../../context.h" diff -r b6437feb04ee -r 831b7f6fd687 src/parallel_execution/test/queue_test.cbc --- a/src/parallel_execution/test/queue_test.cbc Thu Dec 21 00:34:25 2017 +0900 +++ b/src/parallel_execution/test/queue_test.cbc Thu Dec 21 18:52:21 2017 +0900 @@ -1,4 +1,5 @@ #include "../../context.h" +#include "Queue.h" #include __code queueTest1(struct Queue* queue) { diff -r b6437feb04ee -r 831b7f6fd687 src/parallel_execution/test/rbTree_test.cbc --- a/src/parallel_execution/test/rbTree_test.cbc Thu Dec 21 00:34:25 2017 +0900 +++ b/src/parallel_execution/test/rbTree_test.cbc Thu Dec 21 18:52:21 2017 +0900 @@ -1,4 +1,5 @@ #include "../../context.h" +#include "Tree.h" /* #include */ __code rbTreeTest1(struct Tree* tree) { diff -r b6437feb04ee -r 831b7f6fd687 src/parallel_execution/test/stack_test.cbc --- a/src/parallel_execution/test/stack_test.cbc Thu Dec 21 00:34:25 2017 +0900 +++ b/src/parallel_execution/test/stack_test.cbc Thu Dec 21 18:52:21 2017 +0900 @@ -1,4 +1,5 @@ #include "../../context.h" +#include "Stack.h" #include __code stackTest1(struct Stack* stack) {