This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Generated files problems.
Hi,
Steve Kargl schrieb:
>> Index: gcc-4.2/libgfortran/mk-sik-inc.sh
>> ===================================================================
>> --- gcc-4.2/libgfortran/mk-sik-inc.sh (revision 116946)
>> +++ gcc-4.2/libgfortran/mk-sik-inc.sh (working copy)
>> @@ -14,6 +14,7 @@ for k in $possible_kinds; do
>> fi
>> rm -f tmp$$.*
>> done
>> +[ "x$kinds" = "x" ] && exit 1
>>
>> echo " integer, parameter :: c = $c"
>> echo " type (int_info), parameter :: int_infos(c) = (/ &"
>>
> I'm neither a Bourne Shell programmer nor familiar
> with the generation of the kinds.f90 file. You should
> probably ping FX for a comment.
>
The syntax means:
Check whether "$kinds" is empty, and if it is, then exit. In order to
make sure this works
also with buggy shells, one does not compare "$kinds" with "", but
"x$kinds" with "x".
Still, I would prefer something along those lines:
if [ "x$kinds" = "x" ]; then
echo 'ERROR: $kind is not set!' 1>&2
exit 1
fi
That way one has an error message sent to STDERR.
The script simply checks whether "integer(kind=...) :: i; end" is
compilable and adds those kinds to the variable $kinds.
Is the following script ok?
Tobias
Index: libgfortran/mk-sik-inc.sh
===================================================================
--- libgfortran/mk-sik-inc.sh (Revision 117449)
+++ libgfortran/mk-sik-inc.sh (Arbeitskopie)
@@ -15,6 +15,11 @@
rm -f tmp$$.*
done
+if [ "x$kinds" = "x" ]; then
+ echo 'ERROR: mk-sik-inc.sh: No possible integer kind found!' 1>&2
+ exit 1
+fi
+
echo " integer, parameter :: c = $c"
echo " type (int_info), parameter :: int_infos(c) = (/ &"