FreeBSD/contrib/gcc/c-decl.c
/* Process the specs, declarator and width (NULL if omitted)
   of a structure component, returning a FIELD_DECL node.
   WIDTH is non-NULL for bit-fields only, and is an INTEGER_CST node.

   This is done during the parsing of the struct declaration.
   The FIELD_DECL nodes are chained together and the lot of them
   are ultimately passed to `build_struct' to make the RECORD_TYPE node.  */
Process the specs, declarator and width (NULL if omitted)
of a structure component, returning a FIELD_DECL node.
WIDTH is non-NULL for bit-fields only, and is an INTEGER_CST node.

This is done during the parsing of the struct declaration.
The FIELD_DECL nodes are chained together and the lot of them
are ultimately passed to `build_struct' to make the RECORD_TYPE node.
Process the specs declarator and width ( NULL if omitted ) of a structure component returning a FIELD_DECL node . WIDTH is non - NULL for bit - fields only and is an INTEGER_CST node . This is done during the parsing of the struct declaration . The FIELD_DECL nodes are chained together and the lot of them are ultimately passed to ` build_struct ' to make the RECORD_TYPE node .
tree
grokfield (struct c_declarator *declarator, struct c_declspecs *declspecs,
	   tree width)
{
  tree value;
  if (declarator->kind == cdk_id && declarator->u.id == NULL_TREE
      && width == NULL_TREE)
    {
      tree type = declspecs->type;
      bool type_ok = (TREE_CODE (type) == RECORD_TYPE
		      || TREE_CODE (type) == UNION_TYPE);
      bool ok = false;
      if (type_ok
	  && (flag_ms_extensions || !declspecs->typedef_p))
	{
	  if (flag_ms_extensions)
	    ok = true;
	  else if (flag_iso)
	    ok = false;
	  else if (TYPE_NAME (type) == NULL)
	    ok = true;
	  else
	    ok = false;
	}
      if (!ok)
	{
	  pedwarn ("declaration does not declare anything");
	  return NULL_TREE;
	}
      if (pedantic)
	pedwarn ("ISO C doesn%'t support unnamed structs/unions");
    }
  value = grokdeclarator (declarator, declspecs, FIELD, false,
			  width ? &width : NULL);
  finish_decl (value, NULL_TREE, NULL_TREE);
  DECL_INITIAL (value) = width;
  return value;
}
tree grokfield ( struct c_declarator * declarator , struct c_declspecs * declspecs , tree width ) { tree value ; if ( declarator -> kind == cdk_id && declarator -> u . id == NULL_TREE && width == NULL_TREE ) { tree type = declspecs -> type ; bool type_ok = ( TREE_CODE ( type ) == RECORD_TYPE || TREE_CODE ( type ) == UNION_TYPE ) ; bool ok = false ; if ( type_ok && ( flag_ms_extensions || ! declspecs -> typedef_p ) ) { if ( flag_ms_extensions ) ok = true ; else if ( flag_iso ) ok = false ; else if ( TYPE_NAME ( type ) == NULL ) ok = true ; else ok = false ; } if ( ! ok ) { pedwarn ( " " ) ; return NULL_TREE ; } if ( pedantic ) pedwarn ( " " ) ; } value = grokdeclarator ( declarator , declspecs , FIELD , false , width ? & width : NULL ) ; finish_decl ( value , NULL_TREE , NULL_TREE ) ; DECL_INITIAL ( value ) = width ; return value ; }
Process the specs, declarator and width (NULL if omitted)
of a structure component, returning a FIELD_DECL node.
Process the specs declarator and width ( NULL if omitted ) of a structure component returning a FIELD_DECL node .
/* 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 consciously
	 took this from Plan 9 or if it was an accident of implementation
	 that took root before someone noticed the bug...  */