PERFORCE change 127660 for review
John Birrell
jb at FreeBSD.org
Wed Oct 17 22:07:24 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=127660
Change 127660 by jb at jb_freebsd1 on 2007/10/18 05:06:49
Fix compiler warnings for WARNS=6.
Affected files ...
.. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/input.c#7 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/st_parse.c#5 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/stabs.c#6 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/strtab.c#7 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/strtab.h#5 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/tdata.c#4 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/traverse.c#4 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/traverse.h#3 edit
Differences ...
==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/input.c#7 (text) ====
@@ -88,7 +88,7 @@
int require_ctf)
{
Elf_Scn *ctfscn;
- Elf_Data *ctfdata;
+ Elf_Data *ctfdata = NULL;
symit_data_t *si = NULL;
int ctfscnidx;
tdata_t *td;
@@ -221,7 +221,7 @@
/*ARGSUSED*/
int
-read_ctf_save_cb(tdata_t *td, char *name, void *retp)
+read_ctf_save_cb(tdata_t *td, char *name __unused, void *retp)
{
tdata_t **tdp = retp;
==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/st_parse.c#5 (text) ====
@@ -76,12 +76,11 @@
static char *intrinsic(char *cp, tdesc_t **rtdp);
static char *arraydef(char *cp, tdesc_t **rtdp);
-extern int debug_level;
int debug_parse = DEBUG_PARSE;
/*PRINTFLIKE3*/
static void
-parse_debug(int level, char *cp, char *fmt, ...)
+parse_debug(int level, char *cp, const char *fmt, ...)
{
va_list ap;
char buf[1024];
@@ -113,9 +112,9 @@
/* Report unexpected syntax in stabs. */
static void
_expected(
- char *who, /* what function, or part thereof, is reporting */
- char *what, /* what was expected */
- char *where, /* where we were in the line of input */
+ const char *who, /* what function, or part thereof, is reporting */
+ const char *what, /* what was expected */
+ const char *where, /* where we were in the line of input */
int line)
{
fprintf(stderr, "%s, expecting \"%s\" at \"%s\"\n", who, what, where);
@@ -126,7 +125,7 @@
/*ARGSUSED*/
void
-parse_init(tdata_t *td)
+parse_init(tdata_t *td __unused)
{
int i;
@@ -159,7 +158,7 @@
return (tdp);
}
-char *
+static char *
read_tid(char *cp, tdesc_t **tdpp)
{
tdesc_t *tdp;
@@ -190,7 +189,7 @@
static iitype_t
parse_fun(char *cp, iidesc_t *ii)
{
- iitype_t iitype;
+ iitype_t iitype = 0;
tdesc_t *tdp;
tdesc_t **args = NULL;
int nargs = 0;
@@ -250,7 +249,7 @@
parse_sym(char *cp, iidesc_t *ii)
{
tdesc_t *tdp;
- iitype_t iitype;
+ iitype_t iitype = 0;
/*
* name:G global variable
@@ -1038,14 +1037,14 @@
}
}
-tdesc_t *
-lookup_name(tdesc_t **hash, const char *name)
+static tdesc_t *
+lookup_name(tdesc_t **hash, const char *name1)
{
- int bucket = compute_sum(name);
+ int bucket = compute_sum(name1);
tdesc_t *tdp, *ttdp = NULL;
for (tdp = hash[bucket]; tdp != NULL; tdp = tdp->t_next) {
- if (tdp->t_name != NULL && strcmp(tdp->t_name, name) == 0) {
+ if (tdp->t_name != NULL && strcmp(tdp->t_name, name1) == 0) {
if (tdp->t_type == STRUCT || tdp->t_type == UNION ||
tdp->t_type == ENUM || tdp->t_type == INTRINSIC)
return (tdp);
@@ -1057,9 +1056,9 @@
}
tdesc_t *
-lookupname(const char *name)
+lookupname(const char *name1)
{
- return (lookup_name(name_table, name));
+ return (lookup_name(name_table, name1));
}
/*
@@ -1151,8 +1150,9 @@
/*ARGSUSED1*/
static int
-resolve_typed_bitfields_cb(mlist_t *ml, void *private)
+resolve_typed_bitfields_cb(void *arg, void *private __unused)
{
+ mlist_t *ml = arg;
tdesc_t *tdp = ml->ml_type;
debug(3, "Resolving typed bitfields (member %s)\n",
@@ -1194,5 +1194,5 @@
resolve_typed_bitfields(void)
{
(void) list_iter(typedbitfldmems,
- (int (*)())resolve_typed_bitfields_cb, NULL);
+ resolve_typed_bitfields_cb, NULL);
}
==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/stabs.c#6 (text) ====
@@ -47,7 +47,7 @@
#include "memory.h"
#include "traverse.h"
-const char *curhdr;
+char *curhdr;
/*
* The stabs generator will sometimes reference types before they've been
@@ -59,7 +59,7 @@
*/
/*ARGSUSED2*/
static int
-resolve_tou_node(tdesc_t *node, tdesc_t **nodep, void *private)
+resolve_tou_node(tdesc_t *node, tdesc_t **nodep, void *private __unused)
{
tdesc_t *new;
@@ -79,7 +79,7 @@
/*ARGSUSED*/
static int
-resolve_fwd_node(tdesc_t *node, tdesc_t **nodep, void *private)
+resolve_fwd_node(tdesc_t *node, tdesc_t **nodep, void *private __unused)
{
tdesc_t *new = lookupname(node->t_name);
@@ -174,7 +174,7 @@
* assembled under an iidesc list.
*/
int
-stabs_read(tdata_t *td, Elf *elf, const char *file)
+stabs_read(tdata_t *td, Elf *elf, char *file)
{
Elf_Scn *scn;
Elf_Data *data;
@@ -200,7 +200,7 @@
file_stack = stack_new(free);
- stack_push(file_stack, (void *)file);
+ stack_push(file_stack, file);
curhdr = file;
debug(3, "Found stabs in %d, strings in %d\n", stabidx, stabstridx);
@@ -255,7 +255,7 @@
if (stab->n_type == N_BINCL) {
curhdr = xstrdup(str);
- stack_push(file_stack, (void *)curhdr);
+ stack_push(file_stack, curhdr);
continue;
} else if (stab->n_type == N_SO) {
if (str[strlen(str) - 1] != '/') {
==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/strtab.c#7 (text) ====
@@ -205,7 +205,7 @@
ssize_t
strtab_write(const strtab_t *sp,
- ssize_t (*func)(const void *, size_t, void *), void *priv)
+ ssize_t (*func)(void *, size_t, void *), void *priv)
{
ssize_t res, total = 0;
ulong_t i;
==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/strtab.h#5 (text) ====
@@ -59,7 +59,7 @@
extern size_t strtab_insert(strtab_t *, const char *);
extern size_t strtab_size(const strtab_t *);
extern ssize_t strtab_write(const strtab_t *,
- ssize_t (*)(const void *, size_t, void *), void *);
+ ssize_t (*)(void *, size_t, void *), void *);
extern void strtab_print(const strtab_t *);
#ifdef __cplusplus
==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/tdata.c#4 (text) ====
@@ -174,9 +174,10 @@
return (!streq(tdp1->t_name, tdp2->t_name));
}
+#if defined(sun)
/*ARGSUSED1*/
-int
-tdesc_print(void *data, void *private)
+static int
+tdesc_print(void *data, void *private __unused)
{
tdesc_t *tdp = data;
@@ -184,6 +185,7 @@
return (1);
}
+#endif
static void
free_intr(tdesc_t *tdp)
@@ -247,39 +249,42 @@
};
/*ARGSUSED1*/
-static int
-tdesc_free_cb(tdesc_t *tdp, void *private)
+static void
+tdesc_free_cb(void *arg, void *private __unused)
{
+ tdesc_t *tdp = arg;
if (tdp->t_name)
free(tdp->t_name);
if (free_cbs[tdp->t_type])
free_cbs[tdp->t_type](tdp);
free(tdp);
- return (1);
+ return;
}
void
tdesc_free(tdesc_t *tdp)
{
- (void) tdesc_free_cb(tdp, NULL);
+ tdesc_free_cb(tdp, NULL);
}
static int
-tdata_label_cmp(labelent_t *le1, labelent_t *le2)
+tdata_label_cmp(void *arg1, void *arg2)
{
+ labelent_t *le1 = arg1;
+ labelent_t *le2 = arg2;
return (le1->le_idx - le2->le_idx);
}
void
-tdata_label_add(tdata_t *td, char *label, int idx)
+tdata_label_add(tdata_t *td, const char *label, int idx)
{
labelent_t *le = xmalloc(sizeof (*le));
le->le_name = xstrdup(label);
le->le_idx = (idx == -1 ? td->td_nextid - 1 : idx);
- slist_add(&td->td_labels, le, (int (*)())tdata_label_cmp);
+ slist_add(&td->td_labels, le, tdata_label_cmp);
}
static int
@@ -304,8 +309,10 @@
}
static int
-tdata_label_find_cb(labelent_t *le, labelent_t *tmpl)
+tdata_label_find_cb(void *arg1, void *arg2)
{
+ labelent_t *le = arg1;
+ labelent_t *tmpl = arg2;
return (streq(le->le_name, tmpl->le_name));
}
@@ -323,7 +330,7 @@
let.le_name = label;
if (!(ret = (labelent_t *)list_find(td->td_labels, &let,
- (int (*)())tdata_label_find_cb)))
+ tdata_label_find_cb)))
return (-1);
return (ret->le_idx);
@@ -351,8 +358,9 @@
/*ARGSUSED1*/
static void
-tdata_label_free_cb(labelent_t *le, void *private)
+tdata_label_free_cb(void *arg, void *private __unused)
{
+ labelent_t *le = arg;
if (le->le_name)
free(le->le_name);
free(le);
@@ -361,7 +369,7 @@
void
tdata_label_free(tdata_t *td)
{
- list_free(td->td_labels, (void (*)())tdata_label_free_cb, NULL);
+ list_free(td->td_labels, tdata_label_free_cb, NULL);
td->td_labels = NULL;
}
@@ -391,8 +399,8 @@
void
tdata_free(tdata_t *td)
{
- hash_free(td->td_iihash, (void (*)())iidesc_free, NULL);
- hash_free(td->td_layouthash, (void (*)())tdesc_free_cb, NULL);
+ hash_free(td->td_iihash, iidesc_free, NULL);
+ hash_free(td->td_layouthash, tdesc_free_cb, NULL);
hash_free(td->td_idhash, NULL, NULL);
list_free(td->td_fwdlist, NULL, NULL);
@@ -408,7 +416,7 @@
/*ARGSUSED1*/
static int
-build_hashes(tdesc_t *ctdp, tdesc_t **ctdpp, void *private)
+build_hashes(tdesc_t *ctdp, tdesc_t **ctdpp __unused, void *private)
{
tdata_t *td = private;
@@ -465,7 +473,7 @@
td2->td_fwdlist = NULL;
slist_merge(&td1->td_labels, td2->td_labels,
- (int (*)())tdata_label_cmp);
+ tdata_label_cmp);
td2->td_labels = NULL;
/* free the td2 hashes (data is now part of td1) */
==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/traverse.c#4 (text) ====
@@ -37,11 +37,9 @@
#include "traverse.h"
#include "memory.h"
-int (*tddescenders[])();
-int (*tdnops[])();
+int (*tddescenders[])(tdesc_t *, tdtrav_data_t *);
+tdtrav_cb_f tdnops[];
-int tdtraverse(tdesc_t *, tdesc_t **, tdtrav_data_t *);
-
void
tdtrav_init(tdtrav_data_t *tdtd, int *vgenp, tdtrav_cb_f *firstops,
tdtrav_cb_f *preops, tdtrav_cb_f *postops, void *private)
@@ -68,7 +66,7 @@
if ((rc = tdtraverse(fn->fn_ret, &fn->fn_ret, tdtd)) < 0)
return (rc);
- for (i = 0; i < fn->fn_nargs; i++) {
+ for (i = 0; i < (int) fn->fn_nargs; i++) {
if ((rc = tdtraverse(fn->fn_args[i], &fn->fn_args[i],
tdtd)) < 0)
return (rc);
@@ -106,7 +104,7 @@
/*ARGSUSED*/
int
-tdtrav_assert(tdesc_t *node, tdesc_t **nodep, void *private)
+tdtrav_assert(tdesc_t *node __unused, tdesc_t **nodep __unused, void *private __unused)
{
assert(1 == 0);
@@ -151,7 +149,7 @@
tdtraverse(tdesc_t *this, tdesc_t **thisp, tdtrav_data_t *tdtd)
{
tdtrav_cb_f travcb;
- int (*descender)();
+ int (*descender)(tdesc_t *, tdtrav_data_t *);
int descend = 1;
int rc;
@@ -187,8 +185,10 @@
}
int
-iitraverse_td(iidesc_t *ii, tdtrav_data_t *tdtd)
+iitraverse_td(void *arg1, void *arg2)
{
+ iidesc_t *ii = arg1;
+ tdtrav_data_t *tdtd = arg2;
int i, rc;
if ((rc = tdtraverse(ii->ii_dtype, &ii->ii_dtype, tdtd)) < 0)
@@ -222,5 +222,5 @@
tdtrav_init(&tdtd, vgenp, firstops, preops, postops, private);
- return (hash_iter(iihash, (int (*)())iitraverse_td, &tdtd));
+ return (hash_iter(iihash, iitraverse_td, &tdtd));
}
==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/traverse.h#3 (text) ====
@@ -60,7 +60,7 @@
void *);
int iitraverse_hash(hash_t *, int *, tdtrav_cb_f *, tdtrav_cb_f *,
tdtrav_cb_f *, void *);
-int iitraverse_td(iidesc_t *ii, tdtrav_data_t *);
+int iitraverse_td(void *, void *);
int tdtrav_assert(tdesc_t *, tdesc_t **, void *);
More information about the p4-projects
mailing list