Skip to content

Commit f8fed2d

Browse files
Fix various asserts (#4125)
1 parent ec67bd3 commit f8fed2d

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

cpp/dolfinx/fem/Function.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ class Function
130130
std::span<value_type> x_new = x->array();
131131
for (std::size_t i = 0; i < map.size(); ++i)
132132
{
133-
assert((int)i < x_new.size());
134-
assert(map[i] < x_old.size());
133+
assert(i < x_new.size());
134+
assert(static_cast<std::size_t>(map[i]) < x_old.size());
135135
x_new[i] = x_old[map[i]];
136136
}
137137

cpp/dolfinx/fem/interpolate.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ void interpolation_apply(U&& Pi, V&& data, std::span<T> coeffs, int bs)
331331
else
332332
{
333333
assert(data.extent(0) == Pi.extent(1));
334-
assert(data.extent(1) == bs);
334+
assert(static_cast<int>(data.extent(1)) == bs);
335335
std::size_t cols = Pi.extent(1);
336336
for (int k = 0; k < bs; ++k)
337337
{
@@ -843,7 +843,7 @@ void identity_mapped_evaluation(const FiniteElement<U>& element, bool symmetric,
843843
const auto [_Pi, pi_shape] = element.interpolation_operator();
844844
md::mdspan<const U, std::dextents<std::size_t, 2>> Pi(_Pi.data(), pi_shape);
845845
const std::size_t num_interp_points = Pi.extent(1);
846-
assert(Pi.extent(0) == num_scalar_dofs);
846+
assert(static_cast<int>(Pi.extent(0)) == num_scalar_dofs);
847847

848848
auto apply_inv_transpose_dof_transformation
849849
= element.template dof_transformation_fn<T>(
@@ -1040,7 +1040,7 @@ void piola_mapped_evaluation(const FiniteElement<U>& element, bool symmetric,
10401040
apply_inv_trans_dof_transformation(coeffs_b, cell_info, *cell_it, 1);
10411041

10421042
// Copy interpolation dofs into coefficient vector
1043-
assert(coeffs_b.size() == num_scalar_dofs);
1043+
assert(coeffs_b.size() == static_cast<std::size_t>(num_scalar_dofs));
10441044
for (int i = 0; i < num_scalar_dofs; ++i)
10451045
{
10461046
const int dof = i * element_bs + k;

python/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ find_package(nanobind CONFIG REQUIRED)
3838
enable_language(C)
3939

4040
find_package(DOLFINX REQUIRED CONFIG)
41+
set_target_properties(dolfinx PROPERTIES SYSTEM OFF)
4142

4243
if(DOLFINX_FOUND)
4344
message(STATUS "Found DOLFINx at ${DOLFINX_DIR}")
@@ -77,7 +78,7 @@ if(NANOBIND_SABI)
7778
# mpi4py and petsc4py use generated Cython headers so tell
7879
# them that the limited API is in use.
7980
target_compile_definitions(cpp PRIVATE MPI4PY_LIMITED_API=1)
80-
# Needing to set CYTHON_COMPILING_IN_LIMITED_API is a bug in
81+
# Needing to set CYTHON_COMPILING_IN_LIMITED_API is a bug in
8182
# Cython-generated API headers, should become unnecessary with
8283
# mpi4py/petsc4py releases published using Cython >= 3.1.4
8384
# https://github.com/cython/cython/issues/7108
@@ -88,10 +89,10 @@ endif()
8889
include(CheckCXXCompilerFlag)
8990

9091
# Add some strict compiler checks
91-
check_cxx_compiler_flag("-Wall -Werror -Wextra -pedantic -Wno-sign-compare" HAVE_PEDANTIC)
92+
check_cxx_compiler_flag("-Wall -Werror -Wextra -pedantic" HAVE_PEDANTIC)
9293

9394
if(HAVE_PEDANTIC)
94-
list(APPEND DOLFINX_PY_CXX_DEVELOPER_FLAGS -Wall;-Werror;-Wextra;-pedantic;-Wno-sign-compare)
95+
list(APPEND DOLFINX_PY_CXX_DEVELOPER_FLAGS -Wall;-Werror;-Wextra;-pedantic)
9596
endif()
9697

9798
# Debug flags
@@ -135,7 +136,6 @@ target_compile_options(
135136
target_compile_definitions(
136137
cpp PRIVATE $<$<CONFIG:Developer>:${DOLFINX_PY_CXX_DEVELOPER_DEFINITIONS}>
137138
)
138-
139139
target_compile_definitions(cpp PRIVATE cxx_std_20)
140140

141141
if(ENABLE_CLANG_TIDY)

0 commit comments

Comments
 (0)