Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Modules/Core/Common/CMake/itkCheckHasGNUAttributeAligned.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ struct B
char b;
} __attribute__ ((aligned (64)));

// fail for gcc 4.1
#if __GNUC__ == 4 && __GNUC_MINOR__ == 1
#error This version of GCC is know to have a internal compilation error with this feature in ITK.
#endif

// BUG DETECTION: This following usage may generate a segfault during
// compilation.
Expand Down
142 changes: 64 additions & 78 deletions Modules/Core/Common/include/itkMacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,109 +77,99 @@ namespace itk
// The following set of defines allows us to suppress false positives
// and still track down suspicious code
#if defined(__clang__) && defined(__has_warning)
#define CLANG_PRAGMA_PUSH ITK_PRAGMA(clang diagnostic push)
#define CLANG_PRAGMA_POP ITK_PRAGMA(clang diagnostic pop)
#if __has_warning("-Wfloat-equal")
#define CLANG_SUPPRESS_Wfloat_equal ITK_PRAGMA( clang diagnostic ignored "-Wfloat-equal" )
#else
#define CLANG_SUPPRESS_Wfloat_equal
#endif
#if __has_warning( "-Wc++14-extensions" )
#define CLANG_SUPPRESS_Wc__14_extensions ITK_PRAGMA( clang diagnostic ignored "-Wc++14-extensions" )
#else
#define CLANG_SUPPRESS_Wc__14_extensions
#endif
#define CLANG_PRAGMA_PUSH ITK_PRAGMA(clang diagnostic push)
#define CLANG_PRAGMA_POP ITK_PRAGMA(clang diagnostic pop)
#if __has_warning("-Wfloat-equal")
#define CLANG_SUPPRESS_Wfloat_equal ITK_PRAGMA( clang diagnostic ignored "-Wfloat-equal" )
#else
#define CLANG_SUPPRESS_Wfloat_equal
#endif
#if __has_warning( "-Wc++14-extensions" )
#define CLANG_SUPPRESS_Wc__14_extensions ITK_PRAGMA( clang diagnostic ignored "-Wc++14-extensions" )
#else
#define CLANG_SUPPRESS_Wc__14_extensions
#endif
#else
#define CLANG_PRAGMA_PUSH
#define CLANG_PRAGMA_POP
#define CLANG_SUPPRESS_Wfloat_equal
#define CLANG_SUPPRESS_Wc__14_extensions
#define CLANG_PRAGMA_PUSH
#define CLANG_PRAGMA_POP
#define CLANG_SUPPRESS_Wfloat_equal
#define CLANG_SUPPRESS_Wc__14_extensions
#endif

// Intel compiler convenience macros
#if defined(__INTEL_COMPILER)
#define INTEL_PRAGMA_WARN_PUSH ITK_PRAGMA(warning push)
#define INTEL_PRAGMA_WARN_POP ITK_PRAGMA(warning pop)
#define INTEL_SUPPRESS_warning_1292 ITK_PRAGMA(warning disable 1292)
#define INTEL_PRAGMA_WARN_PUSH ITK_PRAGMA(warning push)
#define INTEL_PRAGMA_WARN_POP ITK_PRAGMA(warning pop)
#define INTEL_SUPPRESS_warning_1292 ITK_PRAGMA(warning disable 1292)
#else
#define INTEL_PRAGMA_WARN_PUSH
#define INTEL_PRAGMA_WARN_POP
#define INTEL_SUPPRESS_warning_1292
#define INTEL_PRAGMA_WARN_PUSH
#define INTEL_PRAGMA_WARN_POP
#define INTEL_SUPPRESS_warning_1292
#endif

