Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 792b33d48770
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 18b9ec232593
Choose a head ref
  • 6 commits
  • 1 file changed
  • 2 contributors

Commits on Oct 6, 2020

  1. Add initial support for cmake -DANALYZE=true for #180.

    This currently works with cppcheck on Linux using CMake's built-in support.
    tarunik committed Oct 6, 2020
    Copy the full SHA
    6aad56b View commit details

Commits on Oct 7, 2020

  1. Copy the full SHA
    826926d View commit details

Commits on Oct 8, 2020

  1. Copy the full SHA
    03eedf1 View commit details

Commits on Oct 10, 2020

  1. Copy the full SHA
    89afa26 View commit details

Commits on Oct 11, 2020

  1. Add initial clang-analyzer invocation support for #180.

    Note that this causes g++ to spit out a spurious warning about ignoring a linker input file since it's not linking anything.  This warning is utterly harmless and only appears in ANALYZE=true mode.
    tarunik committed Oct 11, 2020
    Copy the full SHA
    a642349 View commit details
  2. Merge pull request #229 from tarunik/static-analyzer

    Add static analyzer support (CPPCheck and clang-analyzer, at the moment) for #180
    azonenberg authored Oct 11, 2020
    Copy the full SHA
    18b9ec2 View commit details
Showing with 23 additions and 1 deletion.
  1. +23 −1 CMakeLists.txt
24 changes: 23 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
project(scopehal-cmake)

set(BUILD_DOCS CACHE BOOL "Build the documentation")
set(ANALYZE CACHE BOOL "Run static analysis on the code, requires cppcheck and clang-analyzer to be installed")

set(WARNINGS "-Wall -Wextra -Wuninitialized ")
set(WARNINGS "${WARNINGS} -Wshadow -Wunsafe-loop-optimizations -Wpedantic -Wcast-align -Wwrite-strings")
@@ -12,7 +13,7 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fsanitize=address")

if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_USE_MATH_DEFINES -D_POSIX_THREAD_SAFE_FUNCTIONS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_USE_MATH_DEFINES -D_POSIX_THREAD_SAFE_FUNCTIONS")
endif()

find_package(PkgConfig)
@@ -26,6 +27,27 @@ if(BUILD_DOCS)
add_subdirectory("${PROJECT_SOURCE_DIR}/doc")
endif()

if(ANALYZE)
find_program(CPPCHECK_PATH cppcheck DOC "Path to cppcheck when ANALYZE is enabled")
if(CPPCHECK_PATH)
set(CMAKE_CXX_CPPCHECK "${CPPCHECK_PATH};-DFT_USE_AUTOCONF_SIZEOF_TYPES;--enable=warning,performance,portability;--suppress=*:*sigc*")
message(STATUS "Found CPPCheck: ${CPPCHECK_PATH}")
else()
message(STATUS "CPPCheck not found")
endif()
# The actual clang-analyzer compiler wrapper doesn't get installed on $PATH, only scan-build which is useless to us
find_program(CLANGANALYZER_SCANBUILD_PATH scan-build DOC "Path to clang-analyzer's scan-build tool, used as a hint to find the rest of the clang-analyzer")
get_filename_component(CLANGANALYZER_SCANBUILD_BIN ${CLANGANALYZER_SCANBUILD_PATH} REALPATH)
get_filename_component(CLANGANALYZER_BIN_PATH ${CLANGANALYZER_SCANBUILD_BIN} DIRECTORY)
find_program(CLANGANALYZER_CXXANALYZER_PATH "c++-analyzer" HINTS "${CLANGANALYZER_BIN_PATH}/../libexec" DOC "Path to clang-analyzer's c++-analyzer")
if(CLANGANALYZER_CXXANALYZER_PATH)
set(CMAKE_CXX_COMPILER_LAUNCHER "${CLANGANALYZER_CXXANALYZER_PATH}")
message(STATUS "Found clang-analyzer: ${CLANGANALYZER_CXXANALYZER_PATH}")
else()
message(STATUS "clang-analyzer not found")
endif()
endif()

add_subdirectory("${PROJECT_SOURCE_DIR}/lib/graphwidget")
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/scopehal")
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/scopeprotocols")