Commit d19e0cb0 authored by Marco Leogrande's avatar Marco Leogrande Committed by 4ast

Fix or hide a few warnings (#695)

* Flag ${LLVM_INCLUDE_DIRS} as a system include directory

g++ supports a -isystem switch, that can be used to mark a given
directory as a system include directory. Warnings generated by system
include directories are ignored by default.

This commit hides a long list of warnings, like the following one,
generated by llvm header files included from ${LLVM_INCLUDE_DIRS}:

 /usr/lib/llvm-3.7/include/clang/AST/APValue.h:373:44: warning:
   dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
Signed-off-by: default avatarMarco Leogrande <marcol@plumgrid.com>

* Fix 'defined but not used' warning

Remove unused function from the USDT probes test.

The warning was:

 tests/cc/test_usdt_probes.cc:59:15: warning:
   ‘size_t countsubs(const string&, const string&)’ defined but not used [-Wunused-function]
Signed-off-by: default avatarMarco Leogrande <marcol@plumgrid.com>
parent 69e361ac
......@@ -66,7 +66,7 @@ if(NOT DEFINED BCC_KERNEL_MODULES_SUFFIX)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -isystem ${LLVM_INCLUDE_DIRS}")
endif()
add_subdirectory(examples)
......
......@@ -56,15 +56,6 @@ TEST_CASE("test finding a probe in our own process", "[usdt]") {
}
#endif // HAVE_SDT_HEADER
static size_t countsubs(const std::string &str, const std::string &sub) {
size_t count = 0;
for (size_t offset = str.find(sub); offset != std::string::npos;
offset = str.find(sub, offset + sub.length())) {
++count;
}
return count;
}
class ChildProcess {
pid_t pid_;
......
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