Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -Wnull-dereference warning and fix issues #683

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions cmake/traccc-compiler-options-cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ if( ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" ) OR
traccc_add_flag( CMAKE_CXX_FLAGS "-Wshadow" )
traccc_add_flag( CMAKE_CXX_FLAGS "-Wunused-local-typedefs" )
traccc_add_flag( CMAKE_CXX_FLAGS "-pedantic" )
traccc_add_flag( CMAKE_CXX_FLAGS "-Wold-style-cast" )
traccc_add_flag( CMAKE_CXX_FLAGS "-Wnull-dereference" )
if(PROJECT_IS_TOP_LEVEL)
traccc_add_flag( CMAKE_CXX_FLAGS "-Wfloat-conversion" )
endif()
Expand Down
3 changes: 2 additions & 1 deletion core/include/traccc/seeding/spacepoint_binning_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ inline std::pair<detray::axis2::circular<>, detray::axis2::regular<>> get_axes(

scalar zBinSize = grid_config.cotThetaMax * grid_config.deltaRMax;
detray::dindex zBins = std::max(
1, (int)std::floor((grid_config.zMax - grid_config.zMin) / zBinSize));
1, static_cast<int>(
std::floor((grid_config.zMax - grid_config.zMin) / zBinSize)));

detray::axis2::regular m_z_axis{zBins, grid_config.zMin, grid_config.zMax,
mr};
Expand Down
7 changes: 7 additions & 0 deletions extern/tbb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ set( TBB_STRICT FALSE CACHE BOOL "Do not throw errors on compiler warnings" )

# Get it into the current directory.
FetchContent_MakeAvailable( TBB )

# Treat the TBB headers as "system headers", to avoid getting warnings from
# them.
get_target_property( _incDirs tbb INTERFACE_INCLUDE_DIRECTORIES )
target_include_directories( tbb
SYSTEM INTERFACE ${_incDirs} )
unset( _incDirs )
2 changes: 1 addition & 1 deletion io/src/csv/read_cells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ traccc::cell_module get_module(const std::uint64_t geometry_id,
}

// Set the value on the module description.
result.placement = (*geom)[result.surface_link.value()];
result.placement = geom->at(result.surface_link.value());
}

// Find/set the digitization configuration of the detector module.
Expand Down
2 changes: 1 addition & 1 deletion io/src/csv/read_spacepoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void read_spacepoints(spacepoint_reader_output& out, std::string_view filename,
m[iohit.geometry_id] = link;
cell_module mod;
mod.surface_link = detray::geometry::barcode{iohit.geometry_id};
mod.placement = geom[iohit.geometry_id];
mod.placement = geom.at(iohit.geometry_id);
result_modules.push_back(mod);
}

Expand Down
Loading