[Insight-developers] VNL Warning: Is there an equivalent to itkNotUsed?

Bill Lorensen bill.lorensen at gmail.com
Tue Aug 16 16:05:30 EDT 2011


+1 for no ifdef's

On Tue, Aug 16, 2011 at 4:02 PM, David Cole <david.cole at kitware.com> wrote:

> Why are we trying to add "ifdefs" here?
>
> Just do what Sean suggested, and it's done:
>
>  (void) c;
>
> before the existing code, leave all else alone. Then push it back to
> upstream vnl to prevent it from coming back later...
>
>
> On Tue, Aug 16, 2011 at 3:49 PM, Jean-Christophe Fillion-Robin
> <jchris.fillionr at kitware.com> wrote:
> > I guess doing the following would work ..
> >
> >   inline T get (unsigned r, unsigned c) const {
> >     #ifdef NDEBUG
> >        assert(r == c); assert (r<size()); return diagonal_[r];
> >     #else
> >       (void)c;
> >       (void)r;
> >     #endif
> >   }
> >
> >
> >
> > On Tue, Aug 16, 2011 at 1:25 PM, Johnson, Hans J <hans-johnson at uiowa.edu
> >
> > wrote:
> >>
> >> That does not solve the problem.  The declaration in the function
> >> prototype would need to be if/def'ed
> >> #ifndef NDEBUG
> >>   #define vxlNotUsed(x)
> >> #else
> >>   #define vxlNotUsed(x) x
> >> #endif
> >> void RequireZeroFunction( const int vxlNotUsed(
> >> possibleNotUsedVariableName) )
> >> {
> >>   assert( possibleNotUsedVariableName == 0 );
> >>   return;
> >> }
> >> --
> >> Hans J. Johnson, Ph.D.
> >> hans-johnson at uiowa.edu
> >> Assistant Professor of Psychiatry
> >> University of Iowa Carver College of Medicine
> >> W278 GH, 200 Hawkins Drive
> >> Iowa City, Iowa 52242
> >> Phone:  319-353-8587
> >> From: Jean-Christophe Fillion-Robin <jchris.fillionr at kitware.com>
> >> Date: Tue, 16 Aug 2011 13:12:51 -0400
> >> To: Sean McBride <sean at rogue-research.com>
> >> Cc: Hans Johnson <hans-johnson at uiowa.edu>, ITK
> >> <insight-developers at itk.org>
> >> Subject: Re: [Insight-developers] VNL Warning: Is there an equivalent to
> >> itkNotUsed?
> >>
> >> What about something like that:
> >>
> >> #ifndef NDEBUG
> >>   assert(...)
> >> #endif
> >>
> >> Jc
> >>
> >> On Tue, Aug 16, 2011 at 11:58 AM, Sean McBride <sean at rogue-research.com
> >
> >> wrote:
> >>>
> >>> On Tue, 16 Aug 2011 15:54:33 +0000, Johnson, Hans J said:
> >>>
> >>> >I am trying to silence warnings from ITK for external tools.  I've
> >>> >noticed this warning that should be quite easy to silence, but I don't
> >>> >know the "vxl" compliant way to do it.
> >>> >
> >>> >Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_diag_matrix.h
> >>> >
> >>> >  //: get element with boundary checks.
> >>> >  inline T get (unsigned r, unsigned c) const {
> >>> >    assert(r == c); assert (r<size()); return diagonal_[r];
> >>> >  }
> >>> >
> >>> >/scratch/johnsonhj/src/Slicer/Applications/CLI/DiffusionApplications/
> >>> >ResampleDTI/ResampleDTI.cxx:1144:   instantiated from here
> >>>
> >>> >
> >/scratch/johnsonhj/src/Slicer-git-itkv4/ITKv4/Modules/ThirdParty/VNL/src/
> >>> >vxl/core/vnl/vnl_diag_matrix.h:106: warning: unused parameter ‘c’ [-
> >>> >Wunused-parameter]
> >>> >
> >>> >Any recommendations on how to silence this?
> >>>
> >>> In my experience, the most portable way to silence that warning is to
> >>> cast the expression to void, that is:
> >>>
> >>> (void)c;
> >>>
> >>> This works in C, C++, Objective-C, with gcc, icc, Visual Studio, clang,
> >>> and CodeWarrior.
> >>>
> >>> Some people do this:
> >>>
> >>> c = c;
> >>>
> >>> But please don't, because clang will warn about an operation that does
> >>> nothing. :)
> >>>
> >>> --
> >>> ____________________________________________________________
> >>> Sean McBride, B. Eng                 sean at rogue-research.com
> >>> Rogue Research                        www.rogue-research.com
> >>> Mac Software Developer              Montréal, Québec, Canada
> >>> _______________________________________________
> >>> Powered by www.kitware.com
> >>>
> >>> Visit other Kitware open-source projects at
> >>> http://www.kitware.com/opensource/opensource.html
> >>>
> >>> Kitware offers ITK Training Courses, for more information visit:
> >>> http://kitware.com/products/protraining.html
> >>>
> >>> Please keep messages on-topic and check the ITK FAQ at:
> >>> http://www.itk.org/Wiki/ITK_FAQ
> >>>
> >>> Follow this link to subscribe/unsubscribe:
> >>> http://www.itk.org/mailman/listinfo/insight-developers
> >>
> >>
> >>
> >> --
> >> +1 919 869 8849
> >>
> >>
> >>
> >> ________________________________
> >> Notice: This UI Health Care e-mail (including attachments) is covered by
> >> the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is
> >> confidential and may be legally privileged.  If you are not the intended
> >> recipient, you are hereby notified that any retention, dissemination,
> >> distribution, or copying of this communication is strictly prohibited.
> >> Please reply to the sender that you have received the message in error,
> then
> >> delete it.  Thank you.
> >> ________________________________
> >
> >
> > --
> > +1 919 869 8849
> >
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://kitware.com/products/protraining.html
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-developers
> >
> >
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110816/8c68aa96/attachment.htm>


More information about the Insight-developers mailing list