relegate plan9-ish structure "pasting" to -fms-extensions

Richard Henderson rth@redhat.com
Sun Jun 16 12:13:00 GMT 2002


As discussed in the thread beginning

  http://gcc.gnu.org/ml/gcc-patches/2002-05/msg02133.html


r~


        * c-common.c (flag_ms_extensions): Move from c++ front end.
        * c-common.h (flag_ms_extensions): Declare.
        * c-decl.c (c_decode_option): Add -fms-extensions.
        (grokfield): Don't accept anonymous structures in ISO C mode;
        accept only unnamed anonymous structures in GNU C mode; accept
        Plan 9 extensions in MS mode.
        * c-parse.in (SAVE_EXT_FLAGS, RESTORE_EXT_FLAGS): Rename from
        SAVE/RESTORE_WARN_FLAGS; add flag_iso frobbing; update all callers.
        (extension): Clear flag_iso.
        * doc/invoke.texi (C Dialect Options): Add -fms-extensions.

        * cp-tree.h, decl2.c (flag_ms_extensions): Move to c-common.

        * g++.dg/ext/anon-struct1.C: New.
        * g++.dg/ext/anon-struct2.C: New.
        * g++.dg/ext/anon-struct3.C: New.
        * gcc.dg/anon-struct-1.c: New.
        * gcc.dg/anon-struct-2.c: New.
        * gcc.dg/anon-struct-3.c: New.
        * gcc.dg/20011008-1.c: Adjust warning text.
        * gcc.dg/20020527-1.c: Add -fms-extensions.

Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.342
diff -c -p -d -r1.342 c-common.c
*** c-common.c	12 Jun 2002 03:06:09 -0000	1.342
--- c-common.c	16 Jun 2002 18:46:20 -0000
*************** int flag_short_double;
*** 220,225 ****
--- 220,228 ----
  
  int flag_short_wchar;
  
+ /* Nonzero means allow Microsoft extensions without warnings or errors.  */
+ int flag_ms_extensions;
+ 
  /* Nonzero means warn about use of multicharacter literals.  */
  
  int warn_multichar = 1;
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.140
diff -c -p -d -r1.140 c-common.h
*** c-common.h	4 Jun 2002 07:06:56 -0000	1.140
--- c-common.h	16 Jun 2002 18:46:20 -0000
*************** extern int flag_short_double;
*** 396,401 ****
--- 396,404 ----
  
  extern int flag_short_wchar;
  
+ /* Nonzero means allow Microsoft extensions without warnings or errors.  */
+ extern int flag_ms_extensions;
+ 
  /* Nonzero means warn about use of multicharacter literals.  */
  extern int warn_multichar;
  
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.333
diff -c -p -d -r1.333 c-decl.c
*** c-decl.c	10 Jun 2002 21:52:41 -0000	1.333
--- c-decl.c	16 Jun 2002 18:46:20 -0000
*************** c_decode_option (argc, argv)
*** 629,634 ****
--- 629,638 ----
      flag_no_asm = 0;
    else if (!strcmp (p, "-fno-asm"))
      flag_no_asm = 1;
+   else if (!strcmp (p, "-fms-extensions"))
+     flag_ms_extensions = 1;
+   else if (!strcmp (p, "-fno-ms-extensions"))
+     flag_ms_extensions = 0;
    else if (!strcmp (p, "-fbuiltin"))
      flag_no_builtin = 0;
    else if (!strcmp (p, "-fno-builtin"))