// Define ITK_GCC_PRAGMA_DIAG(param1 [param2 [...]]) macro.
//
// This macros sets a pragma diagnostic if it supported by the version
// of GCC being used otherwise it is a no-op.
// This macro sets a pragma diagnostic
//
// GCC diagnostics pragma supported only with GCC >= 4.2
#if defined( __GNUC__ ) && !defined( __INTEL_COMPILER )
# if ( __GNUC__ > 4 ) || (( __GNUC__ >= 4 ) && ( __GNUC_MINOR__ >= 2 ))
# define ITK_GCC_PRAGMA_DIAG(x) ITK_PRAGMA(GCC diagnostic x)
# else
# define ITK_GCC_PRAGMA_DIAG(x)
# endif
#else
# define ITK_GCC_PRAGMA_DIAG(x)
#endif

// Define ITK_GCC_PRAGMA_DIAG_(PUSH|POP) macros.
//
// These macros respectively push and pop the diagnostic context
// if it is supported by the version of GCC being used
// otherwise it is a no-op.
//
// GCC push/pop diagnostics pragma are supported only with GCC >= 4.6
//
// Define macro ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP if it is supported.
#if defined( __GNUC__ ) && !defined( __INTEL_COMPILER )
# if ( __GNUC__ > 4 ) || (( __GNUC__ >= 4 ) && ( __GNUC_MINOR__ >= 6 ))
# define ITK_GCC_PRAGMA_DIAG_PUSH() ITK_GCC_PRAGMA_DIAG(push)
# define ITK_GCC_PRAGMA_DIAG_POP() ITK_GCC_PRAGMA_DIAG(pop)
# define ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
# else
# define ITK_GCC_PRAGMA_DIAG_PUSH()
# define ITK_GCC_PRAGMA_DIAG_POP()
# endif
#define ITK_GCC_PRAGMA_DIAG(x) ITK_PRAGMA(GCC diagnostic x)
#define ITK_GCC_PRAGMA_DIAG_PUSH() ITK_GCC_PRAGMA_DIAG(push)
#define ITK_GCC_PRAGMA_DIAG_POP() ITK_GCC_PRAGMA_DIAG(pop)
#else
# define ITK_GCC_PRAGMA_DIAG_PUSH()
# define ITK_GCC_PRAGMA_DIAG_POP()
#define ITK_GCC_PRAGMA_DIAG(x)
#define ITK_GCC_PRAGMA_DIAG_PUSH()
#define ITK_GCC_PRAGMA_DIAG_POP()
#endif

