[Insight-developers] Annoying Deprecation Warnings : Annoying but Necessary.

Luis Ibanez luis.ibanez at kitware.com
Thu Dec 20 11:51:48 EST 2007


Bill,

If the concern is the amount of warnings, you can enable in those builds
the CMake variable:

                      ITK_LEGACY_SILENT


We shouldn't remove the warnings, because that's how we alert users
about the fact that this deprecated code is going to be removed in
a future release.

These warnings are the early opportunity for users to stop using code
that will disappear. If we remove the warnings, then users will be
surprised when we actually remove the code, which is exactly the
situation that the backward compatibility policy wants to avoid .


My suggestion is that ITK_LEGACY_SILENT should be OFF by default,
and that Dashboard machines should set it to ON.

In this way, users will get the warnings, but the Dashboard will
not display them and will not be cluttered with them.


    Luis



-----------------------
Bill Lorensen wrote:
> 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 
> <mailto: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
>     <mailto:sean at rogue-research.com>
>     Rogue Research                        www.rogue-research.com
>     <http://www.rogue-research.com>
>     Mac Software Developer              Montréal, Québec, Canada
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers


More information about the Insight-developers mailing list