This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: h8300-elf: Incorrect value of UINT_MAX for -mh -mint32 target.
- From: "J. Johnston" <jjohnstn at redhat dot com>
- To: "Nitin Gupta, Noida" <niting at noida dot hcltech dot com>
- Cc: Kazu Hirata <kazu at cs dot umass dot edu>, newlib at sources dot redhat dot com,"D.Venkatasubramanian, Noida" <dvenkat at noida dot hcltech dot com>
- Date: Mon, 16 Dec 2002 16:11:52 -0500
- Subject: Re: h8300-elf: Incorrect value of UINT_MAX for -mh -mint32 target.
- Organization: Red Hat Inc.
- References: <E04CF3F88ACBD5119EFE00508BBB212106373FEA@exch-01.noida.hcltech.com>
Nitin Gupta, Noida wrote:
Hi Kazu,
Instead of absoule values for INT_MAX and UINT_MAX, the macro
__INT_MAX__ should be used for H8300 targets. The value of
__INT_MAX__ is appropriately defined in spec.
What about something like this? Is __INT_MAX__ always defined? We
should probably remove mentions of H8/300 in the preceeding block.
Thanks.
Yes, since __INT_MAX__ is always defined for H8300 targets this
would be more appropriate.
I was looking at the latest gcc code. The frame work of GCC would
define macros like __INT_MAX__ in c-common.c in cb_register_builtins().
(Earlier [gcc 3.1.1] it was being done in target specific files.)
Hence __INT_MAX__ "would" be defined for all the targets
appropriately. Doesn't it make sense to use __INT_MAX__ for all
the targets?
Thanks and Regards,
Nitin
I assume that __H8300__ was meant to be added to the H3800 macros below -
correct? It has been removed from the old test but not added to the new
code.
-- Jeff J.
Kazu Hirata
Index: config.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v
retrieving revision 1.34
diff -u -r1.34 config.h
--- config.h 11 Oct 2002 10:28:30 -0000 1.34
+++ config.h 13 Dec 2002 16:32:15 -0000
@@ -12,12 +12,19 @@
#endif
/* 16 bit integer machines */
-#if defined(__Z8001__) || defined(__Z8002__) ||
defined(__H8300__) || defined(__H8500__) || defined(__W65__)
|| defined (__H8300H__) || defined (__H8300S__) || defined
(__mn10200__) || defined (__AVR__)
+#if defined(__Z8001__) || defined(__Z8002__) ||
defined(__H8500__) || defined(__W65__) || defined
(__mn10200__) || defined (__AVR__)
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX 32767
#define UINT_MAX 65535
+#endif
+
+#if defined (__H8300H__) || defined(__H8300S__)
+#undef INT_MAX
+#undef UINT_MAX
+#define INT_MAX __INT_MAX__
+#define UINT_MAX (__INT_MAX__ * 2U + 1)
#endif
#ifdef __W65__