aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c')
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c50
1 files changed, 11 insertions, 39 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
index a9328ab067b9..00b826978f37 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
@@ -18,9 +18,8 @@
*
* CDDL HEADER END
*/
-
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -28,9 +27,7 @@
#include <assert.h>
#include <strings.h>
-#if defined(sun)
#include <alloca.h>
-#endif
#include <stdlib.h>
#include <stdio.h>
@@ -213,7 +210,6 @@ dt_pragma_depends(const char *prname, dt_node_t *cnp)
dt_node_t *nnp = cnp ? cnp->dn_list : NULL;
int found;
dt_lib_depend_t *dld;
- char lib[MAXPATHLEN];
if (cnp == NULL || nnp == NULL ||
cnp->dn_kind != DT_NODE_IDENT || nnp->dn_kind != DT_NODE_IDENT) {
@@ -227,53 +223,29 @@ dt_pragma_depends(const char *prname, dt_node_t *cnp)
dt_module_t *mp = dt_module_lookup_by_name(dtp, nnp->dn_string);
found = mp != NULL && dt_module_getctf(dtp, mp) != NULL;
} else if (strcmp(cnp->dn_string, "library") == 0) {
+
+ /*
+ * We have the file we are working on in dtp->dt_filetag
+ * so find that node and add the dependency in.
+ */
if (yypcb->pcb_cflags & DTRACE_C_CTL) {
- assert(dtp->dt_filetag != NULL);
+ char lib[MAXPATHLEN];
- /*
- * We have the file we are working on in dtp->dt_filetag
- * so find that node and add the dependency in.
- */
dld = dt_lib_depend_lookup(&dtp->dt_lib_dep,
dtp->dt_filetag);
assert(dld != NULL);
- (void) snprintf(lib, sizeof (lib), "%s%s",
+ (void) snprintf(lib, MAXPATHLEN, "%s%s",
dld->dtld_libpath, nnp->dn_string);
if ((dt_lib_depend_add(dtp, &dld->dtld_dependencies,
lib)) != 0) {
xyerror(D_PRAGMA_DEPEND,
- "failed to add dependency %s:%s\n", lib,
+ "failed to add dependency %s:%s\n",
+ lib,
dtrace_errmsg(dtp, dtrace_errno(dtp)));
}
- } else {
- /*
- * By this point we have already performed a topological
- * sort of the dependencies; we process this directive
- * as satisfied as long as the dependency was properly
- * loaded.
- */
- if (dtp->dt_filetag == NULL)
- xyerror(D_PRAGMA_DEPEND, "main program may "
- "not explicitly depend on a library");
-
- dld = dt_lib_depend_lookup(&dtp->dt_lib_dep,
- dtp->dt_filetag);
- assert(dld != NULL);
-
- (void) snprintf(lib, sizeof (lib), "%s%s",
- dld->dtld_libpath, nnp->dn_string);
- dld = dt_lib_depend_lookup(&dtp->dt_lib_dep_sorted,
- lib);
- assert(dld != NULL);
-
- if (!dld->dtld_loaded)
- xyerror(D_PRAGMA_DEPEND, "program requires "
- "library \"%s\" which failed to load",
- lib);
}
-
- found = B_TRUE;
+ found = 1;
} else {
xyerror(D_PRAGMA_INVAL, "invalid class %s "
"specified by #pragma %s\n", cnp->dn_string, prname);