Commit 39001441 authored by Brenden Blanco's avatar Brenden Blanco

Fix compiler warnings when using clang[++]

Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent a11aab85
...@@ -31,7 +31,7 @@ class Type; ...@@ -31,7 +31,7 @@ class Type;
} }
namespace ebpf { namespace ebpf {
class TableDesc; struct TableDesc;
class BLoader; class BLoader;
class ClangLoader; class ClangLoader;
......
...@@ -7,6 +7,9 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) ...@@ -7,6 +7,9 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
BISON_TARGET(Parser parser.yy ${CMAKE_CURRENT_BINARY_DIR}/parser.yy.cc COMPILE_FLAGS "-o parser.yy.cc -v --debug") BISON_TARGET(Parser parser.yy ${CMAKE_CURRENT_BINARY_DIR}/parser.yy.cc COMPILE_FLAGS "-o parser.yy.cc -v --debug")
FLEX_TARGET(Lexer lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/lexer.ll.cc COMPILE_FLAGS "--c++ --o lexer.ll.cc") FLEX_TARGET(Lexer lexer.ll ${CMAKE_CURRENT_BINARY_DIR}/lexer.ll.cc COMPILE_FLAGS "--c++ --o lexer.ll.cc")
ADD_FLEX_BISON_DEPENDENCY(Lexer Parser) ADD_FLEX_BISON_DEPENDENCY(Lexer Parser)
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lexer.ll.cc PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register")
endif()
add_library(b_frontend loader.cc codegen_llvm.cc node.cc parser.cc printer.cc add_library(b_frontend loader.cc codegen_llvm.cc node.cc parser.cc printer.cc
type_check.cc ${BISON_Parser_OUTPUTS} ${FLEX_Lexer_OUTPUTS}) type_check.cc ${BISON_Parser_OUTPUTS} ${FLEX_Lexer_OUTPUTS})
...@@ -41,7 +41,7 @@ class GlobalVariable; ...@@ -41,7 +41,7 @@ class GlobalVariable;
} }
namespace ebpf { namespace ebpf {
class TableDesc; struct TableDesc;
namespace cc { namespace cc {
...@@ -63,7 +63,7 @@ class CodegenLLVM : public Visitor { ...@@ -63,7 +63,7 @@ class CodegenLLVM : public Visitor {
EXPAND_NODES(VISIT) EXPAND_NODES(VISIT)
#undef VISIT #undef VISIT
virtual STATUS_RETURN visit(Node* n, std::vector<TableDesc> &tables); STATUS_RETURN visit(Node* n, std::vector<TableDesc> &tables);
int get_table_fd(const std::string &name) const; int get_table_fd(const std::string &name) const;
......
...@@ -54,7 +54,7 @@ int BLoader::parse(llvm::Module *mod, const string &filename, const string &prot ...@@ -54,7 +54,7 @@ int BLoader::parse(llvm::Module *mod, const string &filename, const string &prot
//ebpf::cc::Printer printer(stderr); //ebpf::cc::Printer printer(stderr);
//printer.visit(parser_->root_node_); //printer.visit(parser_->root_node_);
ebpf::cc::TypeCheck type_check(parser_->scopes_.get(), proto_parser_->scopes_.get(), parser_->pragmas_); ebpf::cc::TypeCheck type_check(parser_->scopes_.get(), proto_parser_->scopes_.get());
auto ret = type_check.visit(parser_->root_node_); auto ret = type_check.visit(parser_->root_node_);
if (get<0>(ret) != 0 || get<1>(ret).size()) { if (get<0>(ret) != 0 || get<1>(ret).size()) {
fprintf(stderr, "Type error @line=%d: %s\n", get<0>(ret), get<1>(ret).c_str()); fprintf(stderr, "Type error @line=%d: %s\n", get<0>(ret), get<1>(ret).c_str());
......
...@@ -26,7 +26,7 @@ class Module; ...@@ -26,7 +26,7 @@ class Module;
namespace ebpf { namespace ebpf {
class TableDesc; struct TableDesc;
namespace cc { namespace cc {
class Parser; class Parser;
......
...@@ -619,9 +619,6 @@ class Visitor { ...@@ -619,9 +619,6 @@ class Visitor {
public: public:
typedef StatusTuple Ret; typedef StatusTuple Ret;
virtual ~Visitor() {} virtual ~Visitor() {}
virtual STATUS_RETURN visit(Node* n) {
return n->accept(this);
}
#define VISIT(type, func) virtual STATUS_RETURN visit_##func(type* n) = 0; #define VISIT(type, func) virtual STATUS_RETURN visit_##func(type* n) = 0;
EXPAND_NODES(VISIT) EXPAND_NODES(VISIT)
#undef VISIT #undef VISIT
......
...@@ -26,8 +26,8 @@ namespace cc { ...@@ -26,8 +26,8 @@ namespace cc {
class TypeCheck : public Visitor { class TypeCheck : public Visitor {
public: public:
TypeCheck(Scopes *scopes, Scopes *proto_scopes, const std::map<std::string, std::string>& pragmas) TypeCheck(Scopes *scopes, Scopes *proto_scopes)
: scopes_(scopes), proto_scopes_(proto_scopes), pragmas_(pragmas) {} : scopes_(scopes), proto_scopes_(proto_scopes) {}
virtual STATUS_RETURN visit(Node* n); virtual STATUS_RETURN visit(Node* n);
STATUS_RETURN expect_method_arg(MethodCallExprNode* n, size_t num, size_t num_def_args); STATUS_RETURN expect_method_arg(MethodCallExprNode* n, size_t num, size_t num_def_args);
...@@ -43,7 +43,6 @@ class TypeCheck : public Visitor { ...@@ -43,7 +43,6 @@ class TypeCheck : public Visitor {
Scopes *scopes_; Scopes *scopes_;
Scopes *proto_scopes_; Scopes *proto_scopes_;
vector<string> errors_; vector<string> errors_;
const std::map<std::string, std::string> &pragmas_;
}; };
} // namespace cc } // namespace cc
......
...@@ -27,7 +27,7 @@ class LLVMContext; ...@@ -27,7 +27,7 @@ class LLVMContext;
namespace ebpf { namespace ebpf {
class TableDesc; struct TableDesc;
namespace cc { namespace cc {
class Parser; class Parser;
......
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