X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/afa5e4f04e0a44b38ff45f846264d43da33fc40f..9e3bf4095effa793b9a28be8b13352b863d2482f:/src/smpi/smpif2c.in diff --git a/src/smpi/smpif2c.in b/src/smpi/smpif2c.in index 296ca198b0..ce1272a111 100755 --- a/src/smpi/smpif2c.in +++ b/src/smpi/smpif2c.in @@ -20,7 +20,8 @@ foreach my $fortran (@ARGV) { print $tmp "#define INTEGER_STAR_8\n"; print $tmp "#endif\n"; print $tmp "#include \n"; - print $tmp "#include \n"; + print $tmp "#include \n\n"; + print $tmp "int __attribute__((weak)) __rank(void) {\n static __thread int rank = -1;\n\n if(rank < 0) {\n rank = smpi_global_rank();\n }\n return rank;\n}\n\n"; while() { chomp; if(/\/\* Common Block Declarations \*\//) { @@ -30,7 +31,7 @@ foreach my $fortran (@ARGV) { if(/^} (.*?);/) { $_ = "}* __attribute__((weak)) $1 = NULL;\n"; } elsif(/^#define\s*(\S*)\s*\(?([^.]*)(\..*?)?\)?$/) { - $_ = "#define $1 $2\[smpi_global_rank()\]"; + $_ = "#define $1 $2\[__rank()\]"; if(defined $3) { $_ .= $3; }