From 12efd4ff709c596bb2eed5e601ffd6b48c2dbf49 Mon Sep 17 00:00:00 2001 From: sven Date: Tue, 11 Sep 2018 09:52:58 -0700 Subject: [PATCH 1/2] add intel specific DEPRECATED macros --- common/include/pcl/pcl_macros.h | 54 +++++++++++++++------------------ 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/common/include/pcl/pcl_macros.h b/common/include/pcl/pcl_macros.h index 4f45aac49e3..6c1680e0c24 100644 --- a/common/include/pcl/pcl_macros.h +++ b/common/include/pcl/pcl_macros.h @@ -321,22 +321,19 @@ log2f (float x) #define __has_extension(x) 0 // Compatibility with pre-3.0 compilers. #endif -#if (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) < PCL_LINEAR_VERSION(4,5,0) && ! defined(__clang__)) || defined(__INTEL_COMPILER) -#define PCL_DEPRECATED(message) __attribute__ ((deprecated)) -#endif - +// check Intel compiler first since it usually also defines __GNUC__, __clang__, etc. +#if defined(__INTEL_COMPILER) + #define PCL_DEPRECATED(message) __attribute((deprecated)) +#elif (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) < PCL_LINEAR_VERSION(4,5,0) && ! defined(__clang__)) || defined(__INTEL_COMPILER) + #define PCL_DEPRECATED(message) __attribute__ ((deprecated)) // gcc supports this starting from 4.5 : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43666 -#if (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) >= PCL_LINEAR_VERSION(4,5,0)) || (defined(__clang__) && __has_extension(attribute_deprecated_with_message)) -#define PCL_DEPRECATED(message) __attribute__ ((deprecated(message))) -#endif - -#ifdef _MSC_VER -#define PCL_DEPRECATED(message) __declspec(deprecated(message)) -#endif - -#ifndef PCL_DEPRECATED -#pragma message("WARNING: You need to implement PCL_DEPRECATED for this compiler") -#define PCL_DEPRECATED(message) +#elif (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) >= PCL_LINEAR_VERSION(4,5,0)) || (defined(__clang__) && __has_extension(attribute_deprecated_with_message)) + #define PCL_DEPRECATED(message) __attribute__ ((deprecated(message))) +#elif defined(_MSC_VER) + #define PCL_DEPRECATED(message) __declspec(deprecated(message)) +#else + #pragma message("WARNING: You need to implement PCL_DEPRECATED for this compiler") + #define PCL_DEPRECATED(message) #endif @@ -356,22 +353,19 @@ log2f (float x) // NewClass() {} // }; -#if (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) < PCL_LINEAR_VERSION(4,5,0) && ! defined(__clang__)) || defined(__INTEL_COMPILER) -#define PCL_DEPRECATED_CLASS(func, message) __attribute__ ((deprecated)) func -#endif - +// check Intel compiler first since it usually also defines __GNUC__, __clang__, etc. +#if defined(__INTEL_COMPILER) + #define PCL_DEPRECATED_CLASS(func, message) __attribute((deprecated)) func +#elif (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) < PCL_LINEAR_VERSION(4,5,0) && ! defined(__clang__)) || defined(__INTEL_COMPILER) + #define PCL_DEPRECATED_CLASS(func, message) __attribute__ ((deprecated)) func // gcc supports this starting from 4.5 : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43666 -#if (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) >= PCL_LINEAR_VERSION(4,5,0)) || (defined(__clang__) && __has_extension(attribute_deprecated_with_message)) -#define PCL_DEPRECATED_CLASS(func, message) __attribute__ ((deprecated(message))) func -#endif - -#ifdef _MSC_VER -#define PCL_DEPRECATED_CLASS(func, message) __declspec(deprecated(message)) func -#endif - -#ifndef PCL_DEPRECATED_CLASS -#pragma message("WARNING: You need to implement PCL_DEPRECATED_CLASS for this compiler") -#define PCL_DEPRECATED_CLASS(func) func +#elif (defined(__GNUC__) && PCL_LINEAR_VERSION(__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__) >= PCL_LINEAR_VERSION(4,5,0)) || (defined(__clang__) && __has_extension(attribute_deprecated_with_message)) + #define PCL_DEPRECATED_CLASS(func, message) __attribute__ ((deprecated(message))) func +#elif defined(_MSC_VER) + #define PCL_DEPRECATED_CLASS(func, message) __declspec(deprecated(message)) func +#else + #pragma message("WARNING: You need to implement PCL_DEPRECATED_CLASS for this compiler") + #define PCL_DEPRECATED_CLASS(func) func #endif #if defined (__GNUC__) || defined (__PGI) || defined (__IBMCPP__) || defined (__SUNPRO_CC) From ba4fabb634a7b46aa16f85b48a9a80141dd68367 Mon Sep 17 00:00:00 2001 From: sven Date: Mon, 10 Sep 2018 10:23:09 -0700 Subject: [PATCH 2/2] fix intel _mm_malloc definition conflicts with GCC --- cmake/pcl_find_sse.cmake | 13 +++++++++---- common/include/pcl/pcl_macros.h | 7 ++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cmake/pcl_find_sse.cmake b/cmake/pcl_find_sse.cmake index eaf37490353..3b6a3e5f1f6 100644 --- a/cmake/pcl_find_sse.cmake +++ b/cmake/pcl_find_sse.cmake @@ -12,18 +12,23 @@ macro(PCL_CHECK_FOR_SSE) endif() endif() - # Unfortunately we need to check for SSE to enable "-mfpmath=sse" alongside + # Unfortunately we need to check for SSE to enable "-mfpmath=sse" alongside # "-march=native". The reason for this is that by default, 32bit architectures # tend to use the x87 FPU (which has 80 bit internal precision), thus leading # to different results than 64bit architectures which are using SSE2 (64 bit internal - # precision). One solution would be to use "-ffloat-store" on 32bit (see + # precision). One solution would be to use "-ffloat-store" on 32bit (see # http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html), but that slows code down, # so the preferred solution is to try "-mpfmath=sse" first. include(CheckCXXSourceRuns) set(CMAKE_REQUIRED_FLAGS) check_cxx_source_runs(" - #include + // Intel compiler defines an incompatible _mm_malloc signature + #if defined(__INTEL_COMPILER) + #include + #else + #include + #endif int main() { void* mem = _mm_malloc (100, 16); @@ -122,7 +127,7 @@ macro(PCL_CHECK_FOR_SSE) elseif(MSVC AND NOT CMAKE_CL_64) set(CMAKE_REQUIRED_FLAGS "/arch:SSE2") endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG) - + check_cxx_source_runs(" #include int main () diff --git a/common/include/pcl/pcl_macros.h b/common/include/pcl/pcl_macros.h index 6c1680e0c24..7a5f78dd12e 100644 --- a/common/include/pcl/pcl_macros.h +++ b/common/include/pcl/pcl_macros.h @@ -393,7 +393,12 @@ log2f (float x) #endif #if defined (HAVE_MM_MALLOC) - #include + // Intel compiler defines an incompatible _mm_malloc signature + #if defined(__INTEL_COMPILER) + #include + #else + #include + #endif #endif inline void*