From b8535d17266c43d5310a8ab9b089a3cf588488bb Mon Sep 17 00:00:00 2001 From: Anatoly Baksheev Date: Thu, 15 Jul 2010 15:32:17 +0000 Subject: [PATCH] bixed bug in cudaSafeCall --- modules/gpu/cuda/cuda_shared.hpp | 2 +- modules/gpu/src/precomp.hpp | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/gpu/cuda/cuda_shared.hpp b/modules/gpu/cuda/cuda_shared.hpp index 391773be2d..0f154d6dc7 100644 --- a/modules/gpu/cuda/cuda_shared.hpp +++ b/modules/gpu/cuda/cuda_shared.hpp @@ -65,7 +65,7 @@ namespace cv } #ifdef __CUDACC__ - #define cudaSafeCall(err) { if( cudaSuccess != err) cv::gpu::error(cudaGetErrorString(err), __FILE__, __LINE__); } + #define cudaSafeCall(expr) { cudaError_t err = expr; if( cudaSuccess != err) cv::gpu::error(cudaGetErrorString(err), __FILE__, __LINE__); } #endif #endif /* __OPENCV_CUDA_SHARED_HPP__ */ diff --git a/modules/gpu/src/precomp.hpp b/modules/gpu/src/precomp.hpp index 5584586a7a..ca87d9ae81 100644 --- a/modules/gpu/src/precomp.hpp +++ b/modules/gpu/src/precomp.hpp @@ -53,30 +53,28 @@ #include #include "opencv2/gpu/gpu.hpp" -#include "opencv2/gpu/gpumat.hpp" - #include "cuda_shared.hpp" #ifndef HAVE_CUDA - #define cudaSafeCall(err) CV_Error(CV_GpuNotFound, "The library is compilled with no GPU support") - #define cudaCallerSafeCall(err) CV_Error(CV_GpuNotFound, "The library is compilled with no GPU support") + #define cudaSafeCall(expr) CV_Error(CV_GpuNotFound, "The library is compilled with no GPU support") + #define cudaCallerSafeCall(expr) CV_Error(CV_GpuNotFound, "The library is compilled with no GPU support") #else /* HAVE_CUDA */ -#if _MSC_VER >= 1200 - #pragma warning (disable : 4100 4211 4201 4408) +#if _MSC_VER >= 1200 + #pragma warning (disable : 4100 4211 4201 4408) #endif #include "cuda_runtime_api.h" #ifdef __GNUC__ - #define cudaSafeCall(err) { if(cudaSuccess != err) cv::gpu::error(cudaGetErrorString(err), __FILE__, __LINE__, __func__); } + #define cudaSafeCall(expr) { cudaError_t err = expr; if(cudaSuccess != err) cv::gpu::error(cudaGetErrorString(err), __FILE__, __LINE__, __func__); } #else - #define cudaSafeCall(err) { if(cudaSuccess != err) cv::gpu::error(cudaGetErrorString(err), __FILE__, __LINE__); } + #define cudaSafeCall(expr) { cudaError_t err = expr; if(cudaSuccess != err) cv::gpu::error(cudaGetErrorString(err), __FILE__, __LINE__); } #endif -#define cudaCallerSafeCall(err) err; +#define cudaCallerSafeCall(expr) expr; #endif /* HAVE_CUDA */