コード例 #1
0
ファイル: parse.c プロジェクト: mosconi/openbsd
/*-
 *---------------------------------------------------------------------
 * ParseLinkSrc  --
 *	Link the parent node to its new child. Used by
 *	ParseDoDependency. If the specType isn't 'Not', the parent
 *	isn't linked as a parent of the child.
 *
 * Side Effects:
 *	New elements are added to the parents list of cgn and the
 *	children list of cgn. the unmade field of pgn is updated
 *	to reflect the additional child.
 *---------------------------------------------------------------------
 */
static void
ParseLinkSrc(GNode *pgn, GNode *cgn)
{
	if (Lst_AddNew(&pgn->children, cgn)) {
		if (specType == SPECIAL_NONE)
			Lst_AtEnd(&cgn->parents, pgn);
		pgn->unmade++;
	}
}
コード例 #2
0
ファイル: engine.c プロジェクト: 7shi/openbsd-crosstools
void
Make_HandleUse(GNode	*cgn,	/* The .USE node */
               GNode	*pgn)	/* The target of the .USE node */
{
    GNode	*gn;	/* A child of the .USE node */
    LstNode	ln;	/* An element in the children list */


    assert(cgn->type & (OP_USE|OP_TRANSFORM));

    if ((cgn->type & OP_USE) || Lst_IsEmpty(&pgn->commands)) {
        /* .USE or transformation and target has no commands
         * -- append the child's commands to the parent.  */
        Lst_Concat(&pgn->commands, &cgn->commands);
    }

    for (ln = Lst_First(&cgn->children); ln != NULL;
            ln = Lst_Adv(ln)) {
        gn = (GNode *)Lst_Datum(ln);

        if (Lst_AddNew(&pgn->children, gn)) {
            Lst_AtEnd(&gn->parents, pgn);
            pgn->unmade++;
        }
    }

    pgn->type |= cgn->type & ~(OP_OPMASK|OP_USE|OP_TRANSFORM);

    /*
     * This child node is now "made", so we decrement the count of
     * unmade children in the parent... We also remove the child
     * from the parent's list to accurately reflect the number of
     * decent children the parent has. This is used by Make_Run to
     * decide whether to queue the parent or examine its children...
     */
    if (cgn->type & OP_USE)
        pgn->unmade--;

    /* if the parent node doesn't have any location, then inherit the
     * use stuff, since that gives us better error messages.
     */
    if (!pgn->lineno) {
        pgn->lineno = cgn->lineno;
        pgn->fname = cgn->fname;
    }
}