summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--Makefile.am8
-rw-r--r--Makefile.in8
-rw-r--r--elaborate.cxx36
-rw-r--r--elaborate.h2
-rw-r--r--loc2c-test.c3
-rw-r--r--loc2c.c18
-rw-r--r--parse.cxx2
-rw-r--r--staptree.cxx18
-rw-r--r--tapsets.cxx48
-rw-r--r--translate.cxx6
11 files changed, 88 insertions, 70 deletions
diff --git a/ChangeLog b/ChangeLog
index 1926988d..7b186f5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-02-19 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 4078 and more, including patch from
+ Eugeniy Meshcheryakov <eugen@debian.org>:
+ * Makefile.am (AM_CXXFLAGS, AM_CFLAGS): Add -Wextra -Wall -Werror
+ consistently.
+ * Makefile.in: Regenerated.
+ (*): Many minor warning fixes.
+
2007-02-17 Frank Ch. Eigler <fche@elastic.org>
PR 4066.
diff --git a/Makefile.am b/Makefile.am
index ef685b2b..94808fa0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,9 +7,8 @@ pkglibexecdir = ${libexecdir}/${PACKAGE}
AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DPKGDATADIR='"${pkgdatadir}"' -DPKGLIBDIR='"$(pkglibexecdir)"'
-AM_CFLAGS = -std=gnu99 -D_GNU_SOURCE -fexceptions \
- -Wall -Werror -Wshadow -Wunused -Wformat=2 -W
-AM_CXXFLAGS = -Wall
+AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Wextra -Werror -Wshadow -Wunused -Wformat=2 -W
+AM_CXXFLAGS = -Wall -Wextra -Werror
dist_man_MANS = stap.1 stapprobes.5 stapfuncs.5 stapex.5 lket.5 lket-b2a.1 man/stapprobes.iosched.5 man/stapprobes.netdev.5 man/stapprobes.nfs.5 man/stapprobes.nfsd.5 man/stapprobes.pagefault.5 man/stapprobes.process.5 man/stapprobes.rpc.5 man/stapprobes.scsi.5 man/stapprobes.signal.5 man/stapprobes.socket.5 man/stapprobes.tcp.5 man/stapprobes.udp.5
bin_PROGRAMS = stap staprun
@@ -19,7 +18,7 @@ stap_SOURCES = main.cxx \
cache.cxx util.cxx
stap_LDADD = @stap_LIBS@
-stap_CXXFLAGS = -Werror $(AM_CXXFLAGS)
+stap_CXXFLAGS = $(AM_CXXFLAGS)
stap_CPPFLAGS = $(AM_CPPFLAGS)
stap_LDFLAGS = $(AM_LDFLAGS)
@@ -52,7 +51,6 @@ install-exec-local: install-elfutils
endif
staprun_SOURCES = runtime/stpd/stpd.c runtime/stpd/librelay.c runtime/stpd/symbols.c
-
staprun_CFLAGS = @PROCFLAGS@
staprun_LDADD = @PROCFLAGS@ -lpthread
diff --git a/Makefile.in b/Makefile.in
index 4d54cd6a..a72a7fb8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -245,10 +245,8 @@ target_alias = @target_alias@
AUTOMAKE_OPTIONS = dist-bzip2
pkglibexecdir = ${libexecdir}/${PACKAGE}
AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DPKGDATADIR='"${pkgdatadir}"' -DPKGLIBDIR='"$(pkglibexecdir)"'
-AM_CFLAGS = -std=gnu99 -D_GNU_SOURCE -fexceptions \
- -Wall -Werror -Wshadow -Wunused -Wformat=2 -W
-
-AM_CXXFLAGS = -Wall
+AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Wextra -Werror -Wshadow -Wunused -Wformat=2 -W
+AM_CXXFLAGS = -Wall -Wextra -Werror
dist_man_MANS = stap.1 stapprobes.5 stapfuncs.5 stapex.5 lket.5 lket-b2a.1 man/stapprobes.iosched.5 man/stapprobes.netdev.5 man/stapprobes.nfs.5 man/stapprobes.nfsd.5 man/stapprobes.pagefault.5 man/stapprobes.process.5 man/stapprobes.rpc.5 man/stapprobes.scsi.5 man/stapprobes.signal.5 man/stapprobes.socket.5 man/stapprobes.tcp.5 man/stapprobes.udp.5
stap_SOURCES = main.cxx \
parse.cxx staptree.cxx elaborate.cxx translate.cxx \
@@ -256,7 +254,7 @@ stap_SOURCES = main.cxx \
cache.cxx util.cxx
stap_LDADD = @stap_LIBS@
-stap_CXXFLAGS = -Werror $(AM_CXXFLAGS)
+stap_CXXFLAGS = $(AM_CXXFLAGS)
stap_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_1)
stap_LDFLAGS = $(AM_LDFLAGS) $(am__append_2)
CLEANFILES = $(am__append_3) $(pkglibexec_SCRIPTS)
diff --git a/elaborate.cxx b/elaborate.cxx
index d74af612..05c2be57 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -340,7 +340,7 @@ struct alias_derived_probe: public derived_probe
// types, and are not themselves emitted or listed in
// systemtap_session.probes
- void join_group (systemtap_session& s) { upchuck (); }
+ void join_group (systemtap_session&) { upchuck (); }
};
@@ -357,7 +357,7 @@ alias_expansion_builder
virtual void build(systemtap_session & sess,
probe * use,
probe_point * location,
- std::map<std::string, literal *> const & parameters,
+ std::map<std::string, literal *> const &,
vector<derived_probe *> & finished_results)
{
// We're going to build a new probe and wrap it up in an
@@ -1809,15 +1809,17 @@ semantic_pass_types (systemtap_session& s)
}
if (ti.num_newly_resolved == 0) // converged
- if (ti.num_still_unresolved == 0)
- break; // successfully
- else if (! ti.assert_resolvability)
- ti.assert_resolvability = true; // last pass, with error msgs
- else
- { // unsuccessful conclusion
- rc ++;
- break;
- }
+ {
+ if (ti.num_still_unresolved == 0)
+ break; // successfully
+ else if (! ti.assert_resolvability)
+ ti.assert_resolvability = true; // last pass, with error msgs
+ else
+ { // unsuccessful conclusion
+ rc ++;
+ break;
+ }
+ }
}
return rc + s.num_errors();
@@ -2301,7 +2303,7 @@ typeresolution_info::visit_block (block* e)
void
-typeresolution_info::visit_embeddedcode (embeddedcode* e)
+typeresolution_info::visit_embeddedcode (embeddedcode*)
{
}
@@ -2405,7 +2407,7 @@ typeresolution_info::visit_foreach_loop (foreach_loop* e)
void
-typeresolution_info::visit_null_statement (null_statement* e)
+typeresolution_info::visit_null_statement (null_statement*)
{
}
@@ -2451,19 +2453,19 @@ typeresolution_info::visit_delete_statement (delete_statement* e)
void
-typeresolution_info::visit_next_statement (next_statement* s)
+typeresolution_info::visit_next_statement (next_statement*)
{
}
void
-typeresolution_info::visit_break_statement (break_statement* s)
+typeresolution_info::visit_break_statement (break_statement*)
{
}
void
-typeresolution_info::visit_continue_statement (continue_statement* s)
+typeresolution_info::visit_continue_statement (continue_statement*)
{
}
@@ -2716,7 +2718,7 @@ typeresolution_info::mismatch (const token* tok, exp_type t1, exp_type t2)
void
-typeresolution_info::resolved (const token* tok, exp_type t)
+typeresolution_info::resolved (const token*, exp_type)
{
num_newly_resolved ++;
// cerr << "resolved " << *e->tok << " type " << t << endl;
diff --git a/elaborate.h b/elaborate.h
index 3f1c2275..aafe0ae1 100644
--- a/elaborate.h
+++ b/elaborate.h
@@ -117,7 +117,7 @@ struct derived_probe: public probe
virtual void join_group (systemtap_session& s) = 0;
virtual probe_point* sole_location ();
- virtual void emit_probe_context_vars (translator_output* o) {}
+ virtual void emit_probe_context_vars (translator_output*) {}
// From within unparser::emit_common_header, add any extra variables
// to this probe's context locals.
diff --git a/loc2c-test.c b/loc2c-test.c
index 535493a2..c39ab061 100644
--- a/loc2c-test.c
+++ b/loc2c-test.c
@@ -87,7 +87,8 @@ handle_variable (Dwarf_Die *scopes, int nscopes, int out,
XXX inlines botched
*/
Dwarf_Attribute fb_attr_mem, *fb_attr = NULL;
- for (int inner = 0; inner < nscopes; ++inner)
+ int inner;
+ for (inner = 0; inner < nscopes; ++inner)
{
switch (dwarf_tag (&scopes[inner]))
{
diff --git a/loc2c.c b/loc2c.c
index 667bd07f..d7aa1273 100644
--- a/loc2c.c
+++ b/loc2c.c
@@ -1092,7 +1092,8 @@ discontiguify (struct obstack *pool, int indent, struct location *loc,
{
if (loc->type != loc_noncontiguous)
return (loc->byte_size ?: total_bytes) <= max_piece_bytes;
- for (struct location *p = loc->pieces; p != NULL; p = p->next)
+ struct location *p;
+ for (p = loc->pieces; p != NULL; p = p->next)
if (p->byte_size > max_piece_bytes)
return false;
return true;
@@ -1188,7 +1189,8 @@ declare_noncontig_union (struct obstack *pool, int indent,
obstack_printf (pool, "%*sstruct {\n", indent++ * 2, "");
Dwarf_Word offset = 0;
- for (struct location *p = loc->pieces; p != NULL; p = p->next)
+ struct location *p;
+ for (p = loc->pieces; p != NULL; p = p->next)
{
obstack_printf (pool, "%*suint%" PRIu64 "_t p%" PRIu64 ";\n",
indent * 2, "", p->byte_size * 8, offset);
@@ -1381,7 +1383,8 @@ translate_base_store (struct obstack *pool, int indent, Dwarf_Word byte_size,
Dwarf_Word offset = 0;
char piece[sizeof "u.pieces.p" + 20] = "u.pieces.p";
- for (struct location *p = store_loc->pieces; p != NULL; p = p->next)
+ struct location *p;
+ for (p = store_loc->pieces; p != NULL; p = p->next)
{
struct location *newp = obstack_alloc (pool, sizeof *newp);
*newp = *p;
@@ -1651,7 +1654,8 @@ emit_header (FILE *out, struct location *loc, unsigned int hindent)
else
{
emit ("%*s{ // DWARF expression:", hindent * 2, "");
- for (size_t i = 0; i < loc->nops; ++i)
+ size_t i;
+ for (i = 0; i < loc->nops; ++i)
{
emit (" %#x", loc->ops[i].atom);
if (loc->ops[i].number2 == 0)
@@ -1692,7 +1696,8 @@ emit_loc_address (FILE *out, struct location *loc, unsigned int indent,
{
emit ("%*s{\n", indent * 2, "");
emit ("%*s%s " STACKFMT, (indent + 1) * 2, "", STACK_TYPE, 0);
- for (unsigned int i = 1; i < loc->address.stack_depth; ++i)
+ unsigned i;
+ for (i = 1; i < loc->address.stack_depth; ++i)
emit (", " STACKFMT, i);
emit (";\n");
@@ -1737,7 +1742,8 @@ c_emit_location (FILE *out, struct location *loc, int indent)
emit ("%*s{\n", indent * 2, "");
bool declared_addr = false;
- for (struct location *l = loc; l != NULL; l = l->next)
+ struct location *l;
+ for (l = loc; l != NULL; l = l->next)
switch (l->type)
{
case loc_decl:
diff --git a/parse.cxx b/parse.cxx
index 881c75bc..5674daa8 100644
--- a/parse.cxx
+++ b/parse.cxx
@@ -1021,7 +1021,7 @@ parser::parse_statement ()
void
-parser::parse_global (vector <vardecl*>& globals, vector<probe*>& probes)
+parser::parse_global (vector <vardecl*>& globals, vector<probe*>&)
{
const token* t0 = next ();
if (! (t0->type == tok_keyword && t0->content == "global"))
diff --git a/staptree.cxx b/staptree.cxx
index 151d6863..daac09cb 100644
--- a/staptree.cxx
+++ b/staptree.cxx
@@ -1265,12 +1265,12 @@ traversing_visitor::visit_block (block* s)
}
void
-traversing_visitor::visit_embeddedcode (embeddedcode* s)
+traversing_visitor::visit_embeddedcode (embeddedcode*)
{
}
void
-traversing_visitor::visit_null_statement (null_statement* s)
+traversing_visitor::visit_null_statement (null_statement*)
{
}
@@ -1331,27 +1331,27 @@ traversing_visitor::visit_delete_statement (delete_statement* s)
}
void
-traversing_visitor::visit_next_statement (next_statement* s)
+traversing_visitor::visit_next_statement (next_statement*)
{
}
void
-traversing_visitor::visit_break_statement (break_statement* s)
+traversing_visitor::visit_break_statement (break_statement*)
{
}
void
-traversing_visitor::visit_continue_statement (continue_statement* s)
+traversing_visitor::visit_continue_statement (continue_statement*)
{
}
void
-traversing_visitor::visit_literal_string (literal_string* e)
+traversing_visitor::visit_literal_string (literal_string*)
{
}
void
-traversing_visitor::visit_literal_number (literal_number* e)
+traversing_visitor::visit_literal_number (literal_number*)
{
}
@@ -1431,12 +1431,12 @@ traversing_visitor::visit_assignment (assignment* e)
}
void
-traversing_visitor::visit_symbol (symbol* e)
+traversing_visitor::visit_symbol (symbol*)
{
}
void
-traversing_visitor::visit_target_symbol (target_symbol* e)
+traversing_visitor::visit_target_symbol (target_symbol*)
{
}
diff --git a/tapsets.cxx b/tapsets.cxx
index e2454c1f..61bd48c9 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -101,7 +101,7 @@ struct be_builder: public derived_probe_builder
{
bool begin;
be_builder(bool b) : begin(b) {}
- virtual void build(systemtap_session & sess,
+ virtual void build(systemtap_session &,
probe * base,
probe_point * location,
std::map<std::string, literal *> const & parameters,
@@ -291,17 +291,17 @@ struct never_derived_probe: public derived_probe
{
never_derived_probe (probe* p): derived_probe (p) {}
never_derived_probe (probe* p, probe_point* l): derived_probe (p, l) {}
- void join_group (systemtap_session& s) { /* thus no probe_group */ }
+ void join_group (systemtap_session&) { /* thus no probe_group */ }
};
struct never_builder: public derived_probe_builder
{
never_builder() {}
- virtual void build(systemtap_session & sess,
+ virtual void build(systemtap_session &,
probe * base,
probe_point * location,
- std::map<std::string, literal *> const & parameters,
+ std::map<std::string, literal *> const &,
vector<derived_probe *> & finished_results)
{
finished_results.push_back(new never_derived_probe(base, location));
@@ -536,7 +536,7 @@ struct dwflpp
string function_name;
string const default_name(char const * in,
- char const * type)
+ char const *)
{
if (in)
return in;
@@ -1175,14 +1175,18 @@ struct dwflpp
}
- static void loc2c_error (void *arg, const char *fmt, ...)
+ static void loc2c_error (void *, const char *fmt, ...)
{
- char *msg = NULL;
+ const char *msg = "?";
+ char *tmp = NULL;
int rc;
va_list ap;
va_start (ap, fmt);
- rc = vasprintf (&msg, fmt, ap);
- if (rc < 0) msg = "?";
+ rc = vasprintf (& tmp, fmt, ap);
+ if (rc < 0)
+ msg = "?";
+ else
+ msg = tmp;
va_end (ap);
throw semantic_error (msg);
}
@@ -1558,8 +1562,8 @@ struct dwflpp
Dwarf_Die *die,
Dwarf_Attribute *attr_mem,
bool lvalue,
- string & prelude,
- string & postlude,
+ string & /*prelude*/,
+ string & /*postlude*/,
exp_type & ty)
{
/* First boil away any qualifiers associated with the type DIE of
@@ -1656,7 +1660,7 @@ struct dwflpp
// XXX: deref flag not reliable; emit fault label unconditionally
// XXX: print the faulting address, like the user_string/kernel_string
// tapset functions do
- if (deref) ;
+ (void) deref;
fprintf(memstream,
"deref_fault:\n"
" c->last_error = \"pointer dereference fault\";\n"
@@ -2280,7 +2284,7 @@ in_kprobes_function(systemtap_session& sess, Dwarf_Addr addr)
bool
dwarf_query::blacklisted_p(const string& funcname,
const string& filename,
- int line,
+ int,
const string& module,
const string& section,
Dwarf_Addr addr)
@@ -2834,7 +2838,7 @@ query_kernel_module (Dwfl_Module *mod,
static int
query_module (Dwfl_Module *mod __attribute__ ((unused)),
void **userdata __attribute__ ((unused)),
- const char *name, Dwarf_Addr base,
+ const char *name, Dwarf_Addr,
void *arg __attribute__ ((unused)))
{
dwarf_query * q = static_cast<dwarf_query *>(arg);
@@ -4030,7 +4034,7 @@ public:
};
-profile_derived_probe::profile_derived_probe (systemtap_session &s, probe* p, probe_point* l):
+profile_derived_probe::profile_derived_probe (systemtap_session &, probe* p, probe_point* l):
derived_probe(p, l)
{
}
@@ -4051,7 +4055,7 @@ struct profile_builder: public derived_probe_builder
virtual void build(systemtap_session & sess,
probe * base,
probe_point * location,
- std::map<std::string, literal *> const & parameters,
+ std::map<std::string, literal *> const &,
vector<derived_probe *> & finished_results)
{
finished_results.push_back(new profile_derived_probe(sess, base, location));
@@ -4179,9 +4183,9 @@ struct mark_derived_probe: public derived_probe
struct mark_derived_probe_group: public generic_dpg<mark_derived_probe>
{
public:
- void emit_module_decls (systemtap_session& s) {}
- void emit_module_init (systemtap_session& s) {}
- void emit_module_exit (systemtap_session& s) {}
+ void emit_module_decls (systemtap_session&) {}
+ void emit_module_init (systemtap_session&) {}
+ void emit_module_exit (systemtap_session&) {}
};
@@ -5023,9 +5027,9 @@ public:
struct perfmon_derived_probe_group: public generic_dpg<perfmon_derived_probe>
{
public:
- void emit_module_decls (systemtap_session& s) {}
- void emit_module_init (systemtap_session& s) {}
- void emit_module_exit (systemtap_session& s) {}
+ void emit_module_decls (systemtap_session&) {}
+ void emit_module_init (systemtap_session&) {}
+ void emit_module_exit (systemtap_session&) {}
};
diff --git a/translate.cxx b/translate.cxx
index 83ee8815..4a2ff6f8 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -2099,7 +2099,7 @@ c_unparser::visit_embeddedcode (embeddedcode *s)
void
-c_unparser::visit_null_statement (null_statement *s)
+c_unparser::visit_null_statement (null_statement *)
{
// visit_statement (s, 0);
//
@@ -3182,7 +3182,7 @@ c_unparser_assignment::visit_symbol (symbol *e)
void
c_unparser::visit_target_symbol (target_symbol* e)
{
- throw semantic_error("cannot translate general target-symbol expression");
+ throw semantic_error("cannot translate general target-symbol expression", e->tok);
}
@@ -3947,7 +3947,7 @@ c_unparser::visit_stat_op (stat_op* e)
void
-c_unparser::visit_hist_op (hist_op* e)
+c_unparser::visit_hist_op (hist_op*)
{
// Hist ops can only occur in a limited set of circumstances:
//