public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Using __extension__ in a struct with a GTY(()) mark
@ 2003-04-03  0:11 Kaveh R. Ghazi
  2003-04-03  1:23 ` Geoffrey Keating
  2003-04-03  3:17 ` Jason Merrill
  0 siblings, 2 replies; 6+ messages in thread
From: Kaveh R. Ghazi @ 2003-04-03  0:11 UTC (permalink / raw)
  To: geoffk; +Cc: gcc

Geoff,

I'm trying to enable compiling the G++ frontend using any ISOC
compiler.  In effect, this means getting it to compile with gcc
-pedantic.  I've zapped all problems except one in which I'm running
into a problem with gengtype and a structure using GTY(()) when I try
to use the __extension__ keyword.

The last warnings I get are:
cp-tree.h:1045: warning: bit-field `has_type_conversion' type invalid in ISO C
cp-tree.h:1046: warning: bit-field `has_init_ref' type invalid in ISO C
cp-tree.h:1047: warning: bit-field `has_default_ctor' type invalid in ISO C
cp-tree.h:1048: warning: bit-field `uses_multiple_inheritance' type invalid in ISO C
cp-tree.h:1049: warning: bit-field `const_needs_init' type invalid in ISO C
cp-tree.h:1050: warning: bit-field `ref_needs_init' type invalid in ISO C
cp-tree.h:1051: warning: bit-field `has_const_assign_ref' type invalid in ISO C

These come from this struct in cp-tree.h:

struct lang_type_header GTY(())
{
  unsigned char is_lang_type_class : 1;

  unsigned char has_type_conversion : 1;
  unsigned char has_init_ref : 1;
  unsigned char has_default_ctor : 1;
  unsigned char uses_multiple_inheritance : 1;
  unsigned char const_needs_init : 1;
  unsigned char ref_needs_init : 1;
  unsigned char has_const_assign_ref : 1;
};

I added code in system.h to appropriately use int or char depending on
whether we're using GCC via a macro CHAR_BITFIELD.

The I replaced the above "unsigned char" with CHAR_BITFIELD.  I found
that gengtype chokes on this.  That I fixed by adding CHAR_BITFIELD to
IWORD in gengtype-lex.l.

The problem I'm having now is that I need to add the __extension__
keyword to the struct so that it doesn't get a complaint from GCC.
Not being very fluent in bison or flex, I can't seem to get gengtype
to accept it.

In the end, I'm trying to get this struct parsed by gengtype:

struct lang_type_header GTY(())  __extension__
{
  CHAR_BITFIELD is_lang_type_class : 1;

  CHAR_BITFIELD has_type_conversion : 1;
  CHAR_BITFIELD has_init_ref : 1;
  CHAR_BITFIELD has_default_ctor : 1;
  CHAR_BITFIELD uses_multiple_inheritance : 1;
  CHAR_BITFIELD const_needs_init : 1;
  CHAR_BITFIELD ref_needs_init : 1;
  CHAR_BITFIELD has_const_assign_ref : 1;
};

Please help?

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-04-03  6:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-03  0:11 Using __extension__ in a struct with a GTY(()) mark Kaveh R. Ghazi
2003-04-03  1:23 ` Geoffrey Keating
2003-04-03  6:45   ` Kaveh R. Ghazi
2003-04-03  3:17 ` Jason Merrill
2003-04-03  5:57   ` Kaveh R. Ghazi
2003-04-03  6:15     ` Jason Merrill

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).