[Insight-developers] Warning - possible candidate for noreturn attribute

Bill Lorensen bill.lorensen at gmail.com
Mon Mar 19 14:48:50 EST 2007


Mathieu,

Is there a compiler flag to suppress that warning?

Bill


On 3/19/07, Mathieu Coursolle <mcoursolle at rogue-research.com> wrote:
>
> Hi,
>
> I currently use ITK in a XCode project on Mac OSX.
> When I include some ITK headers, I get the following
> warning:
>
> /Common/itkImageSource.txx: In member function 'void
> itk::ImageSource<TOutputImage>::ThreadedGenerateData(const typename
> TOutputImage::RegionType&, int) [with TOutputImage = ITK2DImage]':
> /Common/itkImageSource.txx:244: warning: function might be possible
> candidate for attribute 'noreturn'
>
> This is cause by the fact that the implementation of ThreadedGenerateData
> from itkImageSource (base class) just throws an exception, so it does
> not return.
>
>
> //----------------------------------------------------------------------------
> // The execute method created by the subclass.
> template <class TOutputImage>
> void
> ImageSource<TOutputImage>
> ::ThreadedGenerateData(const OutputImageRegionType&,
>                       int)
> {
> itkExceptionMacro("subclass should override this method!!!");
> }
>
> I can remove that warning by changing the function prototype to use the
> noreturn
> attribute:
>
> virtual
> void ThreadedGenerateData(const OutputImageRegionType&
> outputRegionForThread,
>                            int threadId )
> __attribute__ ((noreturn));
>
> However, I believe that the noreturn attribute is not defined on all
> compilers.
>
> Any suggestion to get rid of that warning?
>
> Thank you.
>
> Mathieu
>
> --
> ____________________________________________________________
> Mathieu Coursolle                   mcoursolle at rogue-research.com
> Rogue Research                      www.rogue-research.com
> Montréal, Québec, Canada
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> 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/20070319/6d9323cd/attachment.htm


More information about the Insight-developers mailing list