This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: h8300-elf: Incorrect value of UINT_MAX for -mh -mint32 target.


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

> 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__
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]