[Insight-developers] Annoying Deprecation Warnings

Bill Lorensen bill.lorensen at gmail.com
Thu Dec 20 11:17:44 EST 2007


Sean,

Those changes work great under linux. Now I don't get the warnings at all
(unless I invoke the deprecated method. I'll try the same thing on Windows
before I check in the changes.

Thanks,

Bill

On Dec 19, 2007 5: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;
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20071220/a28fdca2/attachment.html


More information about the Insight-developers mailing list