On 32 bit architectures define (u)int64_t as (unsigned) long long instead

of (unsigned) int __attribute__((__mode__(__DI__))). This aligns better
with macros such as (U)INT64_C, (U)INT64_MAX, etc. which assume (u)int64_t
has type (unsigned) long long.

The mode attribute was used because long long wasn't standardised until
C99. Nowadays compilers should support long long and use of the mode
attribute is discouraged according to GCC Internals documentation.

The type definition has to be marked with __extension__ to support
compilation with "-std=c89 -pedantic".

Discussed with:	bde
Approved by:	kib (mentor)
This commit is contained in:
Tijl Coosemans 2011-01-08 11:47:55 +00:00
parent 9858863cd4
commit d942996baf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=217146
5 changed files with 33 additions and 54 deletions

View file

@ -52,16 +52,16 @@ typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
#ifdef __GNUCLIKE_ATTRIBUTE_MODE_DI
typedef int __attribute__((__mode__(__DI__))) __int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t;
#else
#ifndef lint
__extension__
#endif
/* LONGLONG */
typedef long long __int64_t;
#ifndef lint
__extension__
#endif
/* LONGLONG */
typedef unsigned long long __uint64_t;
#endif
/*
* Standard type definitions.

View file

@ -54,21 +54,16 @@ typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
#if defined(lint)
/* LONGLONG */
typedef long long __int64_t;
/* LONGLONG */
typedef unsigned long long __uint64_t;
#elif defined(__GNUCLIKE_ATTRIBUTE_MODE_DI)
typedef int __attribute__((__mode__(__DI__))) __int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t;
#else
/* LONGLONG */
typedef long long __int64_t;
/* LONGLONG */
typedef unsigned long long __uint64_t;
#ifndef lint
__extension__
#endif
/* LONGLONG */
typedef long long __int64_t;
#ifndef lint
__extension__
#endif
/* LONGLONG */
typedef unsigned long long __uint64_t;
/*
* Standard type definitions.

View file

@ -53,25 +53,20 @@ typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
#ifdef __mips_n64
typedef long __int64_t;
typedef unsigned long __uint64_t;
#else
#if defined(lint)
/* LONGLONG */
typedef long long __int64_t;
/* LONGLONG */
typedef unsigned long long __uint64_t;
#elif defined(__GNUCLIKE_ATTRIBUTE_MODE_DI)
typedef int __attribute__((__mode__(__DI__))) __int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t;
#else
/* LONGLONG */
typedef long long __int64_t;
/* LONGLONG */
typedef unsigned long long __uint64_t;
#ifndef lint
__extension__
#endif
/* LONGLONG */
typedef long long __int64_t;
#ifndef lint
__extension__
#endif
/* LONGLONG */
typedef unsigned long long __uint64_t;
#endif
/*

View file

@ -52,29 +52,20 @@ typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
#ifdef __powerpc64__
typedef long __int64_t;
typedef unsigned long __uint64_t;
#else
#if defined(lint)
/* LONGLONG */
typedef long long __int64_t;
/* LONGLONG */
typedef unsigned long long __uint64_t;
#elif defined(__GNUCLIKE_ATTRIBUTE_MODE_DI)
typedef int __attribute__((__mode__(__DI__))) __int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t;
#else
/* LONGLONG */
typedef long long __int64_t;
/* LONGLONG */
typedef unsigned long long __uint64_t;
#ifndef lint
__extension__
#endif
/* LONGLONG */
typedef long long __int64_t;
#ifndef lint
__extension__
#endif
/* LONGLONG */
typedef unsigned long long __uint64_t;
#endif
/*

View file

@ -62,8 +62,6 @@
#define __GNUCLIKE___OFFSETOF 1
#define __GNUCLIKE___SECTION 1
#define __GNUCLIKE_ATTRIBUTE_MODE_DI 1
#ifndef __INTEL_COMPILER
# define __GNUCLIKE_CTOR_SECTION_HANDLING 1
#endif