summaryrefslogtreecommitdiff
path: root/include/my_global.h
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-06-07 12:47:04 +0400
committerAlexander Nozdrin <alik@sun.com>2010-06-07 12:47:04 +0400
commit8a247e963dcaa12b70e9aae0c9f3cb831d30f4a7 (patch)
tree4268070936d3c9dbd27165b1d9c1593e17ec0d61 /include/my_global.h
parente4ab99764249f90a83c7f384eadc913331c59aee (diff)
parent75dce25ca8276f56c45f747c9a9a1b4046b6efca (diff)
downloadmariadb-git-8a247e963dcaa12b70e9aae0c9f3cb831d30f4a7.tar.gz
Manual merge from mysql-trunk-bugfixing.
Conflicts: - BUILD/SETUP.sh - mysql-test/mysql-test-run.pl - mysql-test/r/partition_error.result - mysql-test/t/disabled.def - mysql-test/t/partition_error.test - sql/share/errmsg-utf8.txt
Diffstat (limited to 'include/my_global.h')
-rw-r--r--include/my_global.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 6246bde0cbc..7b9c34cd724 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -77,6 +77,11 @@
#define C_MODE_END
#endif
+#ifdef __cplusplus
+#define CPP_UNNAMED_NS_START namespace {
+#define CPP_UNNAMED_NS_END }
+#endif
+
#if defined(_WIN32)
#include <my_config.h>
#elif defined(__NETWARE__)
@@ -1074,6 +1079,17 @@ typedef long long my_ptrdiff_t;
#define MY_DIV_UP(A, B) (((A) + (B) - 1) / (B))
#define MY_ALIGNED_BYTE_ARRAY(N, S, T) T N[MY_DIV_UP(S, sizeof(T))]
+#ifdef __cplusplus
+template <size_t sz> struct Aligned_char_array
+{
+ union {
+ void *v; // Ensures alignment.
+ char arr[sz]; // The actual buffer.
+ } u;
+ void* arr() { return &u.arr[0]; }
+};
+#endif /* __cplusplus */
+
/*
Custom version of standard offsetof() macro which can be used to get
offsets of members in class for non-POD types (according to the current