*************** grokfield (filename, line, declarator, d
*** 5359,5373 ****
  
    if (declarator == NULL_TREE && width == NULL_TREE)
      {
!       /* This is an unnamed decl.  We only support unnamed
! 	 structs/unions, so check for other things and refuse them.  */
        tree type = TREE_VALUE (declspecs);
  
!       if (TREE_CODE (type) == TYPE_DECL)
  	type = TREE_TYPE (type);
!       if (TREE_CODE (type) != RECORD_TYPE && TREE_CODE (type) != UNION_TYPE)
  	{
! 	  error ("unnamed fields of type other than struct or union are not allowed");
  	  return NULL_TREE;
  	}
      }
--- 5363,5406 ----
  
    if (declarator == NULL_TREE && width == NULL_TREE)
      {
!       /* This is an unnamed decl.
! 
! 	 If we have something of the form "union { list } ;" then this
! 	 is the anonymous union extension.  Similarly for struct.
! 
! 	 If this is something of the form "struct foo;", then
! 	   If MS extensions are enabled, this is handled as an
! 	     anonymous struct.
! 	   Otherwise this is a forward declaration of a structure tag.
! 
! 	 If this is something of the form "foo;" and foo is a TYPE_DECL, then
! 	   If MS extensions are enabled and foo names a structure, then
! 	     again this is an anonymous struct.
! 	   Otherwise this is an error.
! 
! 	 Oh what a horrid tangled web we weave.  I wonder if MS consiously
! 	 took this from Plan 9 or if it was an accident of implementation
! 	 that took root before someone noticed the bug...  */
! 
        tree type = TREE_VALUE (declspecs);
  
!       if (flag_ms_extensions && TREE_CODE (type) == TYPE_DECL)
  	type = TREE_TYPE (type);
!       if (TREE_CODE (type) == RECORD_TYPE || TREE_CODE (type) == UNION_TYPE)
  	{
! 	  if (flag_ms_extensions)
! 	    ; /* ok */
! 	  else if (flag_iso)
! 	    goto warn_unnamed_field;
! 	  else if (TYPE_NAME (type) == NULL)
! 	    ; /* ok */
! 	  else
! 	    goto warn_unnamed_field;
! 	}
!       else
! 	{
! 	warn_unnamed_field:
! 	  warning ("declaration does not declare anything");
  	  return NULL_TREE;
  	}
      }
Index: c-parse.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-parse.in,v
retrieving revision 1.142
diff -c -p -d -r1.142 c-parse.in
*** c-parse.in	4 Jun 2002 07:07:00 -0000	1.142
--- c-parse.in	16 Jun 2002 18:46:20 -0000
*************** static GTY(()) tree declspec_stack;
*** 298,314 ****
  
  /* For __extension__, save/restore the warning flags which are
     controlled by __extension__.  */
! #define SAVE_WARN_FLAGS()			\
  	size_int (pedantic			\
  		  | (warn_pointer_arith << 1)	\
! 		  | (warn_traditional << 2))
  
! #define RESTORE_WARN_FLAGS(tval)		\
    do {						\
      int val = tree_low_cst (tval, 0);		\
      pedantic = val & 1;				\
      warn_pointer_arith = (val >> 1) & 1;	\
      warn_traditional = (val >> 2) & 1;		\
    } while (0)
  
  ifobjc
--- 298,316 ----
  
  /* For __extension__, save/restore the warning flags which are
     controlled by __extension__.  */
! #define SAVE_EXT_FLAGS()			\
  	size_int (pedantic			\
  		  | (warn_pointer_arith << 1)	\
! 		  | (warn_traditional << 2)	\
! 		  | (flag_iso << 3))
  
! #define RESTORE_EXT_FLAGS(tval)			\
    do {						\
      int val = tree_low_cst (tval, 0);		\
      pedantic = val & 1;				\
      warn_pointer_arith = (val >> 1) & 1;	\
      warn_traditional = (val >> 2) & 1;		\
+     flag_iso = (val >> 3) & 1;			\
    } while (0)
  
  ifobjc
*************** end ifobjc
*** 394,400 ****
  		  else
  		    error ("argument of `asm' is not a constant string"); }
  	| extension extdef
! 		{ RESTORE_WARN_FLAGS ($1); }
  	;
  
  datadef:
--- 396,402 ----
  		  else
  		    error ("argument of `asm' is not a constant string"); }
  	| extension extdef
! 		{ RESTORE_EXT_FLAGS ($1); }
  	;
  
  datadef:
*************** unary_expr:
*** 517,523 ****
  	/* __extension__ turns off -pedantic for following primary.  */
  	| extension cast_expr	  %prec UNARY
  		{ $$ = $2;
! 		  RESTORE_WARN_FLAGS ($1); }
  	| unop cast_expr  %prec UNARY
  		{ $$ = build_unary_op ($1, $2, 0);
  		  overflow_warning ($$); }
--- 519,525 ----
  	/* __extension__ turns off -pedantic for following primary.  */
  	| extension cast_expr	  %prec UNARY
  		{ $$ = $2;
! 		  RESTORE_EXT_FLAGS ($1); }
  	| unop cast_expr  %prec UNARY
  		{ $$ = build_unary_op ($1, $2, 0);
  		  overflow_warning ($$); }
