[LLVMdev] Constants.cpp:368: error: `INT8_MAX' undeclared(firstuse this function)

Henrik Bach henrik_bach_llvm at hotmail.com
Wed Jul 14 15:22:38 PDT 2004


>From: Chris Lattner <sabre at nondot.org>
>Date: Wed, 14 Jul 2004 14:49:01 -0500 (CDT)

>The file you need to modify is here:
>llvm/include/Support/DataTypes.h.in
>
>There is currently support for building in non-cygwin windows environments
>protected by _MSC_VER.  You just need to broaden the scope of the #ifndef
>to include internix.
>

Sorry, Chris, but my DataTypes.h.in doesn't seem to be that advanced (due to 
I'm porting LLVM 1.2). But, when I get one (nearby LLVM 1.3), I'll try to 
broaden the scope, when I know how to modify .in configuration files.

However, I've found that the min and max values for integral data types, for 
Interix 3.5 are defined in the system header file: '/usr/include/limits.h':

--- /usr/include/limits.h ---------------------
...
#define SCHAR_MIN	(-128)		/* min value for a signed char */
#define SCHAR_MAX	  127		/* max value for a signed char */
#define UCHAR_MAX	 0xff		/* max value for a unsigned char */

#if defined(_CHAR_UNSIGNED) || defined(__CHAR_UNSIGNED__)
#define CHAR_MIN	0
#define CHAR_MAX	UCHAR_MAX
#else
#define CHAR_MIN	SCHAR_MIN	/* mim value for a char */
#define CHAR_MAX	SCHAR_MAX	/* max value for a char */
#endif	/* _CHAR_UNSIGNED */


#define SHRT_MIN	(-32768)	/* min value for (signed) short */
#define SHRT_MAX	  32767 	/* max value for (signed) short */
#define USHRT_MAX	 0xffff	        /* max value for unsigned short */

#define INT_MIN 	(-2147483647-1) /* min value for (signed) int */
#define INT_MAX 	  2147483647	/* max value for (signed) int */
#define UINT_MAX	  0xffffffff	/* max value for unsigned int */

#define LONG_MIN	(-2147483647L-1) /* minimum (signed) long */
#define LONG_MAX	  2147483647L	/* maximum (signed) long */
#define ULONG_MAX	  0xffffffffUL	/* maximum unsigned long */

#if defined(_ALL_SOURCE) \
	|| (__STDC__ - 0 == 0) && !defined(_POSIX_C_SOURCE)  \
			       && !defined(_XOPEN_SOURCE)
/*
* Minimum and maximum values for 64-bit types
* Define all the various well-known flavors of symbols
*
*/
#define ULLONG_MAX       ((u_quad_t)0-1)	    /* 0xffffffffffffffff */
#define LLONG_MAX        ((quad_t)(ULLONG_MAX>>1))  /* 0x7fffffffffffffff */
#define LLONG_MIN        ((quad_t)((-LLONG_MAX)-1)) /* 0x8000000000000000 */


#define  LONG_LONG_MIN	 LLONG_MIN
#define  LONG_LONG_MAX	 LLONG_MAX
#define ULONG_LONG_MAX	 ULLONG_MAX


#define QUAD_MIN 	LLONG_MIN
#define QUAD_MAX 	LLONG_MAX
#define UQUAD_MAX 	ULLONG_MAX
...
--- /usr/include/limits.h ---------------------

Which defintions do you think encompasses LLVM's expectations?

INT8_MAX 		-	SCHAR_MAX	//signed
INT8_MIN 		-	SCHAR_MIN	//signed
INT16_MAX 	-	SHRT_MAX		//signed
INT16_MIN 	-	SHRT_MIN		//signed
INT32_MAX 	-	LONG_MAX		//signed
INT32_MIN 	-	LONG_MIN		//signed
...
UINT8_MAX 	-	CHAR_MIN		//unsigned #define _CHAR_UNSIGNED || 
__CHAR_UNSIGNED__
UINT8_MIN		-	(implicitly defined as 0?)
UINT16_MAX 	-	USHRT_MAX	//unsigned
UINT16_MIN	-	(implicitly defined as 0?)
UINT32_MAX 	-	ULONG_MAX	//unsigned
UINT32_MIN	-	(implicitly defined as 0?)


/Henrik

_________________________________________________________________
Få alle de nye og sjove ikoner med MSN Messenger http://www.msn.dk/messenger




More information about the llvm-dev mailing list