tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] question about bit-fields


From: Michael B. Smith
Subject: Re: [Tinycc-devel] question about bit-fields
Date: Mon, 22 Oct 2012 12:26:51 +0000

This was the very first patch that I ever wrote to tcc. Except I didn't make it 
optional. I never submitted it because of that.

Being able to pack data the same way that GCC (and MSVC for that matter) does 
is very useful, especially in network code. Granted that "officially" I think 
this is considered an implementation detail by the various C standards.

-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of grischka
Sent: Saturday, October 20, 2012 3:59 PM
To: address@hidden
Subject: Re: [Tinycc-devel] question about bit-fields

Didier Barvaux wrote:
> Please find attached, a patch that modify TCC so that it can pack bit 
> fields the way GCC does. The mechanism is optional and off by default.
> It can be enabled with the -fgcc-packing option.

... the way GCC does?

> I added this mechanism because I want to use TCC to compile some code 
> that manages IPv4 headers [1]. The code uses the 'struct iphdr' of the 
> GNU libc, and relies on its size doing exactly 20 bytes. TCC does not 
> compute the structure length the same way GCC does, and the program 
> fails.

... the same way GCC does?

> Someone told me that I can add code to mimic the behaviour of GCC. The 
> attached patch is an attempt to do so. It is probably not very good as 
> I didn't known TCC's codebase before, but it seems to work. I'm open 
> for comments on it. I tested my modifications with the attached test 
> program.

... to mimic the behavior of GCC?

Just curious:  What now is this way/behavior of GCC, actually?

Because as you say, maybe the patch is not very good (e.g. suspicious "copy & 
paste" portion) but you didn't know TCC before.

Then again maybe some people here know TCC but still can't really comment your 
patch or suggest improvements because they don't know the details about GCC's 
bit packing right now.

Thanks,

--- grischka

_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]