*************** decl:
*** 865,871 ****
  	| declspecs ';'
  		{ shadow_tag ($1); }
  	| extension decl
! 		{ RESTORE_WARN_FLAGS ($1); }
  	;
  
  /* A list of declaration specifiers.  These are:
--- 867,873 ----
  	| declspecs ';'
  		{ shadow_tag ($1); }
  	| extension decl
! 		{ RESTORE_EXT_FLAGS ($1); }
  	;
  
  /* A list of declaration specifiers.  These are:
*************** component_decl:
*** 1863,1869 ****
  		{ $$ = NULL_TREE; }
  	| extension component_decl
  		{ $$ = $2;
! 		  RESTORE_WARN_FLAGS ($1); }
  	;
  
  components:
--- 1865,1871 ----
  		{ $$ = NULL_TREE; }
  	| extension component_decl
  		{ $$ = $2;
! 		  RESTORE_EXT_FLAGS ($1); }
  	;
  
  components:
*************** identifiers_or_typenames:
*** 2664,2673 ****
  
  extension:
  	EXTENSION
! 		{ $$ = SAVE_WARN_FLAGS();
  		  pedantic = 0;
  		  warn_pointer_arith = 0;
! 		  warn_traditional = 0; }
  	;
  
  ifobjc
--- 2666,2676 ----
  
  extension:
  	EXTENSION
! 		{ $$ = SAVE_EXT_FLAGS();
  		  pedantic = 0;
  		  warn_pointer_arith = 0;
! 		  warn_traditional = 0;
! 		  flag_iso = 0; }
  	;
  
  ifobjc
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.718
diff -c -p -d -r1.718 cp-tree.h
*** cp/cp-tree.h	15 Jun 2002 12:38:04 -0000	1.718
--- cp/cp-tree.h	16 Jun 2002 18:46:21 -0000
*************** typedef enum base_kind {
*** 3200,3208 ****
  			     binfo. */
  } base_kind;
  
- /* Nonzero means allow Microsoft extensions without a pedwarn.  */
- extern int flag_ms_extensions;
- 
  /* Non-zero means warn in function declared in derived class has the
     same name as a virtual in the base class, but fails to match the
     type signature of any virtual function in the base class.  */
--- 3200,3205 ----
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.539
diff -c -p -d -r1.539 decl2.c
*** cp/decl2.c	7 Jun 2002 22:20:12 -0000	1.539
--- cp/decl2.c	16 Jun 2002 18:46:21 -0000
*************** int warn_deprecated = 1;
*** 299,308 ****
  #endif
  int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
  
- /* Nonzero means allow Microsoft extensions without a pedwarn.  */
- 
- int flag_ms_extensions;
- 
  /* C++ specific flags.  */   
  
  /* Nonzero means we should attempt to elide constructors when possible.  */
