Skip to content

Commit

Permalink
COMP: Suppress false positive non-null warning by GCC
Browse files Browse the repository at this point in the history
The error message was:

In file included from /home/dzenan/ITKNornir/include/IRGridCommon.h:33,
                 from /home/dzenan/ITKNornir/src/IRGridCommon.cxx:30:
/home/dzenan/ITKNornir/include/itkIRCommon.h: In function ‘typename legendre_transform_t::Pointer approx_transform(const pnt2d_t&, const pnt2d_t&, const mask_t*, const base_transform_t*, unsigned int, unsigned int, bool) [with legendre_transform_t = itk::LegendrePolynomialTransform<double, 1>]’:
/home/dzenan/ITKNornir/include/itkIRCommon.h:6305:51: warning: ‘this’ pointer is null [-Wnonnull]
 6305 |   vec2d_t shift = center - inverse->TransformPoint(center);
      |                            ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
  • Loading branch information
dzenanz committed Oct 15, 2024
1 parent be634b4 commit 965308f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/itkIRCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -6302,7 +6302,10 @@ approx_transform(const pnt2d_t & tile_min,
// calculate the shift:
pnt2d_t center =
pnt2d(tile_min[0] + (tile_max[0] - tile_min[0]) / 2.0, tile_min[1] + (tile_max[1] - tile_min[1]) / 2.0);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnonnull"
vec2d_t shift = center - inverse->TransformPoint(center);
#pragma GCC diagnostic pop

typename legendre_transform_t::Pointer approx = setup_transform<legendre_transform_t>(tile_min, tile_max);
approx->setup_translation(shift[0], shift[1]);
Expand Down

0 comments on commit 965308f

Please sign in to comment.