Patch: work around recent shs.h change

Anthony Green green@cygnus.com
Thu Feb 7 07:49:00 GMT 2002


This is my work-around for the recent changes which assume uint32_t
etc exist.  It will work for the vast majority of potential newlib
based embedded ports (32-bit int/8-bit char), and issue a compile time
error otherwise.  

Ok?  Or too gross?


2002-02-07  Anthony Green  <green@redhat.com>

	* configure.in: Add sizeof int and char tests.
	* configure: Rebuilt.
	* include/config.h.in: Rebuilt.
	* gnu/gcj/io/shs.h: Use SIZEOF_INT and SIZEOF_CHAR.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.111
diff -c -r1.111 configure.in
*** configure.in	2002/02/07 04:36:58	1.111
--- configure.in	2002/02/07 15:41:34
***************
*** 716,721 ****
--- 716,723 ----
  CPPFLAGS=$GCJ_SAVE_CPPFLAGS
  
  AC_COMPILE_CHECK_SIZEOF(void *)
+ AC_COMPILE_CHECK_SIZEOF(int)
+ AC_COMPILE_CHECK_SIZEOF(char)
  
  ZLIBS=
  ZDEPS=
Index: include/config.h.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/config.h.in,v
retrieving revision 1.37
diff -c -r1.37 config.h.in
*** config.h.in	2002/02/07 03:24:06	1.37
--- config.h.in	2002/02/07 15:41:34
***************
*** 412,417 ****
--- 415,426 ----
  
  /* The number of bytes in type void * */
  #undef SIZEOF_VOID_P
+ 
+ /* The number of bytes in type int */
+ #undef SIZEOF_INT
+ 
+ /* The number of bytes in type char */
+ #undef SIZEOF_CHAR
  
  /* Define if <inttypes.h> is available */
  #undef HAVE_INTTYPES_H
Index: gnu/gcj/io/shs.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/io/shs.h,v
retrieving revision 1.2
diff -c -r1.2 shs.h
*** shs.h	2002/02/07 05:01:29	1.2
--- shs.h	2002/02/07 15:41:34
***************
*** 20,25 ****
--- 20,36 ----
  #else
  # if HAVE_STDINT_H
  #  include <stdint.h>
+ # else
+ #  if SIZEOF_INT == 4
+ #   define uint32_t unsigned int
+ #  else
+ #   error Dont know how to define a 32-bit unsigned value.
+ #  endif
+ #  if SIZEOF_CHAR == 1
+ #   define uint8_t unsigned char
+ #  else
+ #   error Dont know how to define an 8-bit unsigned value.
+ #  endif
  # endif
  #endif

-- 
Anthony Green                                                        Red Hat
                                                       Sunnyvale, California



More information about the Java-patches mailing list