--- 299,304 ----
Index: testsuite/g++.dg/ext/anon-struct1.C
===================================================================
RCS file: testsuite/g++.dg/ext/anon-struct1.C
diff -N testsuite/g++.dg/ext/anon-struct1.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/ext/anon-struct1.C	16 Jun 2002 18:46:21 -0000
***************
*** 0 ****
--- 1,50 ----
+ /* { dg-options "-ansi -pedantic -pedantic-errors" } */
+ /* In strict ISO C++ mode, we don't recognize the anonymous struct
+    extension or any Microsoft C extensions.  */
+ 
+ struct A { char a; };
+ 
+ struct B {
+   struct A;			/* forward decl of B::A.  */
+   char b;
+ };
+ char testB[sizeof(B) == sizeof(A) ? 1 : -1];
+ 
+ struct C {
+   struct D { char d; };		/* decl of C::D.  */
+   char c;
+ };
+ char testC[sizeof(C) == sizeof(A) ? 1 : -1];
+ char testD[sizeof(C::D) == sizeof(A) ? 1 : -1];
+ 
+ /* GNU extension.  */
+ struct E {
+   struct { char z; };		/* { dg-error "prohibits anonymous structs" } */
+   char e;
+ };
+ 
+ typedef struct A typedef_A;
+ struct F {
+   typedef_A;			/* { dg-error "does not declare anything" } */
+   char f;
+ };
+ char testF[sizeof(struct F) == sizeof(struct A) ? 1 : -1];
+ 
+ /* __extension__ enables GNU C mode for the duration of the declaration.  */
+ __extension__ struct G {
+   struct { char z; };
+   char g;
+ };
+ char testG[sizeof(G) == 2 * sizeof(A) ? 1 : -1];
+ 
+ struct H {
+   __extension__ struct { char z; };
+   char h;
+ };
+ char testH[sizeof(H) == 2 * sizeof(A) ? 1 : -1];
+ 
+ /* Make sure __extension__ gets turned back off.  */
+ struct I {
+   struct { char z; };		/* { dg-error "prohibits anonymous structs" } */
+   char i;
+ };
Index: testsuite/g++.dg/ext/anon-struct2.C
===================================================================
RCS file: testsuite/g++.dg/ext/anon-struct2.C
diff -N testsuite/g++.dg/ext/anon-struct2.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/ext/anon-struct2.C	16 Jun 2002 18:46:21 -0000
***************
*** 0 ****
--- 1,46 ----
+ /* { dg-options "" } */
+ /* In GNU C++ mode, we recognize the anonymous struct extension,
+    but not Microsoft C extensions.  */
+ 
+ struct A { char a; };
+ 
+ struct B {
+   struct A;			/* forward decl of B::A.  */
+   char b;
+ };
+ char testB[sizeof(B) == sizeof(A) ? 1 : -1];
+ 
+ struct C {
+   struct D { char d; };		/* decl of C::D.  */
+   char c;
+ };
+ char testC[sizeof(C) == sizeof(A) ? 1 : -1];
+ char testD[sizeof(C::D) == sizeof(A) ? 1 : -1];
+ 
+ /* GNU extension.  */
+ struct E {
+   struct { char z; };
+   char e;
+ };
+ char testE[sizeof(E) == 2 * sizeof(A) ? 1 : -1];
+ char testEz[sizeof( ((E *)0)->z )];
+ 
+ typedef struct A typedef_A;
+ struct F {
+   typedef_A;			/* { dg-error "does not declare anything" } */
+   char f;
+ };
+ char testF[sizeof(F) == sizeof(A) ? 1 : -1];
+ 
+ /* Test that __extension__ does the right thing coming _from_ GNU C mode.  */
+ __extension__ struct G {
+   struct { char z; };
+   char g;
+ };
+ char testG[sizeof(G) == 2 * sizeof(A) ? 1 : -1];
+ 
+ struct H {
+   struct { char z; };
+   char h;
+ };
+ char testH[sizeof(H) == 2 * sizeof(A) ? 1 : -1];
Index: testsuite/g++.dg/ext/anon-struct3.C
===================================================================
RCS file: testsuite/g++.dg/ext/anon-struct3.C
diff -N testsuite/g++.dg/ext/anon-struct3.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/ext/anon-struct3.C	16 Jun 2002 18:46:21 -0000
***************
*** 0 ****
--- 1,34 ----
+ /* { dg-options "-fms-extensions" } */
+ /* Verify that enabling Microsoft mode doesn't twist C++ as much as
+    their corresponding C extensions.  Checked vs
+    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
+  */
+ 
+ struct A { char a; };
+ 
+ struct B {
+   struct A;			/* forward decl of B::A.  */
+   char b;
+ };
+ char testB[sizeof(B) == sizeof(A) ? 1 : -1];
+ 
+ struct C {
+   struct D { char d; };		/* decl of C::D.  */
+   char c;
+ };
+ char testC[sizeof(C) == sizeof(A) ? 1 : -1];
+ char testD[sizeof(C::D) == sizeof(A) ? 1 : -1];
+ 
+ struct E {
+   struct { char z; };
+   char e;
+ };
+ char testE[sizeof(E) == 2 * sizeof(A) ? 1 : -1];
+ char testEz[sizeof( ((E *)0)->z )];
+ 
+ typedef struct A typedef_A;
+ struct F {
+   typedef_A;			/* { dg-error "does not declare anything" } */
+   char f;
+ };
+ char testF[sizeof(F) == sizeof(A) ? 1 : -1];
Index: testsuite/gcc.dg/20011008-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/20011008-1.c,v
retrieving revision 1.1
diff -c -p -d -r1.1 20011008-1.c
*** testsuite/gcc.dg/20011008-1.c	8 Oct 2001 19:42:40 -0000	1.1
--- testsuite/gcc.dg/20011008-1.c	16 Jun 2002 18:46:22 -0000
***************
*** 1,7 ****
  /* { dg-do compile } */
  /* { dg-options "-O0" } */
  