/*
* ITK only supports MSVC++ 7.1 and greater
* MSVC++ 11.0 _MSC_VER = 1700
* MSVC++ 10.0 _MSC_VER = 1600
* MSVC++ 9.0 _MSC_VER = 1500
* MSVC++ 8.0 _MSC_VER = 1400
* MSVC++ 7.1 _MSC_VER = 1310
* MSVC++ 7.0 _MSC_VER = 1300
* MSVC++ 6.0 _MSC_VER = 1200
* MSVC++ 5.0 _MSC_VER = 1100
* ITK only supports MSVC++ 14.0 and greater
Comment thread
dzenanz marked this conversation as resolved.
* MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015 version 14.0)
* MSVC++ 14.1 _MSC_VER == 1910 (Visual Studio 2017 version 15.0)
* MSVC++ 14.11 _MSC_VER == 1911 (Visual Studio 2017 version 15.3)
* MSVC++ 14.12 _MSC_VER == 1912 (Visual Studio 2017 version 15.5)
* MSVC++ 14.13 _MSC_VER == 1913 (Visual Studio 2017 version 15.6)
* MSVC++ 14.14 _MSC_VER == 1914 (Visual Studio 2017 version 15.7)
* MSVC++ 14.15 _MSC_VER == 1915 (Visual Studio 2017 version 15.8)
* MSVC++ 14.16 _MSC_VER == 1916 (Visual Studio 2017 version 15.9)
* MSVC++ 14.2 _MSC_VER == 1920 (Visual Studio 2019 Version 16.0)
*/
#if defined( _MSC_VER ) && ( _MSC_VER < 1310 )
//#error "_MSC_VER < 1310 (MSVC++ 7.1) not supported under ITKv4"
#if defined( _MSC_VER ) && ( _MSC_VER < 1900 )
#error "Visual Studio < 2015 is not supported under ITKv5"
#endif
#if defined( __SUNPRO_CC ) && ( __SUNPRO_CC < 0x590 )
#error "__SUNPRO_CC < 0x590 not supported under ITKv4"
#if defined( __SUNPRO_CC ) && ( __SUNPRO_CC < 0x5140 )
#error "SUNPro C++ < 5.14.0 is not supported under ITKv5 and above"
#endif
#if defined( __CYGWIN__ )
#error "The Cygwin compiler is not supported in ITKv4 and above"
#error "The Cygwin compiler is not supported in ITKv4 and above"
#endif
#if defined( __BORLANDC__ )
#error "The Borland C compiler is not supported in ITKv4 and above"
#error "The Borland C compiler is not supported in ITKv4 and above"
#endif
#if defined( __MWERKS__ )
#error "The MetroWerks compiler is not supported in ITKv4 and above"
#error "The MetroWerks compiler is not supported in ITKv4 and above"
#endif
#if defined( __GNUC__ ) && !defined(__clang__) && !defined(__INTEL_COMPILER) && (( __GNUC__ < 4 ) || (( __GNUC__ == 4 ) && ( __GNUC_MINOR__ < 8 )))
#error "GCC < 4.8 is not supported under ITKv5"
#endif
#if defined( __GNUC__ ) && ( __GNUC__ < 3 )
#error "The __GNUC__ version 2.95 compiler is not supprted under ITKv4 and above"
#if defined( __sgi )
//This is true for IRIX 6.5.18m with MIPSPro 7.3.1.3m.
//TODO: At some future point, it may be necessary to
//define a minimum __sgi version that will work.
#error "The __sgi compiler is not supprted under ITKv4 and above"
//This is true for IRIX 6.5.18m with MIPSPro 7.3.1.3m.
//TODO: At some future point, it may be necessary to
//define a minimum __sgi version that will work.
#error "The SGI compiler is not supprted under ITKv4 and above"
#endif
#if defined(__APPLE__)
#if defined( __clang__ ) && (( __clang_major__ < 8 ) || (( __clang_major__ == 8 ) && ( __clang_minor__ < 1 )))
#error "Apple LLVM < 8.1 is not supported under ITKv5"
#endif
#elif defined( __clang__ ) && (( __clang_major < 3 ) || (( __clang_major__ == 3 ) && ( __clang_minor__ < 3 )))
#error "Clang < 3.3 is not supported under ITKv5"
#endif
#if defined( __INTEL_COMPILER ) && ( __INTEL_COMPILER < 1504 )
#error "Intel C++ < 15.0.4 is not supported under ITKv5"
#endif

// Setup symbol exports
Expand Down Expand Up @@ -570,7 +560,7 @@ itkTypeMacro(newexcp, parentexcp); \
#else
// Setup compile-time warnings for uses of deprecated methods if
// possible on this compiler.
#if defined( __GNUC__ ) && !defined( __INTEL_COMPILER ) && ( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) )
#if defined( __GNUC__ ) && !defined( __INTEL_COMPILER )
#define itkLegacyMacro(method) method __attribute__( ( deprecated ) )
#elif defined( _MSC_VER )
#define itkLegacyMacro(method) __declspec(deprecated) method
Expand Down Expand Up @@ -769,11 +759,7 @@ compilers.
* and is beneficial in other cases where a value can be constant.
*
* \ingroup ITKCommon */
#if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__ ) < 405 && !defined( __clang__ ) && !defined( __INTEL_COMPILER )
# define itkStaticConstMacro(name,type,value) enum { name = value }
#else
# define itkStaticConstMacro(name,type,value) static constexpr type name = value
#endif
#define itkStaticConstMacro(name,type,value) static constexpr type name = value

#define itkGetStaticConstMacro(name) (Self::name)

