Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ matrix.type }}
-DENABLE_CCACHE=ON
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
-DENABLE_GCC_ANALYZER=ON
-G Ninja
run: |
mkdir build install
Expand Down
33 changes: 32 additions & 1 deletion cmake/celix_project/CelixProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
option(ENABLE_ADDRESS_SANITIZER "Enabled building with address sanitizer. Note for gcc libasan must be installed," OFF)
option(ENABLE_UNDEFINED_SANITIZER "Enabled building with undefined behavior sanitizer." OFF)
option(ENABLE_THREAD_SANITIZER "Enabled building with thread sanitizer." OFF)

option (ENABLE_GCC_ANALYZER "Enable building with GCC static analyzer." OFF )
# Clear "Advanced" flag for sanitizer options
mark_as_advanced(CLEAR ENABLE_ADDRESS_SANITIZER)
mark_as_advanced(CLEAR ENABLE_UNDEFINED_SANITIZER)
Expand Down Expand Up @@ -73,6 +73,37 @@ elseif (ENABLE_THREAD_SANITIZER)
set(CMAKE_CXX_FLAGS "-fsanitize=thread ${CMAKE_CXX_FLAGS}")
endif()

if (ENABLE_GCC_ANALYZER)
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
set(ANALYZER_FLAGS
"-fanalyzer"
"-Wno-analyzer-too-complex"
"-Wno-analyzer-double-fclose"
"-Wno-analyzer-double-free"
"-Wno-analyzer-deref-before-check"
"-Wno-analyzer-exposure-through-output-file"
"-Wno-analyzer-file-leak"
"-Wno-analyzer-free-of-non-heap"
"-Wno-analyzer-malloc-leak"
"-Wno-analyzer-possible-null-argument"
"-Wno-analyzer-possible-null-dereference"
"-Wno-analyzer-null-argument"
"-Wno-analyzer-null-dereference"
"-Wno-analyzer-stale-setjmp-buffer"
"-Wno-analyzer-tainted-array-index"
"-Wno-analyzer-unsafe-call-within-signal-handler"
"-Wno-analyzer-use-after-free"
"-Wno-analyzer-use-of-pointer-in-stale-stack-frame"
"-Wno-analyzer-use-of-uninitialized-value"
"-Wno-analyzer-fd-leak"
)
add_compile_options(${ANALYZER_FLAGS})
else()
message(WARNING "ENABLE_GCC_ANALYZER is only supported with GCC ")
endif()
endif()


MACRO(celix_subproject)
set(ARGS "${ARGN}")

Expand Down
4 changes: 3 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class CelixConan(ConanFile):
"framework_curlinit": True,
"enable_ccache": False,
"enable_deprecated_warnings": False,

}
options = {
"celix_err_buffer_size": ["ANY"],
Expand Down Expand Up @@ -387,7 +388,8 @@ def generate(self):
if "libcurl" in lst:
tc.cache_variables["BUILD_ERROR_INJECTOR_CURL"] = "ON"
tc.cache_variables["CELIX_ERR_BUFFER_SIZE"] = str(self.options.celix_err_buffer_size)
# tc.cache_variables["CMAKE_PROJECT_Celix_INCLUDE"] = os.path.join(self.build_folder, "conan_paths.cmake")

#tc.cache_variables["CMAKE_PROJECT_Celix_INCLUDE"] = os.path.join(self.build_folder, "conan_paths.cmake")
# the following is workaround for https://github.com/conan-io/conan/issues/7192
if self.settings.os == "Linux":
tc.cache_variables["CMAKE_EXE_LINKER_FLAGS"] = "-Wl,--unresolved-symbols=ignore-in-shared-libs"
Expand Down