Commit 6a031d2e authored by Alastair Robertson's avatar Alastair Robertson

Enable more compiler warnings

parent 9259e949
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12)
project(bpftrace) project(bpftrace)
add_compile_options("-std=c++14")
add_compile_options("-Wall")
add_compile_options("-Wextra")
add_compile_options("-Wundef")
add_compile_options("-Wpointer-arith")
add_compile_options("-Wcast-align")
add_compile_options("-Wwrite-strings")
add_compile_options("-Wcast-qual")
add_compile_options("-Wswitch-default")
add_compile_options("-Wswitch-enum")
add_compile_options("-Wconversion")
add_compile_options("-Wunreachable-code")
add_compile_options("-Wformat=2")
add_compile_options("-Wstrict-overflow=5")
add_compile_options("-Wdisabled-optimization")
add_compile_options("-pedantic")
find_package(BISON REQUIRED) find_package(BISON REQUIRED)
find_package(FLEX REQUIRED) find_package(FLEX REQUIRED)
find_package(LLVM REQUIRED CONFIG) find_package(LLVM REQUIRED CONFIG)
......
...@@ -114,9 +114,9 @@ public: ...@@ -114,9 +114,9 @@ public:
class Probe : public Node { class Probe : public Node {
public: public:
Probe(std::string &type, std::string &attach_point, StatementList *stmts) Probe(std::string &type, std::string &attach_point, StatementList *stmts)
: type(type), attach_point(attach_point), pred(nullptr), stmts(stmts), name(type+":"+attach_point) { } : type(type), attach_point(attach_point), name(type+":"+attach_point), pred(nullptr), stmts(stmts) { }
Probe(std::string &type, std::string &attach_point, Predicate *pred, StatementList *stmts) Probe(std::string &type, std::string &attach_point, Predicate *pred, StatementList *stmts)
: type(type), attach_point(attach_point), pred(pred), stmts(stmts), name(type+":"+attach_point) { } : type(type), attach_point(attach_point), name(type+":"+attach_point), pred(pred), stmts(stmts) { }
std::string type; std::string type;
std::string attach_point; std::string attach_point;
......
...@@ -10,7 +10,7 @@ namespace ast { ...@@ -10,7 +10,7 @@ namespace ast {
using ebpf::bpftrace::typestr; using ebpf::bpftrace::typestr;
void SemanticAnalyser::visit(Integer &integer) void SemanticAnalyser::visit(Integer &)
{ {
type_ = Type::integer; type_ = Type::integer;
} }
...@@ -30,7 +30,7 @@ void SemanticAnalyser::visit(Builtin &builtin) ...@@ -30,7 +30,7 @@ void SemanticAnalyser::visit(Builtin &builtin)
void SemanticAnalyser::visit(Call &call) void SemanticAnalyser::visit(Call &call)
{ {
int nargs = 0; std::vector<Expression*>::size_type nargs = 0;
if (call.vargs) { if (call.vargs) {
nargs = call.vargs->size(); nargs = call.vargs->size();
for (Expression *expr : *call.vargs) { for (Expression *expr : *call.vargs) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment