This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Resend: patch to detect ssize_t in configure
- To: gcc-patches at gcc dot gnu dot org
- Subject: Resend: patch to detect ssize_t in configure
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Fri, 26 May 2000 20:56:43 -0700
This seems to have slipped through the cracks; I need it in order to
do mmap-based file reading in cpplib.
zw
* configure.in: Add AC_CHECK_TYPE(ssize_t). Remove commented
out check for wchar_t.
* acconfig.h: Add template for ssize_t. Remove @TOP@.
* system.h: Add infrastructure for defining missing
TYPE_MAX/TYPE_MIN macros. Use it to provide fallback
definitions of UCHAR_MAX and SSIZE_MAX.
===================================================================
Index: configure.in
--- configure.in 2000/05/25 01:49:08 1.378
+++ configure.in 2000/05/27 03:52:53
@@ -473,8 +473,7 @@ AC_CHECK_FUNCS(strtoul bsearch putenv po
sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \
fputs_unlocked getrusage valloc)
-# Make sure wchar_t is available
-#AC_CHECK_TYPE(wchar_t, unsigned int)
+AC_CHECK_TYPE(ssize_t, int)
gcc_AC_FUNC_VFPRINTF_DOPRNT
gcc_AC_FUNC_PRINTF_PTR
===================================================================
Index: acconfig.h
--- acconfig.h 2000/04/26 00:03:37 1.48
+++ acconfig.h 2000/05/27 03:52:53
@@ -23,4 +23,5 @@
/* Define if your assembler uses the old HImode fild and fist notation. */
#undef HAVE_GAS_FILDS_FISTS
-@TOP@
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef ssize_t
===================================================================
Index: system.h
--- system.h 2000/05/23 17:42:18 1.70
+++ system.h 2000/05/27 03:52:53
@@ -234,6 +234,26 @@ extern int errno;
# endif /* defined(HOST_BITS_PER_LONG) && defined(HOST_BITS_PER_LONGLONG) */
#endif /* ! HOST_WIDEST_INT */
+/* Infrastructure for defining missing _MAX and _MIN macros. Note that
+ macros defined with these cannot be used in #if. */
+
+/* The extra casts work around common compiler bugs. */
+#define INTTYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
+ It is necessary at least when t == time_t. */
+#define INTTYPE_MINIMUM(t) ((t) (INTTYPE_SIGNED (t) \
+ ? ~ (t) 0 << (sizeof(t) * CHAR_BIT - 1) : (t) 0))
+#define INTTYPE_MAXIMUM(t) ((t) (~ (t) 0 - INTTYPE_MINIMUM (t)))
+
+/* Use that infrastructure to provide a few constants. */
+#ifndef UCHAR_MAX
+# define UCHAR_MAX INTTYPE_MAXIMUM (unsigned char)
+#endif
+
+#ifndef SSIZE_MAX
+# define SSIZE_MAX INTTYPE_MAXIMUM (ssize_t)
+#endif
+
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>