! struct { int; int q; } a; /* { dg-error "unnamed" } */
  struct { union {int x;}; int q; } b;
  struct { struct {int x;}; int q; } c;
  union { union {int x;}; int q; } d;
--- 1,7 ----
  /* { dg-do compile } */
  /* { dg-options "-O0" } */
  
! struct { int; int q; } a; /* { dg-warning "does not declare anything" } */
  struct { union {int x;}; int q; } b;
  struct { struct {int x;}; int q; } c;
  union { union {int x;}; int q; } d;
Index: testsuite/gcc.dg/20020527-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/20020527-1.c,v
retrieving revision 1.1
diff -c -p -d -r1.1 20020527-1.c
*** testsuite/gcc.dg/20020527-1.c	10 Jun 2002 21:52:43 -0000	1.1
--- testsuite/gcc.dg/20020527-1.c	16 Jun 2002 18:46:22 -0000
***************
*** 2,8 ****
     Test whether an unnamed field with user defined type - struct or union is
     accepted.  */
  /* { dg-do compile } */
! /* { dg-options "" } */
  
  typedef struct {
    unsigned short a;
--- 2,8 ----
     Test whether an unnamed field with user defined type - struct or union is
     accepted.  */
  /* { dg-do compile } */
! /* { dg-options "-fms-extensions" } */
  
  typedef struct {
    unsigned short a;
Index: testsuite/gcc.dg/anon-struct-1.c
===================================================================
RCS file: testsuite/gcc.dg/anon-struct-1.c
diff -N testsuite/gcc.dg/anon-struct-1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/anon-struct-1.c	16 Jun 2002 18:46:22 -0000
***************
*** 0 ****
--- 1,56 ----
+ /* { dg-options "-std=iso9899:1990" } */
+ /* In strict ISO C mode, we don't recognize the anonymous struct/union
+    extension or any Microsoft extensions.  */
+ 
+ struct A { char a; };
+ 
+ /* MS extension.  */
+ struct B {
+   struct A;			/* { dg-warning "does not declare anything" } */
+   char b;
+ };
+ char testB[sizeof(struct B) == sizeof(struct A) ? 1 : -1];
+ 
+ /* MS extension.  */
+ struct C {
+   struct D { char d; };		/* { dg-warning "does not declare anything" } */
+   char c;
+ };
+ char testC[sizeof(struct C) == sizeof(struct A) ? 1 : -1];
+ char testD[sizeof(struct D) == sizeof(struct A) ? 1 : -1];
+ 
+ /* GNU extension.  */
+ struct E {
+   struct { char z; };		/* { dg-warning "does not declare anything" } */
+   char e;
+ };
+ char testE[sizeof(struct E) == sizeof(struct A) ? 1 : -1];
+ 
+ /* MS extension.  */
+ typedef struct A typedef_A;
+ struct F {
+   typedef_A;			/* { dg-warning "does not declare anything" } */
+   char f;
+ };
+ char testF[sizeof(struct F) == sizeof(struct A) ? 1 : -1];
+ 
+ /* __extension__ enables GNU C mode for the duration of the declaration.  */
+ __extension__ struct G {
+   struct { char z; };
+   char g;
+ };
+ char testG[sizeof(struct G) == 2 * sizeof(struct A) ? 1 : -1];
+ 
+ struct H {
+   __extension__ struct { char z; };
+   char h;
+ };
+ char testH[sizeof(struct H) == 2 * sizeof(struct A) ? 1 : -1];
+ 
+ /* Make sure __extension__ gets turned back off.  */
+ struct I {
+   struct { char z; };		/* { dg-warning "does not declare anything" } */
+   char i;
+ };
+ char testI[sizeof(struct I) == sizeof(struct A) ? 1 : -1];
+ 
Index: testsuite/gcc.dg/anon-struct-2.c
===================================================================
RCS file: testsuite/gcc.dg/anon-struct-2.c
diff -N testsuite/gcc.dg/anon-struct-2.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/anon-struct-2.c	16 Jun 2002 18:46:22 -0000
***************
*** 0 ****
--- 1,48 ----
+ /* { dg-options "-std=gnu89" } */
+ /* In GNU C mode, we recognize the anonymous struct/union extension,
+    but not Microsoft extensions.  */
+ 
+ struct A { char a; };
+ 
+ /* MS extension.  */
+ struct B {
+   struct A;			/* { dg-warning "does not declare anything" } */
+   char b;
+ };
+ char testB[sizeof(struct B) == sizeof(struct A) ? 1 : -1];
+ 
+ /* MS extension.  */
+ struct C {
+   struct D { char d; };		/* { dg-warning "does not declare anything" } */
+   char c;
+ };
+ char testC[sizeof(struct C) == sizeof(struct A) ? 1 : -1];
+ char testD[sizeof(struct D) == sizeof(struct A) ? 1 : -1];
+ 
+ /* GNU extension.  */
+ struct E {
+   struct { char z; };
+   char e;
+ };
+ char testE[sizeof(struct E) == 2 * sizeof(struct A) ? 1 : -1];
+ 
+ /* MS extension.  */
+ typedef struct A typedef_A;
+ struct F {
+   typedef_A;			/* { dg-warning "does not declare anything" } */
+   char f;
+ };
+ char testF[sizeof(struct F) == sizeof(struct A) ? 1 : -1];
+ 
+ /* Test that __extension__ does the right thing coming _from_ GNU C mode.  */
+ __extension__ struct G {
+   struct { char z; };
+   char g;
+ };
+ char testG[sizeof(struct G) == 2 * sizeof(struct A) ? 1 : -1];
+ 
+ struct H {
+   struct { char z; };
+   char h;
+ };
+ char testH[sizeof(struct H) == 2 * sizeof(struct A) ? 1 : -1];
Index: testsuite/gcc.dg/anon-struct-3.c
===================================================================
RCS file: testsuite/gcc.dg/anon-struct-3.c
diff -N testsuite/gcc.dg/anon-struct-3.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/anon-struct-3.c	16 Jun 2002 18:46:22 -0000
***************
*** 0 ****
--- 1,32 ----
+ /* { dg-options "-std=gnu89 -fms-extensions" } */
+ /* Enabling Microsoft mode makes all of the tests equivalent.  Checked vs
+    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
+  */
+ 
+ struct A { char a; };
+ 
+ struct B {
+   struct A;
+   char b;
+ };
+ char testB[sizeof(struct B) == 2 * sizeof(struct A) ? 1 : -1];
+ 
+ struct C {
+   struct D { char d; };
+   char c;
+ };
+ char testC[sizeof(struct C) == 2 * sizeof(struct A) ? 1 : -1];
+ char testD[sizeof(struct D) == sizeof(struct A) ? 1 : -1];
+ 
+ struct E {
+   struct { char z; };
+   char e;
+ };
+ char testE[sizeof(struct E) == 2 * sizeof(struct A) ? 1 : -1];
+ 
+ typedef struct A typedef_A;
+ struct F {
+   typedef_A;
+   char f;
+ };
+ char testF[sizeof(struct F) == 2 * sizeof(struct A) ? 1 : -1];
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.151
diff -c -p -d -r1.151 invoke.texi
*** doc/invoke.texi	9 Jun 2002 23:20:08 -0000	1.151
--- doc/invoke.texi	16 Jun 2002 18:49:46 -0000
*************** in the following sections.
*** 164,170 ****
  @gccoptlist{
  -ansi  -std=@var{standard}  -aux-info @var{filename} @gol
  -fno-asm  -fno-builtin -fno-builtin-@var{function} @gol
! -fhosted  -ffreestanding @gol
  -trigraphs  -traditional  -traditional-cpp @gol
  -fallow-single-precision  -fcond-mismatch @gol
  -fsigned-bitfields  -fsigned-char @gol
--- 164,170 ----
  @gccoptlist{
  -ansi  -std=@var{standard}  -aux-info @var{filename} @gol
  -fno-asm  -fno-builtin -fno-builtin-@var{function} @gol
! -fhosted  -ffreestanding  -fms-extensions @gol
  -trigraphs  -traditional  -traditional-cpp @gol
  -fallow-single-precision  -fcond-mismatch @gol
  -fsigned-bitfields  -fsigned-char @gol
*************** This is equivalent to @option{-fno-hoste
*** 1140,1145 ****
--- 1140,1149 ----
  
  @xref{Standards,,Language Standards Supported by GCC}, for details of
  freestanding and hosted environments.
+ 
+ @item -fms-extensions
+ @opindex fms-extensions
+ Accept some non-standard constructs used in Microsoft header files.
  
  @item -trigraphs
  @opindex trigraphs



More information about the Gcc-patches mailing list