X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 	tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4989511F.4040200@cwilson.fastmail.fm>
Date: Wed, 04 Feb 2009 03:26:07 -0500
From: Charles Wilson <cygwin@cwilson.fastmail.fm>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: "Incompatible" typedefs
References: <1233680809.17414.1298297091@webmail.messagingengine.com> <20090203171556.GB12192@ednor.casa.cgf.cx>
In-Reply-To: <20090203171556.GB12192@ednor.casa.cgf.cx>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Christopher Faylor wrote:
> On Tue, Feb 03, 2009 at 12:06:49PM -0500, Charles Wilson wrote:
>> I ran across an oddity in the cygwin headers today.
> 
> This boils down to "What does linux do?".  If we are doing something
> different then PTC.

Errr, it's a little weird. On linux, I have:

From <sys/types.h>
typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));

From <stdint.h>
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;

From <bits/types.h>
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;

So it looks like everything is defined in terms of ANSI C types (int,
char, etc) without the intermediation that cygwin's headers use. So, all
of the [__]u[_]int32_t types are all 'unsigned int'.

I'm guessing that "__attribute__ ((__mode__ (__SI__)))" doesn't make
u_int32_t different than uint32_t.  But apparently there is some heavy
duty compiler magic happening, because I would have thought that these two:

typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned short int uint16_t;

are very different. But they are not (in that a variation of my test
case I posted earlier, emits no warnings with these two types).

I'm not sure what useful conclusions we can draw from looking at how
linux does it, Or maybe I just need some sleep.

--
Chuck

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

