Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
Show First 20 Lines • Show All 2,472 Lines • ▼ Show 20 Lines | if (yypcb->pcb_pragmas != NULL) | ||||
(void) dt_idhash_iter(yypcb->pcb_pragmas, dt_idpragma, NULL); | (void) dt_idhash_iter(yypcb->pcb_pragmas, dt_idpragma, NULL); | ||||
if (argc > 1 && !(yypcb->pcb_cflags & DTRACE_C_ARGREF) && | if (argc > 1 && !(yypcb->pcb_cflags & DTRACE_C_ARGREF) && | ||||
!(yypcb->pcb_sflagv[argc - 1] & DT_IDFLG_REF)) { | !(yypcb->pcb_sflagv[argc - 1] & DT_IDFLG_REF)) { | ||||
xyerror(D_MACRO_UNUSED, "extraneous argument '%s' ($%d is " | xyerror(D_MACRO_UNUSED, "extraneous argument '%s' ($%d is " | ||||
"not referenced)\n", yypcb->pcb_sargv[argc - 1], argc - 1); | "not referenced)\n", yypcb->pcb_sargv[argc - 1], argc - 1); | ||||
} | } | ||||
/* | /* Perform sugar transformations. */ | ||||
* Perform sugar transformations (for "if" / "else") and replace the | |||||
* existing clause chain with the new one. | |||||
*/ | |||||
if (context == DT_CTX_DPROG) { | if (context == DT_CTX_DPROG) { | ||||
dt_node_t *dnp, *next_dnp; | dt_node_t *dnp, *next_dnp; | ||||
dt_node_t *new_list = NULL; | dt_node_t *new_list = NULL; | ||||
for (dnp = yypcb->pcb_root->dn_list; | for (dnp = yypcb->pcb_root->dn_list; | ||||
dnp != NULL; dnp = next_dnp) { | dnp != NULL; dnp = next_dnp) { | ||||
/* remove this node from the list */ | /* remove this node from the list */ | ||||
next_dnp = dnp->dn_list; | next_dnp = dnp->dn_list; | ||||
dnp->dn_list = NULL; | dnp->dn_list = NULL; | ||||
if (dnp->dn_kind == DT_NODE_CLAUSE) | if (dnp->dn_kind == DT_NODE_CLAUSE) { | ||||
dnp = dt_compile_sugar(dtp, dnp); | dnp = dt_compile_sugar(dtp, dnp); | ||||
if (cflags & DTRACE_C_SUGAR) { | |||||
dt_node_t *p; | |||||
dt_printd(dnp, stdout, 0); | |||||
for (p = dnp->dn_list; p != NULL; | |||||
p = p->dn_list) | |||||
dt_printd(p, stdout, 0); | |||||
} | |||||
} | |||||
/* append node to the new list */ | /* append node to the new list */ | ||||
new_list = dt_node_link(new_list, dnp); | new_list = dt_node_link(new_list, dnp); | ||||
} | } | ||||
yypcb->pcb_root->dn_list = new_list; | yypcb->pcb_root->dn_list = new_list; | ||||
} | } | ||||
/* | /* | ||||
* If we have successfully created a parse tree for a D program, loop | * If we have successfully created a parse tree for a D program, loop | ||||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |