X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/69dc94c6500722b122cf8e6649c598f3ecb5d663..6988262ccbe9e70f68f5649ca8a665171d454326:/tools/smpi/generate_smpi_defines.pl diff --git a/tools/smpi/generate_smpi_defines.pl b/tools/smpi/generate_smpi_defines.pl index 1306f45c0d..fefb7d0969 100755 --- a/tools/smpi/generate_smpi_defines.pl +++ b/tools/smpi/generate_smpi_defines.pl @@ -1,6 +1,7 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Copyright 2016 Vincent Danjean -# +# Christian Heinrich +# # Call this script like this: # C/C++ : ./generate_smpi_defines.pl ../../include/smpi/smpi.h # FORTRAN: ./generate_smpi_defines.pl -f ../../include/smpi/smpi.h @@ -11,7 +12,7 @@ # with MPI+TAU). use strict; use warnings; -use Getopt::Std; +use Getopt::Std; my %options=(); getopts("fc", \%options); @@ -25,7 +26,7 @@ if (defined $options{f}) { } print "$commentChar This file has been automatically generated by the script\n"; -print "$commentChar in tools/smpi/" . __FILE__ ."\n"; +print "$commentChar in tools/smpi/generate_smpi_defines.pl\n"; print "$commentChar DO NOT EDIT MANUALLY. ALL CHANGES WILL BE OVERWRITTEN!\n"; # Formatting of the output @@ -37,15 +38,11 @@ sub output_macro { # This is a GCC extension. The last statement is the value of the expression # in parentheses. if (defined $options{f}) { - print "#define ". uc($id) ." smpi_trace_set_call_location(__FILE__,__LINE__); call ". lc $id ."\n"; + print "#define ". lc($id) ." smpi_trace_set_call_location(__FILE__,__LINE__); call ". ucfirst $id ."\n"; + print "#define ". uc($id) ." smpi_trace_set_call_location(__FILE__,__LINE__); call ". ucfirst $id ."\n"; } else { - if ($id eq "MPI_Init") { - print "#define MPI_Init(...) ({ smpi_process_init(__VA_ARGS__); smpi_trace_set_call_location(__FILE__,__LINE__); MPI_Init(NULL, NULL); })\n"; - } - else { - print "#define $id(...) ({ smpi_trace_set_call_location(__FILE__,__LINE__); $id(__VA_ARGS__); })\n"; - } + print "#define $id(...) (smpi_trace_set_call_location(__FILE__, __LINE__), $id(__VA_ARGS__))\n"; } } @@ -59,7 +56,7 @@ while (defined($line = <>)) { } $incall=1; $wholemacro = $line; - } elsif ($incall && $line =~ /^\s+\S/) { + } elsif ($incall && $line =~ /^\s+\S/) { # Did we already start parsing an MPI_CALL macro? If so, just concatenate $wholemacro .= ' '.$line; } elsif ($incall) {