nested unnamed structs/unions broken?

Steve Watt steve@chelsio.com
Sun Oct 26 19:04:00 GMT 2003


Then that needs a doc fix, as it isn't mentioned anywhere.  The headers in question aren't from MS, they were developed in-house.  Guess we need to change them for 3.4.
 
Thanks for the info.

	-----Original Message----- 
	From: Jim Wilson [mailto:wilson@specifixinc.com] 
	Sent: Sun 10/26/2003 11:44 AM 
	To: Steve Watt 
	Cc: gcc-bugs@gcc.gnu.org 
	Subject: Re: nested unnamed structs/unions broken?
	
	

	Steve Watt wrote:
	> union optid {
	>     unsigned int opcode_tid;
	>     struct {
	>         unsigned int opcode:8;
	>         unsigned int tid:24;
	>     };
	> };
	
	You now need the -fms-extensions option in order for gcc to accept this.
	  This feature was originally added because it was used in MS Windows
	header files, and was thus needed by cygwin.  Some people objected to
	the feature when it accidentally turned up in other places, so now it
	only gets enabled if you explicitly ask for MSC compatibility.
	
	There is one case that gcc continues to accept by default, because it
	was agreed to be generally useful.  This is the case of a union inside a
	struct, where the union has no type name and no field name.  This is the
	case documented in the gcc manual in the Unnamed Fields node.
	http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Unnamed-Fields.html#Unnamed%20Fields
	--
	Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
	
	



More information about the Gcc-bugs mailing list