[arrayfire] 56/84: Adding __AF_FILENAME__ to give the just filename without the path
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Jan 4 23:22:24 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository arrayfire.
commit affc59b7a9da6435a14030ea87c38afa7ae49615
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date: Mon Dec 28 20:25:13 2015 -0500
Adding __AF_FILENAME__ to give the just filename without the path
---
src/api/c/err_common.hpp | 11 ++++++-----
src/api/c/graphics_common.hpp | 6 +++---
src/api/cpp/error.hpp | 7 ++++---
src/backend/cpu/err_cpu.hpp | 2 +-
src/backend/cuda/err_cuda.hpp | 2 +-
src/backend/defines.hpp | 8 +++++++-
src/backend/opencl/err_opencl.hpp | 2 +-
7 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/src/api/c/err_common.hpp b/src/api/c/err_common.hpp
index 7c4a6f2..0c40a7d 100644
--- a/src/api/c/err_common.hpp
+++ b/src/api/c/err_common.hpp
@@ -13,6 +13,7 @@
#include <string>
#include <cassert>
#include <af/defines.h>
+#include <defines.hpp>
#include <vector>
class AfError : public std::logic_error
@@ -121,26 +122,26 @@ af_err processException();
#define DIM_ASSERT(INDEX, COND) do { \
if((COND) == false) { \
- throw DimensionError(__FILE__, __LINE__, \
+ throw DimensionError(__AF_FILENAME__, __LINE__, \
INDEX, #COND); \
} \
} while(0)
#define ARG_ASSERT(INDEX, COND) do { \
if((COND) == false) { \
- throw ArgumentError(__FILE__, __LINE__, \
+ throw ArgumentError(__AF_FILENAME__, __LINE__, \
INDEX, #COND); \
} \
} while(0)
#define TYPE_ERROR(INDEX, type) do { \
- throw TypeError(__FILE__, __LINE__, \
+ throw TypeError(__AF_FILENAME__, __LINE__, \
INDEX, type); \
} while(0) \
#define AF_ERROR(MSG, ERR_TYPE) do { \
- throw AfError(__FILE__, __LINE__, \
+ throw AfError(__AF_FILENAME__, __LINE__, \
MSG, ERR_TYPE); \
} while(0)
@@ -162,6 +163,6 @@ af_err processException();
#define AF_CHECK(fn) do { \
af_err __err = fn; \
if (__err == AF_SUCCESS) break; \
- throw AfError(__FILE__, __LINE__, \
+ throw AfError(__AF_FILENAME__, __LINE__, \
"\n", __err); \
} while(0)
diff --git a/src/api/c/graphics_common.hpp b/src/api/c/graphics_common.hpp
index 39225e6..082c0c7 100644
--- a/src/api/c/graphics_common.hpp
+++ b/src/api/c/graphics_common.hpp
@@ -26,9 +26,9 @@ GLenum glErrorSkip(const char *msg, const char* file, int line);
GLenum glErrorCheck(const char *msg, const char* file, int line);
GLenum glForceErrorCheck(const char *msg, const char* file, int line);
-#define CheckGL(msg) glErrorCheck (msg, __FILE__, __LINE__)
-#define ForceCheckGL(msg) glForceErrorCheck(msg, __FILE__, __LINE__)
-#define CheckGLSkip(msg) glErrorSkip (msg, __FILE__, __LINE__)
+#define CheckGL(msg) glErrorCheck (msg, __AF_FILENAME__, __LINE__)
+#define ForceCheckGL(msg) glForceErrorCheck(msg, __AF_FILENAME__, __LINE__)
+#define CheckGLSkip(msg) glErrorSkip (msg, __AF_FILENAME__, __LINE__)
namespace graphics
{
diff --git a/src/api/cpp/error.hpp b/src/api/cpp/error.hpp
index 7e4854c..cb5a573 100644
--- a/src/api/cpp/error.hpp
+++ b/src/api/cpp/error.hpp
@@ -8,16 +8,17 @@
********************************************************/
#include <af/exception.h>
+#include <defines.hpp>
#define AF_THROW(fn) do { \
af_err __err = fn; \
if (__err == AF_SUCCESS) break; \
- throw af::exception(__FILE__, __LINE__, __err); \
+ throw af::exception(__AF_FILENAME__, __LINE__, __err); \
} while(0)
#define AF_THROW_MSG(__msg, __err) do { \
if (__err == AF_SUCCESS) break; \
- throw af::exception(__msg, __FILE__, __LINE__, __err); \
+ throw af::exception(__msg, __AF_FILENAME__, __LINE__, __err); \
} while(0);
-#define THROW(__err) throw af::exception(__FILE__, __LINE__, __err)
+#define THROW(__err) throw af::exception(__AF_FILENAME__, __LINE__, __err)
diff --git a/src/backend/cpu/err_cpu.hpp b/src/backend/cpu/err_cpu.hpp
index e0359a8..86239ed 100644
--- a/src/backend/cpu/err_cpu.hpp
+++ b/src/backend/cpu/err_cpu.hpp
@@ -10,5 +10,5 @@
#include <err_common.hpp>
#define CPU_NOT_SUPPORTED() do { \
- throw SupportError(__FILE__, __LINE__, "CPU"); \
+ throw SupportError(__AF_FILENAME__, __LINE__, "CPU"); \
} while(0)
diff --git a/src/backend/cuda/err_cuda.hpp b/src/backend/cuda/err_cuda.hpp
index 0692f1e..74599f8 100644
--- a/src/backend/cuda/err_cuda.hpp
+++ b/src/backend/cuda/err_cuda.hpp
@@ -13,7 +13,7 @@
#include <err_common.hpp>
#define CUDA_NOT_SUPPORTED() do { \
- throw SupportError(__FILE__, __LINE__, "CUDA"); \
+ throw SupportError(__AF_FILENAME__, __LINE__, "CUDA"); \
} while(0)
#define CUDA_CHECK(fn) do { \
diff --git a/src/backend/defines.hpp b/src/backend/defines.hpp
index 2689837..c65fe51 100644
--- a/src/backend/defines.hpp
+++ b/src/backend/defines.hpp
@@ -9,13 +9,19 @@
#pragma once
+#include <string.h>
#if defined(_WIN32) || defined(_MSC_VER)
#define __PRETTY_FUNCTION__ __FUNCSIG__
#if _MSC_VER < 1900
#define snprintf sprintf_s
#endif
#define STATIC_ static
+ #define __AF_FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
#else
- #define __PRETTY_FUNCTION__ __func__
+ #ifndef __PRETTY_FUNCTION__
+ #define __PRETTY_FUNCTION__ __func__ // __PRETTY_FUNCTION__ Fallback
+ #endif
#define STATIC_ inline
+ #define __AF_FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#endif
+
diff --git a/src/backend/opencl/err_opencl.hpp b/src/backend/opencl/err_opencl.hpp
index 0379402..3b56ae7 100644
--- a/src/backend/opencl/err_opencl.hpp
+++ b/src/backend/opencl/err_opencl.hpp
@@ -15,7 +15,7 @@
#include <types.hpp>
#define OPENCL_NOT_SUPPORTED() do { \
- throw SupportError(__FILE__, __LINE__, "OPENCL"); \
+ throw SupportError(__AF_FILENAME__, __LINE__, "OPENCL"); \
} while(0)
#define CL_TO_AF_ERROR(ERR) do { \
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list