This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Jakub Jelinek <jakub@redhat.com> writes:
> On Wed, Nov 14, 2001 at 09:16:11AM -0800, Ulrich Drepper wrote:
>> Andreas Jaeger <aj@suse.de> writes:
>>
>> > This patch adds some support for PGI and Intel compilers, both
>> > compilers support long long.
>> >
>> > Ok to commit?
>>
>> This probably should be handled with a macro like
>>
>> __GLIBC_HAVE_LONG_LONG
>>
>> defined in <features.h> based on something similar to what you have.
>> Beside testing for __PGI etc you probably have to check for the
>> architexcture as well. Just to prevent bad surprises. Only gcc is
>> known to work accross platforms.
>
> And perhaps it could include __STDC_VERSION__ >= 199901L too, because
> I don't think any compiler would pretend to be C99 if not supporting
> long long.
Since both the PGI and Intel compilers do not use __STDC_VERSION >=
199901L (at least not by default), I suggest the patch below.
Ok to commit?
Andreas
2001-11-15 Andreas Jaeger <aj@suse.de>
* include/features.h (__GLIBC_HAVE_LONG_LONG): Define for
compilers that support it.
* posix/sys/types.h: Use __GLIBC_HAVE_LONG_LONG.
* sysdeps/unix/sysv/linux/bits/types.h: Likewise.
* stdlib/stdlib.h: Likewise.
Index: sysdeps/unix/sysv/linux/bits/types.h
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/bits/types.h,v
retrieving revision 1.27
diff -u -p -r1.27 types.h
--- types.h 2001/07/06 04:56:14 1.27
+++ types.h 2001/11/15 08:51:55
@@ -33,7 +33,7 @@ typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;
-#ifdef __GNUC__
+#ifdef __GLIBC_HAVE_LONG_LONG
__extension__ typedef unsigned long long int __u_quad_t;
__extension__ typedef long long int __quad_t;
#else
@@ -52,7 +52,7 @@ typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;
-#ifdef __GNUC__
+#ifdef __GLIBC_HAVE_LONG_LONG
__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;
#endif
@@ -63,7 +63,7 @@ typedef __u_int __uid_t; /* Type of use
typedef __u_int __gid_t; /* Type of group identifications. */
typedef __u_long __ino_t; /* Type of file serial numbers. */
typedef __u_int __mode_t; /* Type of file attribute bitmasks. */
-typedef __u_int __nlink_t; /* Type of file link counts. */
+typedef __u_int __nlink_t; /* Type of file link counts. */
typedef long int __off_t; /* Type of file sizes and offsets. */
typedef __quad_t __loff_t; /* Type of file sizes and offsets. */
typedef int __pid_t; /* Type of process identifications. */
Index: include/features.h
===================================================================
RCS file: /cvs/glibc/libc/include/features.h,v
retrieving revision 1.29
diff -u -p -r1.29 features.h
--- features.h 2001/11/01 04:23:17 1.29
+++ features.h 2001/11/15 08:51:55
@@ -277,6 +277,14 @@
#define __GLIBC_PREREQ(maj, min) \
((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
+/* Decide whether a compiler supports the long long datatypes. */
+#if defined __GNUC__ \
+ || (defined __PGI && defined __i386__ ) \
+ || (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \
+ || __STDC_VERSION >= 199901L
+# define __GLIBC_HAVE_LONG_LONG 1
+#endif
+
/* This is here only because every header file already includes this one. */
#ifndef __ASSEMBLER__
# ifndef _SYS_CDEFS_H
Index: posix/sys/types.h
===================================================================
RCS file: /cvs/glibc/libc/posix/sys/types.h,v
retrieving revision 1.43
diff -u -p -r1.43 types.h
--- types.h 2001/07/06 04:55:38 1.43
+++ types.h 2001/11/15 08:51:55
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,94,95,96,97,98,99,2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -162,7 +162,7 @@ typedef unsigned int uint;
typedef char int8_t;
typedef short int int16_t;
typedef int int32_t;
-# ifdef __GNUC__
+# if defined __GNUC__ || defined __PGI || defined __INTEL_COMPILER
__extension__ typedef long long int int64_t;
# endif
# endif
@@ -171,7 +171,7 @@ __extension__ typedef long long int int6
typedef unsigned char u_int8_t;
typedef unsigned short int u_int16_t;
typedef unsigned int u_int32_t;
-# ifdef __GNUC__
+# if defined __GNUC__ || defined __PGI || defined __INTEL_COMPILER
__extension__ typedef unsigned long long int u_int64_t;
# endif
Index: stdlib/stdlib.h
===================================================================
RCS file: /cvs/glibc/libc/stdlib/stdlib.h,v
retrieving revision 1.96
diff -u -p -r1.96 stdlib.h
--- stdlib.h 2001/07/06 04:55:41 1.96
+++ stdlib.h 2001/11/15 08:51:55
@@ -140,7 +140,7 @@ extern int atoi (__const char *__nptr) _
/* Convert a string to a long integer. */
extern long int atol (__const char *__nptr) __THROW __attribute_pure__;
-#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_MISC)
+#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC)
/* Convert a string to a long long integer. */
__extension__ extern long long int atoll (__const char *__nptr)
__THROW __attribute_pure__;
@@ -167,7 +167,7 @@ extern unsigned long int strtoul (__cons
char **__restrict __endptr, int __base)
__THROW;
-#if defined __GNUC__ && defined __USE_BSD
+#if defined __GLIBC_HAVE_LONG_LONG && defined __USE_BSD
/* Convert a string to a quadword integer. */
__extension__
extern long long int strtoq (__const char *__restrict __nptr,
@@ -179,7 +179,7 @@ extern unsigned long long int strtouq (_
__THROW;
#endif /* GCC and use BSD. */
-#if defined __USE_ISOC99 || (defined __GNUC__ && defined __USE_MISC)
+#if defined __USE_ISOC99 || (defined __GLIBC_HAVE_LONG_LONG && defined __USE_MISC)
/* These functions will part of the standard C library in ISO C99. */
/* Convert a string to a quadword integer. */
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |