[Insight-developers] Annoying Deprecation Warnings

Bill Lorensen bill.lorensen at gmail.com
Thu Dec 20 07:48:30 EST 2007


Mathieu,

What concerns mean is the generation of so many warnings (even if they are
correct).

I'll try Sean's suggestion later today.

Bill

On Dec 20, 2007 4:31 AM, Mathieu Malaterre <mathieu.malaterre at gmail.com>
wrote:

>  On Dec 19, 2007 11:20 PM, Sean McBride <sean at rogue-research.com> wrote:
> > On 12/19/07 4:37 PM, Bill Lorensen said:
> >
> > >2) The gnu compilers give misleading warnings:
> > >
> > >*/.../Insight/Code/Common/itkElasticB
> > >odyReciprocalSplineKernelTransform.txx:29:
> > >warning: `
> > >*   m_Alpha' is deprecated (declared at
> > >
> /.../Insight/Code/Common/itkElasticBodyReciprocalSplineKernelTransform.h
> > >   :114)
> > >/.../Insight/Code/Common/itkElasticB
> > odyReciprocalSplineKernelTransform.txx: In
> > >   member function `virtual void
> > >   itk::ElasticBodyReciprocalSplineKernelTransform<TScalarType,
> > >
> > >m_Alpha IS NOT deprecated.
> >
> > I believe this be because the __attribute__((deprecated)) thingie is
> > being used incorrectly.  Consider this sample:
> >
> > ---------------------
> > #define itkLegacyMacro(method) method __attribute__((deprecated))
> >
> > class Foo
> > {
> >         void Method2 (void);
> >         itkLegacyMacro( virtual void Method1(void); )
> >
> >         double m_Alpha;
> > };
> >
> > void Foo::Method2 (void)
> > {
> >   m_Alpha = 8.0;
> > }
> > ---------------------
> >
> > This repros the warning.  The macro expansion gives:
> >
> >  virtual void Method1(void); __attribute__((deprecated))
> >
> > But it should be:
> >
> >  virtual void Method1(void) __attribute__((deprecated));
> >
> > Then there would be no warning.
> >
> > Apple (who I believe lobbied for this feature being added to gcc) does
> > the following:
> >
> > #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) &&
> > (__GNUC_MINOR__ >= 1)))
> >     #define DEPRECATED_ATTRIBUTE __attribute__((deprecated))
> > #else
> >     #define DEPRECATED_ATTRIBUTE
> > #endif
> >
> > Then declares functions like so:
> >
> > extern void Func (int param) DEPRECATED_ATTRIBUTE;
> >
>
> Bill,
>
>  Having deprecation mechanism at compile is a huge time saver ! I
> believe the macro were used improperly as Sean explained it. Could
> someone give it a shot before removing them.
>
> Thanks,
> -Mathieu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20071220/6c51cc74/attachment.htm


More information about the Insight-developers mailing list