Expand Down
10 changes: 2 additions & 8 deletions Modules/Core/Common/include/itkMetaDataObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,7 @@ inline bool ExposeMetaData(const MetaDataDictionary & Dictionary, const std::str
namespace itk
{

#ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
ITK_GCC_PRAGMA_DIAG_PUSH()
#endif
ITK_GCC_PRAGMA_DIAG_PUSH()
ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")

extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< bool >;
Expand Down Expand Up @@ -294,11 +292,7 @@ extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< Array<float> >;
extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< Array<double> >;
extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< Matrix<double> >;

#ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
ITK_GCC_PRAGMA_DIAG_POP()
#else
ITK_GCC_PRAGMA_DIAG(warning "-Wattributes")
#endif
ITK_GCC_PRAGMA_DIAG_POP()

} // end namespace itk
# undef ITKCommon_EXPORT_EXPLICIT
Expand Down
10 changes: 2 additions & 8 deletions Modules/Core/Common/include/itkMultiThreaderBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ class ITKCommon_EXPORT MultiThreaderBase : public Object
* (void *)arg passed into the SetSingleMethod.
*
* DEPRECATED! Use WorkUnitInfo instead. */
#ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
ITK_GCC_PRAGMA_DIAG_PUSH()
#endif
ITK_GCC_PRAGMA_DIAG_PUSH()
ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
INTEL_PRAGMA_WARN_PUSH
INTEL_SUPPRESS_warning_1292
Expand All @@ -195,11 +193,7 @@ INTEL_PRAGMA_WARN_POP
ThreadFunctionType ThreadFunction;
enum { SUCCESS, ITK_EXCEPTION, ITK_PROCESS_ABORTED_EXCEPTION, STD_EXCEPTION, UNKNOWN } ThreadExitCode;
};
#ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
ITK_GCC_PRAGMA_DIAG_POP()
#else
ITK_GCC_PRAGMA_DIAG(warning "-Wattributes")
#endif
ITK_GCC_PRAGMA_DIAG_POP()
#endif //ITK_LEGACY_REMOVE

