Skip to content

Commit

Permalink
The issue was that the "allargs" variable was not being used in the f…
Browse files Browse the repository at this point in the history
…inal command of the compiler wrapper. Any entries containing an escaped quote (\", \') or other non-matching argument (*) would not be passed to the compile line. I have fixed this problem by ensuring all arguments passed to the compiler wrapper are now included in the compile line.
  • Loading branch information
brtnfld committed Jan 23, 2024
1 parent 51f150a commit ffb6c3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
14 changes: 5 additions & 9 deletions bin/h5cc.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ host_os="@host_os@"

prog_name="`basename $0`"

allargs=""
misc_args=""
compile_args=""
libraries=""
link_args=""
Expand Down Expand Up @@ -202,7 +202,6 @@ for arg in $@ ; do

case "$arg" in
-c)
allargs="$allargs $arg"
compile_args="$compile_args $arg"

if test "x$do_link" = "xyes" -a -n "$output_file"; then
Expand All @@ -213,7 +212,6 @@ for arg in $@ ; do
dash_c="yes"
;;
-o)
allargs="$allargs $arg"
dash_o="yes"

if test "x$dash_c" = "xyes"; then
Expand All @@ -225,14 +223,12 @@ for arg in $@ ; do
fi
;;
-E|-M|-MT)
allargs="$allargs $arg"
compile_args="$compile_args $arg"
dash_c="yes"
do_link="no"
;;
-l*)
libraries=" $libraries $arg "
allargs="$allargs $arg"
;;
-prefix=*)
prefix="`expr "$arg" : '-prefix=\(.*\)'`"
Expand Down Expand Up @@ -264,14 +260,14 @@ for arg in $@ ; do
;;
*\"*)
qarg="'"$arg"'"
allargs="$allargs $qarg"
misc_args="$misc_args $qarg"
;;
*\'*)
qarg='\"'"$arg"'\"'
allargs="$allargs $qarg"
misc_args="$misc_args $qarg"
;;
*)
allargs="$allargs $qarg"
misc_args="$misc_args $qarg"

if test -s "$arg"; then
ext=`expr "$arg" : '.*\(\..*\)'`
Expand Down Expand Up @@ -313,7 +309,7 @@ if test "x$do_compile" = "xyes"; then
compile_args="-c $compile_args"
fi

$SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $compile_args
$SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $misc_args $compile_args
status=$?

if test "$status" != "0"; then
Expand Down
14 changes: 5 additions & 9 deletions fortran/src/h5fc.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ host_os="@host_os@"

prog_name="`basename $0`"

allargs=""
misc_args=""
compile_args=""
link_args=""
link_objs=""
Expand Down Expand Up @@ -176,7 +176,6 @@ for arg in $@ ; do

case "$arg" in
-c)
allargs="$allargs $arg"
compile_args="$compile_args $arg"

if test "x$do_link" = "xyes" -a -n "$output_file"; then
Expand All @@ -187,7 +186,6 @@ for arg in $@ ; do
dash_c="yes"
;;
-o)
allargs="$allargs $arg"
dash_o="yes"

if test "x$dash_c" = "xyes"; then
Expand All @@ -199,14 +197,12 @@ for arg in $@ ; do
fi
;;
-E|-M|-MT)
allargs="$allargs $arg"
compile_args="$compile_args $arg"
dash_c="yes"
do_link="no"
;;
-l*)
link_args="$link_args $arg"
allargs="$allargs $arg"
;;
-prefix=*)
prefix="`expr "$arg" : '-prefix=\(.*\)'`"
Expand Down Expand Up @@ -238,14 +234,14 @@ for arg in $@ ; do
;;
*\"*)
qarg="'"$arg"'"
allargs="$allargs $qarg"
misc_args="$misc_args $qarg"
;;
*\'*)
qarg='\"'"$arg"'\"'
allargs="$allargs $qarg"
misc_args="$misc_args $qarg"
;;

*) allargs="$allargs $arg"
*) misc_args="$misc_args $arg"
if [ -s "$arg" ] ; then
ext=`expr "$arg" : '.*\(\..*\)'`
if [ "$ext" = ".f" -o "$ext" = ".F" -o \
Expand Down Expand Up @@ -293,7 +289,7 @@ if test "x$do_compile" = "xyes"; then
fi


$SHOW $FC $H5BLD_FCFLAGS $FCFLAGS ${F9XSUFFIXFLAG} ${fmodules} $compile_args
$SHOW $FC $H5BLD_FCFLAGS $FCFLAGS ${F9XSUFFIXFLAG} ${fmodules} $misc_args $compile_args
status=$?

if test "$status" != "0"; then
Expand Down

0 comments on commit ffb6c3c

Please sign in to comment.