FreeBSD/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
/*
 * The #pragma binding directive can be used to reset the version binding
 * on a global identifier or inline definition.  If the identifier is already
 * defined, we can just change di_vers.  If not, we insert the pragma into a
 * hash table of the current pcb's deferred pragmas for later processing.
 */
The #pragma binding directive can be used to reset the version binding
on a global identifier or inline definition.  If the identifier is already
defined, we can just change di_vers.  If not, we insert the pragma into a
hash table of the current pcb's deferred pragmas for later processing.
The #pragma binding directive can be used to reset the version binding on a global identifier or inline definition . If the identifier is already defined we can just change di_vers . If not we insert the pragma into a hash table of the current pcb ' s deferred pragmas for later processing .
static void
dt_pragma_binding(const char *prname, dt_node_t *dnp)
{
	dtrace_hdl_t *dtp = yypcb->pcb_hdl;
	dt_version_t vers;
	const char *name;
	dt_ident_t *idp;
	if (dnp == NULL || dnp->dn_kind != DT_NODE_STRING ||
	    dnp->dn_list == NULL || dnp->dn_list->dn_kind != DT_NODE_IDENT) {
		xyerror(D_PRAGMA_MALFORM, "malformed #pragma %s "
		    "\"version\" <ident>\n", prname);
	}
	if (dt_version_str2num(dnp->dn_string, &vers) == -1) {
		xyerror(D_PRAGMA_INVAL, "invalid version string "
		    "specified by #pragma %s\n", prname);
	}
	name = dnp->dn_list->dn_string;
	idp = dt_idstack_lookup(&yypcb->pcb_globals, name);
	if (idp != NULL) {
		if (idp->di_gen != dtp->dt_gen) {
			xyerror(D_PRAGMA_SCOPE, "#pragma %s cannot modify "
			    "entity defined outside program scope\n", prname);
		}
		idp->di_vers = vers;
		return;
	}
	if (yypcb->pcb_pragmas == NULL && (yypcb->pcb_pragmas =
	    dt_idhash_create("pragma", NULL, 0, 0)) == NULL)
		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
	idp = dt_idhash_insert(yypcb->pcb_pragmas, name, DT_IDENT_PRAGBN, 0, 0,
	    _dtrace_defattr, vers, &dt_idops_thaw, (void *)prname, dtp->dt_gen);
	if (idp == NULL)
		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
	if (dtp->dt_globals->dh_defer == NULL)
		dtp->dt_globals->dh_defer = &dt_pragma_apply;
}
static void dt_pragma_binding ( const char * prname , dt_node_t * dnp ) { dtrace_hdl_t * dtp = yypcb -> pcb_hdl ; dt_version_t vers ; const char * name ; dt_ident_t * idp ; if ( dnp == NULL || dnp -> dn_kind != DT_NODE_STRING || dnp -> dn_list == NULL || dnp -> dn_list -> dn_kind != DT_NODE_IDENT ) { xyerror ( D_PRAGMA_MALFORM , " " " \" \" \n " , prname ) ; } if ( dt_version_str2num ( dnp -> dn_string , & vers ) == -1 ) { xyerror ( D_PRAGMA_INVAL , " " " \n " , prname ) ; } name = dnp -> dn_list -> dn_string ; idp = dt_idstack_lookup ( & yypcb -> pcb_globals , name ) ; if ( idp != NULL ) { if ( idp -> di_gen != dtp -> dt_gen ) { xyerror ( D_PRAGMA_SCOPE , " " " \n " , prname ) ; } idp -> di_vers = vers ; return ; } if ( yypcb -> pcb_pragmas == NULL && ( yypcb -> pcb_pragmas = dt_idhash_create ( " " , NULL , 0 , 0 ) ) == NULL ) longjmp ( yypcb -> pcb_jmpbuf , EDT_NOMEM ) ; idp = dt_idhash_insert ( yypcb -> pcb_pragmas , name , DT_IDENT_PRAGBN , 0 , 0 , _dtrace_defattr , vers , & dt_idops_thaw , ( void * ) prname , dtp -> dt_gen ) ; if ( idp == NULL ) longjmp ( yypcb -> pcb_jmpbuf , EDT_NOMEM ) ; if ( dtp -> dt_globals -> dh_defer == NULL ) dtp -> dt_globals -> dh_defer = & dt_pragma_apply ; }
The #pragma binding directive can be used to reset the version binding
 on a global identifier or inline definition.
The #pragma binding directive can be used to reset the version binding on a global identifier or inline definition .