delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2010/12/16/09:35:48

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX19rn80YTaRr79JoVtwsuw0yZazixZ+TnTlVmndTOF
H5SbeIeYNHMxFG
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
To: djgpp-workers AT delorie DOT com
Subject: autoconf's test failing to confirm stdint.h compliance with C99
Date: Thu, 16 Dec 2010 15:09:20 +0100
User-Agent: KMail/1.9.10
MIME-Version: 1.0
Message-Id: <201012161509.20778.juan.guerrero@gmx.de>
X-Y-GMX-Trusted: 0
Reply-To: djgpp-workers AT delorie DOT com

I have observed that the autoconf test that checks if stdint.h conforms to C99
always fails.  An inspection of the code snippet of the test shows that the
offending code is the following:

  /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others.  */
  int check_UINT8_C:
        (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
  int check_UINT16_C:
        (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;

stdin.h typedefs uint_least8_t into unsigned char and uint_least16_t into 
unsigned short int.  At the same time the UINT8_C and UINT16_C macros only
concatenate the U letter to the numeric constant.
In conclusion no one of the 8 and 16 bit *_C() macros match the type of the
[u]int8_t and [u]int16_t definitions.  Shouldn't this be adjusted to look
like in the patch below or am I missing something here?


Regards,
Juan M. Guerrero


diff -aprNU5 djgpp.orig/include/stdint.h djgpp/include/stdint.h
--- djgpp.orig/include/stdint.h	2003-02-20 19:04:46 +0000
+++ djgpp/include/stdint.h	2010-12-16 14:52:30 +0000
@@ -121,16 +121,16 @@ __extension__ typedef unsigned long long
 #endif /* !__cplusplus || __STDC_LIMIT_MACROS */
 
 
 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
 
-#define INT8_C(x)	x
-#define UINT8_C(x)	x ## U
-#define INT16_C(x)	x
-#define UINT16_C(x)	x ## U
-#define INT32_C(x)	x
-#define UINT32_C(x)	x ## U
+#define INT8_C(x)	((int8_t)x)
+#define UINT8_C(x)	((uint8_t)x ## U)
+#define INT16_C(x)	((int16_t)x)
+#define UINT16_C(x)	((uint16_t)x ## U)
+#define INT32_C(x)	x ## L
+#define UINT32_C(x)	x ## UL
 #define INT64_C(x)	x ## LL
 #define UINT64_C(x)	x ## ULL
 
 #define INTMAX_C(x)	x ## LL
 #define UINTMAX_C(x)	x ## ULL

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019