Commit 44720bef by Janne Blomqvist

Cleanup memsize types

From-SVN: r172340
parent 99ee0251
2011-04-12 Janne Blomqvist <jb@gcc.gnu.org> 2011-04-12 Janne Blomqvist <jb@gcc.gnu.org>
* configure.ac: Use AC_TYPE_* to make sure we have (u)intptr_t,
check for ptrdiff_t.
* libgfortran.h: Remove (u)intptr_t definitions, use ptrdiff_t for
index_type, change cshift0* prototypes.
* config.h.in: Regenerated.
* configure: Regenerated.
* intrinsics/cshift0.c (cshift0): Use ptrdiff_t instead of ssize_t.
* io/io.h (array_loop_spec): Use index_type instead of ssize_t.
* io/list_read.c (nml_parse_qualifier): Likewise.
* io/write.c (nml_write_obj): Likewise.
* m4/cshift0.c (cshift0_'rtype_code`): Likewise.
* generated/cshift0_*.c: Regenerated.
2011-04-12 Janne Blomqvist <jb@gcc.gnu.org>
* Makefile.am: Remove _GNU_SOURCE from AM_CPPFLAGS. * Makefile.am: Remove _GNU_SOURCE from AM_CPPFLAGS.
* Makefile.in: Regenerated. * Makefile.in: Regenerated.
......
...@@ -630,6 +630,9 @@ ...@@ -630,6 +630,9 @@
/* libm includes powl */ /* libm includes powl */
#undef HAVE_POWL #undef HAVE_POWL
/* Define to 1 if the system has the type `ptrdiff_t'. */
#undef HAVE_PTRDIFF_T
/* Define to 1 if you have the <pwd.h> header file. */ /* Define to 1 if you have the <pwd.h> header file. */
#undef HAVE_PWD_H #undef HAVE_PWD_H
...@@ -945,5 +948,13 @@ ...@@ -945,5 +948,13 @@
/* Define to 1 if you need to in order for `stat' and other things to work. */ /* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE #undef _POSIX_SOURCE
/* Define to the type of a signed integer type wide enough to hold a pointer,
if such a type exists, and if the system does not define it. */
#undef intptr_t
/* Define to `long int' if <sys/types.h> does not define. */ /* Define to `long int' if <sys/types.h> does not define. */
#undef off_t #undef off_t
/* Define to the type of an unsigned integer type wide enough to hold a
pointer, if such a type exists, and if the system does not define it. */
#undef uintptr_t
...@@ -15634,6 +15634,8 @@ rm -rf conftest* ...@@ -15634,6 +15634,8 @@ rm -rf conftest*
fi fi
fi fi
# Types
ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
if test "x$ac_cv_type_off_t" = x""yes; then : if test "x$ac_cv_type_off_t" = x""yes; then :
...@@ -15646,6 +15648,87 @@ _ACEOF ...@@ -15646,6 +15648,87 @@ _ACEOF
fi fi
ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
if test "x$ac_cv_type_intptr_t" = x""yes; then :
$as_echo "#define HAVE_INTPTR_T 1" >>confdefs.h
else
for ac_type in 'int' 'long int' 'long long int'; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
test_array [0] = 0
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
cat >>confdefs.h <<_ACEOF
#define intptr_t $ac_type
_ACEOF
ac_type=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test -z "$ac_type" && break
done
fi
ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default"
if test "x$ac_cv_type_uintptr_t" = x""yes; then :
$as_echo "#define HAVE_UINTPTR_T 1" >>confdefs.h
else
for ac_type in 'unsigned int' 'unsigned long int' \
'unsigned long long int'; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))];
test_array [0] = 0
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
cat >>confdefs.h <<_ACEOF
#define uintptr_t $ac_type
_ACEOF
ac_type=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test -z "$ac_type" && break
done
fi
ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default"
if test "x$ac_cv_type_ptrdiff_t" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PTRDIFF_T 1
_ACEOF
fi
# check header files # check header files
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; } $as_echo_n "checking for ANSI C header files... " >&6; }
...@@ -16404,28 +16487,6 @@ fi ...@@ -16404,28 +16487,6 @@ fi
done done
# Check for types
ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
if test "x$ac_cv_type_intptr_t" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_INTPTR_T 1
_ACEOF
fi
ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default"
if test "x$ac_cv_type_uintptr_t" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UINTPTR_T 1
_ACEOF
fi
# Check libc for getgid, getpid, getuid # Check libc for getgid, getpid, getuid
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgid in -lc" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgid in -lc" >&5
$as_echo_n "checking for getgid in -lc... " >&6; } $as_echo_n "checking for getgid in -lc... " >&6; }
......
...@@ -236,7 +236,12 @@ AC_SUBST(extra_ldflags_libgfortran) ...@@ -236,7 +236,12 @@ AC_SUBST(extra_ldflags_libgfortran)
LIBGFOR_WORKING_GFORTRAN LIBGFOR_WORKING_GFORTRAN
AC_SYS_LARGEFILE AC_SYS_LARGEFILE
# Types
AC_TYPE_OFF_T AC_TYPE_OFF_T
AC_TYPE_INTPTR_T
AC_TYPE_UINTPTR_T
AC_CHECK_TYPES([ptrdiff_t])
# check header files # check header files
AC_STDC_HEADERS AC_STDC_HEADERS
...@@ -264,10 +269,6 @@ AC_CHECK_FUNCS(clock_gettime strftime) ...@@ -264,10 +269,6 @@ AC_CHECK_FUNCS(clock_gettime strftime)
# Check for glibc backtrace functions # Check for glibc backtrace functions
AC_CHECK_FUNCS(backtrace backtrace_symbols) AC_CHECK_FUNCS(backtrace backtrace_symbols)
# Check for types
AC_CHECK_TYPES([intptr_t])
AC_CHECK_TYPES([uintptr_t])
# Check libc for getgid, getpid, getuid # Check libc for getgid, getpid, getuid
AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])]) AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])])
AC_CHECK_LIB([c],[getpid],[AC_DEFINE([HAVE_GETPID],[1],[libc includes getpid])]) AC_CHECK_LIB([c],[getpid],[AC_DEFINE([HAVE_GETPID],[1],[libc includes getpid])])
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_COMPLEX_10) #if defined (HAVE_GFC_COMPLEX_10)
void void
cshift0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, ssize_t shift, cshift0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_COMPLEX_16) #if defined (HAVE_GFC_COMPLEX_16)
void void
cshift0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, ssize_t shift, cshift0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_COMPLEX_4) #if defined (HAVE_GFC_COMPLEX_4)
void void
cshift0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, ssize_t shift, cshift0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_COMPLEX_8) #if defined (HAVE_GFC_COMPLEX_8)
void void
cshift0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, ssize_t shift, cshift0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_INTEGER_1) #if defined (HAVE_GFC_INTEGER_1)
void void
cshift0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, ssize_t shift, cshift0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_INTEGER_16) #if defined (HAVE_GFC_INTEGER_16)
void void
cshift0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, ssize_t shift, cshift0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_INTEGER_2) #if defined (HAVE_GFC_INTEGER_2)
void void
cshift0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, ssize_t shift, cshift0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_INTEGER_4) #if defined (HAVE_GFC_INTEGER_4)
void void
cshift0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, ssize_t shift, cshift0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_INTEGER_8) #if defined (HAVE_GFC_INTEGER_8)
void void
cshift0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, ssize_t shift, cshift0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_REAL_10) #if defined (HAVE_GFC_REAL_10)
void void
cshift0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, ssize_t shift, cshift0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_REAL_16) #if defined (HAVE_GFC_REAL_16)
void void
cshift0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, ssize_t shift, cshift0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_REAL_4) #if defined (HAVE_GFC_REAL_4)
void void
cshift0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, ssize_t shift, cshift0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -32,7 +32,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined (HAVE_GFC_REAL_8) #if defined (HAVE_GFC_REAL_8)
void void
cshift0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, ssize_t shift, cshift0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -97,7 +97,7 @@ cshift0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, ssize_t shift, ...@@ -97,7 +97,7 @@ cshift0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -30,7 +30,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -30,7 +30,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
static void static void
cshift0 (gfc_array_char * ret, const gfc_array_char * array, cshift0 (gfc_array_char * ret, const gfc_array_char * array,
ssize_t shift, int which, index_type size) ptrdiff_t shift, int which, index_type size)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
index_type rstride[GFC_MAX_DIMENSIONS]; index_type rstride[GFC_MAX_DIMENSIONS];
...@@ -328,7 +328,7 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array, ...@@ -328,7 +328,7 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
...@@ -53,22 +53,21 @@ struct gfc_unit; ...@@ -53,22 +53,21 @@ struct gfc_unit;
#define is_char4_unit(dtp) ((dtp)->u.p.unit_is_internal && (dtp)->common.unit) #define is_char4_unit(dtp) ((dtp)->u.p.unit_is_internal && (dtp)->common.unit)
/* The array_loop_spec contains the variables for the loops over index ranges /* The array_loop_spec contains the variables for the loops over index ranges
that are encountered. Since the variables can be negative, ssize_t that are encountered. */
is used. */
typedef struct array_loop_spec typedef struct array_loop_spec
{ {
/* Index counter for this dimension. */ /* Index counter for this dimension. */
ssize_t idx; index_type idx;
/* Start for the index counter. */ /* Start for the index counter. */
ssize_t start; index_type start;
/* End for the index counter. */ /* End for the index counter. */
ssize_t end; index_type end;
/* Step for the index counter. */ /* Step for the index counter. */
ssize_t step; index_type step;
} }
array_loop_spec; array_loop_spec;
......
...@@ -2172,7 +2172,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, ...@@ -2172,7 +2172,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
} }
/* Now read the index. */ /* Now read the index. */
if (convert_integer (dtp, sizeof(ssize_t), neg)) if (convert_integer (dtp, sizeof(index_type), neg))
{ {
if (is_char) if (is_char)
sprintf (parse_err_msg, "Bad integer substring qualifier"); sprintf (parse_err_msg, "Bad integer substring qualifier");
...@@ -2187,11 +2187,11 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, ...@@ -2187,11 +2187,11 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
if (!null_flag) if (!null_flag)
{ {
if (indx == 0) if (indx == 0)
memcpy (&ls[dim].start, dtp->u.p.value, sizeof(ssize_t)); memcpy (&ls[dim].start, dtp->u.p.value, sizeof(index_type));
if (indx == 1) if (indx == 1)
memcpy (&ls[dim].end, dtp->u.p.value, sizeof(ssize_t)); memcpy (&ls[dim].end, dtp->u.p.value, sizeof(index_type));
if (indx == 2) if (indx == 2)
memcpy (&ls[dim].step, dtp->u.p.value, sizeof(ssize_t)); memcpy (&ls[dim].step, dtp->u.p.value, sizeof(index_type));
} }
/* Singlet or doublet indices. */ /* Singlet or doublet indices. */
...@@ -2199,7 +2199,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, ...@@ -2199,7 +2199,7 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
{ {
if (indx == 0) if (indx == 0)
{ {
memcpy (&ls[dim].start, dtp->u.p.value, sizeof(ssize_t)); memcpy (&ls[dim].start, dtp->u.p.value, sizeof(index_type));
/* If -std=f95/2003 or an array section is specified, /* If -std=f95/2003 or an array section is specified,
do not allow excess data to be processed. */ do not allow excess data to be processed. */
...@@ -2229,10 +2229,10 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad, ...@@ -2229,10 +2229,10 @@ nml_parse_qualifier (st_parameter_dt *dtp, descriptor_dimension *ad,
} }
/* Check the values of the triplet indices. */ /* Check the values of the triplet indices. */
if ((ls[dim].start > (ssize_t) GFC_DIMENSION_UBOUND(ad[dim])) if ((ls[dim].start > GFC_DIMENSION_UBOUND(ad[dim]))
|| (ls[dim].start < (ssize_t) GFC_DIMENSION_LBOUND(ad[dim])) || (ls[dim].start < GFC_DIMENSION_LBOUND(ad[dim]))
|| (ls[dim].end > (ssize_t) GFC_DIMENSION_UBOUND(ad[dim])) || (ls[dim].end > GFC_DIMENSION_UBOUND(ad[dim]))
|| (ls[dim].end < (ssize_t) GFC_DIMENSION_LBOUND(ad[dim]))) || (ls[dim].end < GFC_DIMENSION_LBOUND(ad[dim])))
{ {
if (is_char) if (is_char)
sprintf (parse_err_msg, "Substring out of range"); sprintf (parse_err_msg, "Substring out of range");
......
...@@ -1932,7 +1932,7 @@ obj_loop: ...@@ -1932,7 +1932,7 @@ obj_loop:
{ {
obj->ls[dim_i].idx += nml_carry ; obj->ls[dim_i].idx += nml_carry ;
nml_carry = 0; nml_carry = 0;
if (obj->ls[dim_i].idx > (ssize_t) GFC_DESCRIPTOR_UBOUND(obj,dim_i)) if (obj->ls[dim_i].idx > GFC_DESCRIPTOR_UBOUND(obj,dim_i))
{ {
obj->ls[dim_i].idx = GFC_DESCRIPTOR_LBOUND(obj,dim_i); obj->ls[dim_i].idx = GFC_DESCRIPTOR_LBOUND(obj,dim_i);
nml_carry = 1; nml_carry = 1;
......
...@@ -106,38 +106,11 @@ typedef off_t gfc_offset; ...@@ -106,38 +106,11 @@ typedef off_t gfc_offset;
#endif #endif
/* We use intptr_t and uintptr_t, which may not be always defined in /* Make sure we have ptrdiff_t. */
system headers. */ #ifndef HAVE_PTRDIFF_T
typedef intptr_t ptrdiff_t;
#ifndef HAVE_INTPTR_T
#if __SIZEOF_POINTER__ == __SIZEOF_LONG__
#define intptr_t long
#elif __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__
#define intptr_t long long
#elif __SIZEOF_POINTER__ == __SIZEOF_INT__
#define intptr_t int
#elif __SIZEOF_POINTER__ == __SIZEOF_SHORT__
#define intptr_t short
#else
#error "Pointer type with unexpected size"
#endif
#endif #endif
#ifndef HAVE_UINTPTR_T
#if __SIZEOF_POINTER__ == __SIZEOF_LONG__
#define uintptr_t unsigned long
#elif __SIZEOF_POINTER__ == __SIZEOF_LONG_LONG__
#define uintptr_t unsigned long long
#elif __SIZEOF_POINTER__ == __SIZEOF_INT__
#define uintptr_t unsigned int
#elif __SIZEOF_POINTER__ == __SIZEOF_SHORT__
#define uintptr_t unsigned short
#else
#error "Pointer type with unexpected size"
#endif
#endif
/* On mingw, work around the buggy Windows snprintf() by using the one /* On mingw, work around the buggy Windows snprintf() by using the one
mingw provides, __mingw_snprintf(). We also provide a prototype for mingw provides, __mingw_snprintf(). We also provide a prototype for
__mingw_snprintf(), because the mingw headers currently don't have one. */ __mingw_snprintf(), because the mingw headers currently don't have one. */
...@@ -269,7 +242,7 @@ typedef GFC_INTEGER_4 GFC_IO_INT; ...@@ -269,7 +242,7 @@ typedef GFC_INTEGER_4 GFC_IO_INT;
/* The following two definitions must be consistent with the types used /* The following two definitions must be consistent with the types used
by the compiler. */ by the compiler. */
/* The type used of array indices, amongst other things. */ /* The type used of array indices, amongst other things. */
typedef ssize_t index_type; typedef ptrdiff_t index_type;
/* The type used for the lengths of character variables. */ /* The type used for the lengths of character variables. */
typedef GFC_INTEGER_4 gfc_charlen_type; typedef GFC_INTEGER_4 gfc_charlen_type;
...@@ -1323,52 +1296,52 @@ internal_proto(count_0); ...@@ -1323,52 +1296,52 @@ internal_proto(count_0);
/* Internal auxiliary functions for cshift */ /* Internal auxiliary functions for cshift */
void cshift0_i1 (gfc_array_i1 *, const gfc_array_i1 *, ssize_t, int); void cshift0_i1 (gfc_array_i1 *, const gfc_array_i1 *, ptrdiff_t, int);
internal_proto(cshift0_i1); internal_proto(cshift0_i1);
void cshift0_i2 (gfc_array_i2 *, const gfc_array_i2 *, ssize_t, int); void cshift0_i2 (gfc_array_i2 *, const gfc_array_i2 *, ptrdiff_t, int);
internal_proto(cshift0_i2); internal_proto(cshift0_i2);
void cshift0_i4 (gfc_array_i4 *, const gfc_array_i4 *, ssize_t, int); void cshift0_i4 (gfc_array_i4 *, const gfc_array_i4 *, ptrdiff_t, int);
internal_proto(cshift0_i4); internal_proto(cshift0_i4);
void cshift0_i8 (gfc_array_i8 *, const gfc_array_i8 *, ssize_t, int); void cshift0_i8 (gfc_array_i8 *, const gfc_array_i8 *, ptrdiff_t, int);
internal_proto(cshift0_i8); internal_proto(cshift0_i8);
#ifdef HAVE_GFC_INTEGER_16 #ifdef HAVE_GFC_INTEGER_16
void cshift0_i16 (gfc_array_i16 *, const gfc_array_i16 *, ssize_t, int); void cshift0_i16 (gfc_array_i16 *, const gfc_array_i16 *, ptrdiff_t, int);
internal_proto(cshift0_i16); internal_proto(cshift0_i16);
#endif #endif
void cshift0_r4 (gfc_array_r4 *, const gfc_array_r4 *, ssize_t, int); void cshift0_r4 (gfc_array_r4 *, const gfc_array_r4 *, ptrdiff_t, int);
internal_proto(cshift0_r4); internal_proto(cshift0_r4);
void cshift0_r8 (gfc_array_r8 *, const gfc_array_r8 *, ssize_t, int); void cshift0_r8 (gfc_array_r8 *, const gfc_array_r8 *, ptrdiff_t, int);
internal_proto(cshift0_r8); internal_proto(cshift0_r8);
#ifdef HAVE_GFC_REAL_10 #ifdef HAVE_GFC_REAL_10
void cshift0_r10 (gfc_array_r10 *, const gfc_array_r10 *, ssize_t, int); void cshift0_r10 (gfc_array_r10 *, const gfc_array_r10 *, ptrdiff_t, int);
internal_proto(cshift0_r10); internal_proto(cshift0_r10);
#endif #endif
#ifdef HAVE_GFC_REAL_16 #ifdef HAVE_GFC_REAL_16
void cshift0_r16 (gfc_array_r16 *, const gfc_array_r16 *, ssize_t, int); void cshift0_r16 (gfc_array_r16 *, const gfc_array_r16 *, ptrdiff_t, int);
internal_proto(cshift0_r16); internal_proto(cshift0_r16);
#endif #endif
void cshift0_c4 (gfc_array_c4 *, const gfc_array_c4 *, ssize_t, int); void cshift0_c4 (gfc_array_c4 *, const gfc_array_c4 *, ptrdiff_t, int);
internal_proto(cshift0_c4); internal_proto(cshift0_c4);
void cshift0_c8 (gfc_array_c8 *, const gfc_array_c8 *, ssize_t, int); void cshift0_c8 (gfc_array_c8 *, const gfc_array_c8 *, ptrdiff_t, int);
internal_proto(cshift0_c8); internal_proto(cshift0_c8);
#ifdef HAVE_GFC_COMPLEX_10 #ifdef HAVE_GFC_COMPLEX_10
void cshift0_c10 (gfc_array_c10 *, const gfc_array_c10 *, ssize_t, int); void cshift0_c10 (gfc_array_c10 *, const gfc_array_c10 *, ptrdiff_t, int);
internal_proto(cshift0_c10); internal_proto(cshift0_c10);
#endif #endif
#ifdef HAVE_GFC_COMPLEX_16 #ifdef HAVE_GFC_COMPLEX_16
void cshift0_c16 (gfc_array_c16 *, const gfc_array_c16 *, ssize_t, int); void cshift0_c16 (gfc_array_c16 *, const gfc_array_c16 *, ptrdiff_t, int);
internal_proto(cshift0_c16); internal_proto(cshift0_c16);
#endif #endif
......
...@@ -33,7 +33,7 @@ include(iparm.m4)dnl ...@@ -33,7 +33,7 @@ include(iparm.m4)dnl
`#if defined (HAVE_'rtype_name`) `#if defined (HAVE_'rtype_name`)
void void
cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, ssize_t shift, cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, ptrdiff_t shift,
int which) int which)
{ {
/* r.* indicates the return array. */ /* r.* indicates the return array. */
...@@ -98,7 +98,7 @@ cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, ssize_t shift, ...@@ -98,7 +98,7 @@ cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, ssize_t shift,
rptr = ret->data; rptr = ret->data;
sptr = array->data; sptr = array->data;
shift = len == 0 ? 0 : shift % (ssize_t)len; shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
if (shift < 0) if (shift < 0)
shift += len; shift += len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment