Ejemplo n.º 1
0
GLOBAL Node *DemoteProcArgs(Node *fdcl)
{
     Node *arg;
     ListMarker marker;

     assert(fdcl != NULL);

     IterateList(&marker, fdcl->u.fdcl.args);
     while (NextOnList(&marker, (GenericREF) & arg)) {
	  if (arg->typ == Decl) {
	       Node *decltype = NodeDataType(arg);

	       /* convert Adcl to pointer */
	       if (decltype->typ == Adcl) {
		    /* 
		     * ``If the specification of an array type
		     * includes any type qualifiers, the element type
		     * is so-qualified, not the array type. If the
		     * specification of a function type includes any
		     * type qualifiers, the behavior is
		     * undefined.'' 
		     * 
		     * (WG14/N843 6.7.3.8)
		     */

		    Node *t = decltype->u.adcl.type;

		    /* the type qualifiers of the specification */
		    TypeQual tq = NodeTq(NodeDataTypeSuperior(arg));
		    
		    if (tq_has_anything(tq)) {
			 t = NodeCopy(t, NodeOnly);
			 /* add qualifiers to the element type */
			 NodeUpdateTq2(t, tq_union, tq);
		    }
		    /* the pointer type is never qualified, hence EMPTY_TQ */
		    arg->u.decl.type = 
			 MakePtrCoord(EMPTY_TQ, t, decltype->coord);
	       }
	  }
     }
Ejemplo n.º 2
0
/* 
   NodeTypeQuals, NodeStorageClass, and NodeDeclQuals only work
   properly AFTER the parse is over, when storage class and
   decl qualifiers have been moved to the decl.
*/
GLOBAL TypeQual NodeTypeQuals(Node *node)
{ return TYPE_QUALS(NodeTq(node)); }
Ejemplo n.º 3
0
/* 
 * NodeTypeQuals, NodeStorageClass, and NodeDeclQuals only work
 * properly AFTER the parse is over, when storage class and
 * decl qualifiers have been moved to the decl.
 */
GLOBAL TypeQual NodeTypeQuals(Node *node)
{
     return tq_type_quals(NodeTq(node));
}