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)
-set(CMAKE_SHARED_LINKER_FLAGS "-static-libstdc++ -Wl,--exclude-libs=ALL")
+# if gcc 4.9 or higher is used, static libstdc++ is a good option
+#set(CMAKE_SHARED_LINKER_FLAGS "-static-libstdc++ -Wl,--exclude-libs=ALL")
+set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--exclude-libs=ALL")
add_library(bpfprog SHARED bpf_common.cc bpf_module.cc codegen_llvm.cc
node.cc parser.cc printer.cc type_check.cc libbpf.c b_frontend_action.cc
char cwd_[256];
};
+static int ftw_cb(const char *path, const struct stat *, int) {
+ return ::remove(path);
+}
+
// Scoped class to manage the creation/deletion of tmpdirs
class TmpDir {
public:
ok_ = true;
}
~TmpDir() {
- auto fn = [] (const char *path, const struct stat *, int) -> int {
- return ::remove(path);
- };
- if (::ftw(prefix_.c_str(), fn, 20) < 0)
+ if (::ftw(prefix_.c_str(), ftw_cb, 20) < 0)
::perror("ftw");
else
::remove(prefix_.c_str());