From 48c4590306dbc7fb14283de233d730d418cd8fde Mon Sep 17 00:00:00 2001 From: carns Date: Fri, 1 Apr 2011 18:46:14 +0000 Subject: [PATCH] Fix bug reported by Rob Latham: the darshan-gen*.pl scripts should detect the -v output of the input script and produce the same -v output in the output script. fixes #33 git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@427 3b7491f3-a168-0410-bf4b-c445ed680a29 --- darshan-gen-cc.pl.in | 22 ++++++++++++++++++++++ darshan-gen-cxx.pl.in | 22 ++++++++++++++++++++++ darshan-gen-fortran.pl.in | 22 ++++++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/darshan-gen-cc.pl.in b/darshan-gen-cc.pl.in index a979e6c..4188fdb 100644 --- a/darshan-gen-cc.pl.in +++ b/darshan-gen-cc.pl.in @@ -37,6 +37,15 @@ if (!($link_cmd)) exit(1); } +# we just want the first line of output from the mpi script's -v argument; +# the rest we assume will be generated by the underlying compiler +my $version_out = `$input_file -v 2>/dev/null |head -n 1`; +if (!($version_out)) +{ + printf STDERR "Error: failed to invoke $input_file with -v\n"; + exit(1); +} + # check command lines for accuracy if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) { @@ -45,6 +54,7 @@ if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) } chomp($compile_cmd); chomp($link_cmd); +chomp($version_out); # # Incomprehensible re to eat the leading path of the compiler command @@ -128,6 +138,18 @@ for arg in "$@" ; do # The compiler links by default linking=no ;; + -v) + # Pass this argument to the compiler as well. +EOF +print OUTPUT<<"EOF"; + echo "$version_out" +EOF +print OUTPUT<<'EOF'; + # if there is only 1 argument, it must be -v. + if [ "$#" -eq "1" ] ; then + linking=no + fi + ;; -show) addarg=no Show=echo diff --git a/darshan-gen-cxx.pl.in b/darshan-gen-cxx.pl.in index 48d8234..b423b1d 100644 --- a/darshan-gen-cxx.pl.in +++ b/darshan-gen-cxx.pl.in @@ -37,6 +37,15 @@ if (!($link_cmd)) exit(1); } +# we just want the first line of output from the mpi script's -v argument; +# the rest we assume will be generated by the underlying compiler +my $version_out = `$input_file -v 2>/dev/null |head -n 1`; +if (!($version_out)) +{ + printf STDERR "Error: failed to invoke $input_file with -v\n"; + exit(1); +} + # check command lines for accuracy if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) { @@ -45,6 +54,7 @@ if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) } chomp($compile_cmd); chomp($link_cmd); +chomp($version_out); # # Incomprehensible re to eat the leading path of the compiler command @@ -128,6 +138,18 @@ for arg in "$@" ; do # The compiler links by default linking=no ;; + -v) + # Pass this argument to the compiler as well. +EOF +print OUTPUT<<"EOF"; + echo "$version_out" +EOF +print OUTPUT<<'EOF'; + # if there is only 1 argument, it must be -v. + if [ "$#" -eq "1" ] ; then + linking=no + fi + ;; -show) addarg=no Show=echo diff --git a/darshan-gen-fortran.pl.in b/darshan-gen-fortran.pl.in index 7b33bdd..e8cfce1 100644 --- a/darshan-gen-fortran.pl.in +++ b/darshan-gen-fortran.pl.in @@ -37,6 +37,15 @@ if (!($link_cmd)) exit(1); } +# we just want the first line of output from the mpi script's -v argument; +# the rest we assume will be generated by the underlying compiler +my $version_out = `$input_file -v 2>/dev/null |head -n 1`; +if (!($version_out)) +{ + printf STDERR "Error: failed to invoke $input_file with -v\n"; + exit(1); +} + # check command lines for accuracy if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) { @@ -45,6 +54,7 @@ if(!($compile_cmd =~ /-c foo.c/) || !($link_cmd =~ /foo.o -o foo/)) } chomp($compile_cmd); chomp($link_cmd); +chomp($version_out); # # Incomprehensible re to eat the leading path of the compiler command @@ -128,6 +138,18 @@ for arg in "$@" ; do # The compiler links by default linking=no ;; + -v) + # Pass this argument to the compiler as well. +EOF +print OUTPUT<<"EOF"; + echo "$version_out" +EOF +print OUTPUT<<'EOF'; + # if there is only 1 argument, it must be -v. + if [ "$#" -eq "1" ] ; then + linking=no + fi + ;; -show) addarg=no Show=echo -- 2.26.2