/** This is the structure that is passed to the thread that is
Expand Down
10 changes: 2 additions & 8 deletions Modules/Core/Common/include/itkSimpleDataObjectDecorator.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,12 @@ SimpleDataObjectDecorator< T >
::SimpleDataObjectDecorator()
{
#if defined( __GNUC__ ) && ( __GNUC__ > 6 )
#ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
ITK_GCC_PRAGMA_DIAG_PUSH()
#endif
ITK_GCC_PRAGMA_DIAG_PUSH()
ITK_GCC_PRAGMA_DIAG(ignored "-Wmaybe-uninitialized")
#endif // defined( __GNUC__ ) && ( __GNUC__ > 6 )
this->m_Component = ComponentType(); // initialize here to avoid Purify UMR
#if defined( __GNUC__ ) && ( __GNUC__ > 6 )
#ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
ITK_GCC_PRAGMA_DIAG_POP()
#else
ITK_GCC_PRAGMA_DIAG(warning "-Wmaybe-uninitialized")
#endif
ITK_GCC_PRAGMA_DIAG_POP()
#endif // defined( __GNUC__ ) && ( __GNUC__ > 6 )
this->m_Initialized = false; // Still needed since not all objects
// are initialized at construction time.
Expand Down
5 changes: 2 additions & 3 deletions Modules/Core/Common/include/itkStaticAssert.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@
* \ingroup ITKCommon
*/
# define itkStaticAssert(expr, str) static_assert(expr, str)
#elif defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__ ) >= 403 && !defined(__clang__) && !defined( __INTEL_COMPILER )
// GCC 4.3 is enough for this trick
// But it restricts the static assertion to non global contexts (-> functions)
#elif defined(__GNUC__) && !defined( __INTEL_COMPILER )
// This trick restricts the static assertion to non global contexts (-> functions)
# define itkStaticAssert(expr,str) \
({extern int __attribute__((error(str))) StaticAssertFailure(); \
((void)((expr) ? 0: StaticAssertFailure()), 0); \
Expand Down
4 changes: 1 addition & 3 deletions Modules/Core/Common/src/itkLightObject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
#include <mutex>

// Better name demanging for gcc
#if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 )
#ifndef __EMSCRIPTEN__
#if defined( __GNUC__ ) && !defined( __EMSCRIPTEN__ )
#define GCC_USEDEMANGLE
#endif
#endif

#ifdef GCC_USEDEMANGLE
#include <cstdlib>
Expand Down
10 changes: 2 additions & 8 deletions Modules/Core/Common/src/itkMetaDataObject.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
namespace itk
{

#ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
ITK_GCC_PRAGMA_DIAG_PUSH()
#endif
ITK_GCC_PRAGMA_DIAG_PUSH()
ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")

template class ITKCommon_EXPORT MetaDataObject< bool >;
Expand Down Expand Up @@ -51,10 +49,6 @@ template class ITKCommon_EXPORT MetaDataObject< std::vector<double> >;
template class ITKCommon_EXPORT MetaDataObject< std::vector<std::vector<double> > >;
template class ITKCommon_EXPORT MetaDataObject< std::vector<std::vector<float> > >;

#ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
ITK_GCC_PRAGMA_DIAG_POP()
#else
ITK_GCC_PRAGMA_DIAG(warning "-Wattributes")
#endif
ITK_GCC_PRAGMA_DIAG_POP()

} // end namespace itk
4 changes: 0 additions & 4 deletions Modules/Core/Common/test/itkMetaDataDictionaryTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ int itkMetaDataDictionaryTest(int , char * [])
MyDictionary.Print(std::cout);


// Iterator are broken on VS6
#if !(defined(_MSC_VER) && _MSC_VER < 1300)
std::cout << "Exercise the Iterator access" << std::endl;
try
{
Expand Down Expand Up @@ -165,8 +163,6 @@ int itkMetaDataDictionaryTest(int , char * [])
}


#endif

//NOTE: Must clean up memory allocated with char * StrandedMemory=new char[2345];
delete[] StrandedMemory;

Expand Down
4 changes: 1 addition & 3 deletions Modules/Core/Common/test/itkNumericTraitsTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@
#include <cstddef>

// Better name demanging for gcc
#if __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ > 0 )
#ifndef __EMSCRIPTEN__
#if defined( __GNUC__ ) && !defined( __EMSCRIPTEN__ )
#define GCC_USEDEMANGLE
#endif
#endif

#ifdef GCC_USEDEMANGLE
#include <cstdlib>
Expand Down
5 changes: 0 additions & 5 deletions Modules/Core/Common/test/itkSmartPointerGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@ TEST(SmartPointer, EmptyAndNull)
// EXPECT_TRUE( 0 == ptr );

}
#ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
ITK_GCC_PRAGMA_DIAG_POP()
#else
ITK_GCC_PRAGMA_DIAG(warning "-Wconversion-null")
#endif


TEST(SmartPointer,Converting)
Expand Down
10 changes: 2 additions & 8 deletions Modules/Core/Transform/include/itkTransformBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,11 @@ using TransformBase = TransformBaseTemplate< double >;
# endif
namespace itk
{
#ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
ITK_GCC_PRAGMA_DIAG_PUSH()
#endif
ITK_GCC_PRAGMA_DIAG_PUSH()
ITK_GCC_PRAGMA_DIAG(ignored "-Wattributes")
extern template class ITKTransform_EXPORT_EXPLICIT TransformBaseTemplate< double >;
extern template class ITKTransform_EXPORT_EXPLICIT TransformBaseTemplate< float >;
#ifdef ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
ITK_GCC_PRAGMA_DIAG_POP()
#else
ITK_GCC_PRAGMA_DIAG(warning "-Wattributes")
#endif
ITK_GCC_PRAGMA_DIAG_POP()
} // end namespace itk
# undef ITKTransform_EXPORT_EXPLICIT
#endif
Loading