public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>, Roland McGrath <roland@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix int64_t/u_int64_t on 64-bit arches with non-GCC compilers
Date: Tue, 28 Feb 2006 12:50:00 -0000	[thread overview]
Message-ID: <20060228125020.GF30252@sunsite.mff.cuni.cz> (raw)

Hi!

On 64-bit arches and non-GCC compilers, <sys/types.h> uses long long resp.
unsigned long long types for int64_t/u_int64_t.  But, <stdint.h> uses
there long resp. unsigned long and so does <sys/types.h> for GCC
(it uses DImode int, which mangles as l rather than x).
With those compilers, depending if you include <stdint.h> or <sys/types.h>
first thus affects mangling, the same function can mangle differently
based on the order of the above headers included.

The following patch is an ABI change with those compilers, makes even
non-GCC compilers do the same as GCC (and the same as <stdint.h> already
does).

2006-02-28  Jakub Jelinek  <jakub@redhat.com>

	* posix/sys/types.h [!__GNUC_PREREQ (2, 7)] (int64_t, u_int64_t):
	typedef to long int resp. unsigned long int on 64-bit arches.

--- libc/posix/sys/types.h.jj	2002-10-24 01:48:51.000000000 +0200
+++ libc/posix/sys/types.h	2006-02-28 13:34:44.000000000 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1994,1995,1996,1997,1998,1999,2000,2001,2002
+/* Copyright (C) 1991,1992,1994,1995,1996,1997,1998,1999,2000,2001,2002,2006
    	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -163,7 +163,9 @@ typedef unsigned int uint;
 typedef	char int8_t;
 typedef	short int int16_t;
 typedef	int int32_t;
-#  if __GLIBC_HAVE_LONG_LONG
+#  if __WORDSIZE == 64
+typedef long int int64_t;
+#  elif __GLIBC_HAVE_LONG_LONG
 __extension__ typedef long long int int64_t;
 #  endif
 # endif
@@ -172,7 +174,9 @@ __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;
-# if __GLIBC_HAVE_LONG_LONG
+# if __WORDSIZE == 64
+typedef unsigned long int u_int64_t;
+# elif __GLIBC_HAVE_LONG_LONG
 __extension__ typedef unsigned long long int u_int64_t;
 # endif
 

	Jakub

             reply	other threads:[~2006-02-28 12:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-28 12:50 Jakub Jelinek [this message]
2006-02-28 19:11 ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060228125020.GF30252@sunsite.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).