summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-11-07 15:18:09 -0700
committerKarl Williamson <khw@cpan.org>2020-11-10 13:36:37 -0700
commit26e4a9a975ccb9c9ffeb07e1e56ac4de33ec1f15 (patch)
treed67a206179036e0c1f5180cecd5d4812a600a517 /handy.h
parentc89051baac88bcc01fb8ac74db96934a4eff076c (diff)
downloadperl-26e4a9a975ccb9c9ffeb07e1e56ac4de33ec1f15.tar.gz
Fix defns of e.g. U8_MAX/MIN
Actually trying to compile these with Devel::PPPort revealed that there were combinations of the conditionals which led to some of the symbols not getting defined.
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h92
1 files changed, 56 insertions, 36 deletions
diff --git a/handy.h b/handy.h
index 62fc08c1cd..01e4b9678b 100644
--- a/handy.h
+++ b/handy.h
@@ -217,51 +217,71 @@ typedef I64TYPE I64;
typedef U64TYPE U64;
#endif
-#if defined(UINT8_MAX) && defined(INT16_MAX) && defined(INT32_MAX)
-
/* I8_MAX and I8_MIN constants are not defined, as I8 is an ambiguous type.
Please search CHAR_MAX in perl.h for further details. */
-#define U8_MAX UINT8_MAX
-#define U8_MIN UINT8_MIN
-
-#define I16_MAX INT16_MAX
-#define I16_MIN INT16_MIN
-#define U16_MAX UINT16_MAX
-#define U16_MIN UINT16_MIN
-
-#define I32_MAX INT32_MAX
-#define I32_MIN INT32_MIN
-#ifndef UINT32_MAX_BROKEN /* e.g. HP-UX with gcc messes this up */
-# define U32_MAX UINT32_MAX
+#ifdef UINT8_MAX
+# define U8_MAX UINT8_MAX
#else
-# define U32_MAX 4294967295U
+# define U8_MAX PERL_UCHAR_MAX
#endif
-#define U32_MIN UINT32_MIN
-
+#ifdef UINT8_MIN
+# define U8_MIN UINT8_MIN
#else
+# define U8_MIN PERL_UCHAR_MIN
+#endif
-/* I8_MAX and I8_MIN constants are not defined, as I8 is an ambiguous type.
- Please search CHAR_MAX in perl.h for further details. */
-#define U8_MAX PERL_UCHAR_MAX
-#define U8_MIN PERL_UCHAR_MIN
-
-#define I16_MAX PERL_SHORT_MAX
-#define I16_MIN PERL_SHORT_MIN
-#define U16_MAX PERL_USHORT_MAX
-#define U16_MIN PERL_USHORT_MIN
-
-#if LONGSIZE > 4
-# define I32_MAX PERL_INT_MAX
-# define I32_MIN PERL_INT_MIN
-# define U32_MAX PERL_UINT_MAX
-# define U32_MIN PERL_UINT_MIN
+#ifdef INT16_MAX
+# define I16_MAX INT16_MAX
+#else
+# define I16_MAX PERL_SHORT_MAX
+#endif
+#ifdef INT16_MIN
+# define I16_MIN INT16_MIN
+#else
+# define I16_MIN PERL_SHORT_MIN
+#endif
+#ifdef UINT16_MAX
+# define U16_MAX UINT16_MAX
+#else
+# define U16_MAX PERL_USHORT_MAX
+#endif
+#ifdef UINT16_MIN
+# define U16_MIN UINT16_MIN
#else
-# define I32_MAX PERL_LONG_MAX
-# define I32_MIN PERL_LONG_MIN
-# define U32_MAX PERL_ULONG_MAX
-# define U32_MIN PERL_ULONG_MIN
+# define U16_MIN PERL_USHORT_MIN
#endif
+#ifdef INT32_MAX
+# define I32_MAX INT32_MAX
+#elif LONGSIZE > 4
+# define I32_MAX PERL_INT_MAX
+#else
+# define I32_MAX PERL_LONG_MAX
+#endif
+#ifdef INT32_MIN
+# define I32_MIN INT32_MIN
+#elif LONGSIZE > 4
+# define I32_MIN PERL_INT_MIN
+#else
+# define I32_MIN PERL_LONG_MIN
+#endif
+#ifdef UINT32_MAX
+# ifndef UINT32_MAX_BROKEN /* e.g. HP-UX with gcc messes this up */
+# define U32_MAX UINT_MAX
+# else
+# define U32_MAX 4294967295U
+# endif
+#elif LONGSIZE > 4
+# define U32_MAX PERL_UINT_MAX
+#else
+# define U32_MAX PERL_ULONG_MAX
+#endif
+#ifdef UINT32_MIN
+# define U32_MIN UINT32_MIN
+#elif LONGSIZE > 4
+# define U32_MIN PERL_UINT_MIN
+#else
+# define U32_MIN PERL_ULONG_MIN
#endif
/* These C99 typedefs are useful sometimes for, say, loop variables whose